Importing data into serialized array in Wordpress

I have creating website for a basketball league. I used Formidable Pros for the front end registration and payments. I am now using sportpress pro to set up players, teams, schedules,etc. I created  a csv file that I was going to import in sportpresspro database but found out they are not using tables but postmeta data instead of tables. Is there a way to import my data into this array. Thanks
HidesignAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineNo oneCommented:
Almost all plugins that store data will store it as key-value pairs in some meta table.  Formidable does this, Gravity does this, etc.

What you think of when you want to import is a single CSV into a vanilla row/column format table and obviously that won't quite work if the plugin has no import routine.  What you need to do instead is figure out the structure of the meta tables in play and run a series of imports via MySQL to fully upload your data.

For example, assuming the plugin creates a custom post type then you need to figure out what gets posted in the wp-posts table (probably the team).  From there do a simple insert query to add all teams to wp-posts and then extract the ID numbers.  From there you can build queries that create new rows in whatever tables are needed, making sure to include the post ID number when necessary.
0
HidesignAuthor Commented:
Thanks - the plugin does come with an import feature but it only imports 7 set fields. I wanted other fields in addition so I don't have to retype them. I want to import the players with height, weight, grade and contact info. One of the preset fields is postion and I was thinking about putting the grade in that field if I can figure out how to change the text in the backend to say grade instead of position.

I was looking through the wp_postmeta table to see how it laid out. There is so much data that is not related to the players so I'm sure how to update.
0
Jason C. LevineNo oneCommented:
It's not the easiest thing in the world to see unless you are very familiar with WordPress and, furthermore, wp_postmeta is not the only thing in play here.  I'll try to explain:

wp_postmeta has four columns:

meta_id = autoincrementing primary key
post_id = the ID of the post this meta relates to
meta_key = the name of the meta item
meta_value = the value of the meta item

This construction means you can have a one-to-many relationship between a post item (which are a custom post type) and postmeta.  Postmeta is primarily used for custom fields...so anything in this system that appears in postmeta can be replicated/updated by query.  To determine what is in postmeta, go to the All [Whatever] screen and hover over any edit link.  In the URL will be an ID number for that team.  That's the post_id.  Search for that in postmeta:

SELECT * FROM wp_postmeta WHERE post_id = X

Open in new window


and you will see how the custom fields for teams are constructed and you should be able to figure out how to manipulate from there. You just search on post_id and/or meta_key to narrow it down.

But, in all likelihood, the data you really want is stored elsewhere.

I want to import the players with height, weight, grade and contact info.

Because this is a paid plugin, I can't really see what is going on with it so I'm making some guesses here.

If players are users then that data will be in usermeta.  Same basic rules as postmeta, just different tables.  The plugin probably adds some user custom fields but you can do the same thing with some extra code in functions.php:

http://wpengineer.com/2173/custom-fields-wordpress-user-profile/

or via one of several plugins. The problem with this is that the  SportsPress plugin will not be aware of these other fields so you may end up having to hack it to get them in there properly.  I would suggest checking with their support line to find out the best way to do this.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HidesignAuthor Commented:
Hi - thanks for the info - I'm going through it and the code to see if I can get this working. I'm hoping I can get this data imported. Will take too long to key it all in
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.