WordPress.org

Ready to get started?Download WordPress

Forums

Adding new fields to WordPress tables(database) (9 posts)

  1. Wolfull
    Member
    Posted 5 years ago #

    I want to store extra user-information in the wordpress database, thus i want to create new fields in the wp_users table. Would this cause any problems later on?

    Eg; When upgrading wordpress do extra fields get lost?

  2. NC@WP
    Member
    Posted 5 years ago #

    It may; the problem is the possibility of field name collision; you introduce a field called xyz, and a year down the road, a field with that name may appear in the next version of WordPress, so the upgrade will either fail on your installation or it will erase your data or WordPress will work incorrectly because of unexpected data in that field.

    So what you may want to do is to create a new table, call it something like wp_users_extra and keep your data in it.

  3. mikesmobile
    Member
    Posted 5 years ago #

    Hi Wolfull and NC@WP.

    I stumbled upon your posts from Google. I am hoping you could provide some guidance.

    Here is what I am trying to do:
    1) Add a new table to my WP database. I got this part down okay.
    2) Add a few fields to said table. I got this part down okay.
    3) I need to add the ability to add that field data to my WP templates. How do I call that data?

    I was going to simply add fields to the wp_user table, but after reading NC@WP's response, I decided to create a new table.

    Any guidance would be much appreciated.

  4. MichaelH
    Member
    Posted 5 years ago #

  5. mikesmobile
    Member
    Posted 5 years ago #

    MichaelH. That's great. I will look at the plug-in. Let's say that I get the table created and data stored, how do I "call" that data? Is there a preferred method? I saw the post located at, http://codex.wordpress.org/wpdb. I'm still reading through it. Am I looking in the right area?

    Thanks.

  6. MichaelH
    Member
    Posted 5 years ago #

  7. mikesmobile
    Member
    Posted 5 years ago #

    Thanks MichaelH. I will look at the documentation.

  8. mikesmobile
    Member
    Posted 5 years ago #

    Thanks also to NC@WP (above) who provided this link which further clarifies the 'wpdb Class', http://codex.wordpress.org/Function_Reference/wpdb_Class.

  9. RishikeshJha
    Member
    Posted 4 years ago #

    my problem was sloved by this link

    Why not look at a plugin such as http://www.cimatti.it/blog/cimy-wordpress-plugins/cimy-user-extra-fields/

    but there is one problem i want to add a date of birth filed in registration form and . can any one tell me how to validate this filed.

    thanks in advance....

Topic Closed

This topic has been closed to new replies.

About this Topic