• Resolved vincepettit

    (@vincepettit)


    Hi

    I’m currently trying to expand the fields on the user profile section, (user-edit.php).

    I’ve added the following to the code:

    <tr>
    	<th><label for="twitter"><?php _e('Twitter Username') ?></label></th>
    	<td><input type="text" name="twitter" id="twitter" value="<?php echo $profileuser->twitter ?>" class="regular-text" /></td>
    </tr>

    But what i need to know is how do I add this into the database so when I type something into that field it will save it in the database?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter vincepettit

    (@vincepettit)

    P.S. Incase you are wondering why I want to do this, it is because I wish to add more fields to my author pages – https://www.tech-today.co.uk/author/admin/

    Thread Starter vincepettit

    (@vincepettit)

    Still looking for a workaround for this, tried a few things but not been sucessful as of yet.

    Do I need to create a new meta key, and if so how do I go about that??

    Thread Starter vincepettit

    (@vincepettit)

    Anyone?

    Thread Starter vincepettit

    (@vincepettit)

    I know I don’t have the knowledge to do this, but I thought it was quite a simple request, can anyone help or at least comment??

    It is a fairly easy request, I can’t tell you all the files that need to be tweaked though… May be able to in a week or so, once I get a project I am currently doing that will add new fields to the user meta table, am pondering doing it via a hook or action though if I can find a useable one… Basically look around the PHP files for lines that point to the usermeta table starting with wpdb->… You should find the means there to add extra fields, just by duplicating the ones that add things like Yahoo Messenger, etc, and changing the field / array name to store the right data without overwriting the other… Feel free to PM me and I will offer what help I can as I work offline, and tend my own projects.

    Thread Starter vincepettit

    (@vincepettit)

    Thanks for your help, i’ll have a look around the files

    Knight Vash

    (@infiniteknight)

    Vincepettit, just figured I would give you a further heads up on something I have found of use, when people here ignore your posts…

    A program called Komodo Edit, from Active State, if you use Windows… (I think there is a Linux and Mac version, but I don’t recall…) It’s a free tool, that does very nice for coding most languages, with color coding, etc… There are probably a number of others that will do the same in terms of the search function I use alot, but given I have ActiveState’s Perl, and TCL on my system as well, it just made sense to use Komodo Edit to boot…

    https://www.activestate.com/komodo_edit

    It has a very nice feature that let’s me specify the top of a stock copy of Word Press, search through the entire directory tree for it, for key bits of code, such as in your case, grab the DB key for Yahoo Messenger, and do a search for it, you will find where it gets, added, etc… From there you should be able to find most of the code you need to replicate, and just tweak to collect, then output what you want. That’s how I found the password code and such I needed… Will be doing the profile stuff soon, (had to re-do how my new plugin worked), so I am playing a bit of catch up at the moment…

    did you ever find a reasonable solution to this? i’m in the same situation – trying to add additional data to a user’s profile. i can do it programatically, using


    update_usermeta($userId,'metaFoo',"1");
    $metaFoo = get_usermeta($userId,'metaFoo');

    but there’s no good way to see and/or edit that metadata from within the dashboard, short of relying on some cumbersome and outdated plugins.

    I was looking into the same thing, and found the following pages, which provide source code for a plugin to let you add custom fields to the profile page, which update the usermeta table:

    blog.ftwr.co.uk/archives/2009/07/19/adding-extra-user-meta-fields/

    dquinn.net/adding-custom-user-meta-profile-fields-wordpress/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Adding new meta key to wp_usermeta table in database?’ is closed to new replies.