• Resolved StrangeAttractor

    (@strangeattractor)


    I’m trying to fix a bug in the Register Plus plugin. It uses the update_usermeta function to create and update extra fields in the registration form and the user profile.

    The problem is that it uses update_usermeta function for the user_url (website on the profile). But in fact user_url is stored in the wp_user table, not in the wp_usermeta table.

    As a result, you can’t update any user website that has been entered at registration.

    So I’d like to know if there’s a WordPress function like update_usermeta that writes to wp_user table instead of the wp_usermeta table.

    And if so, how do you use it?

    Much thanks, haven’t been able to find what I’m looking for in the Codex.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter StrangeAttractor

    (@strangeattractor)

    update_usermeta should work for this:

    update_usermeta( $user->id,'user_url','http://someurl' );

    But, if it doesn’t, maybe check out wp_update_user:
    http://codex.wordpress.org/Function_Reference/wp_update_user

    Thread Starter StrangeAttractor

    (@strangeattractor)

    Thanks! The link you provided is what I was looking for, so I’ll see if that works.

    The example you give for update_usermeta is what the Register Plus script uses, but as far as I can tell, WordPress’s native register / profile scripts store user_url in the user table, not in the usermeta table.

    Maybe something like this then:

    wp_update_user( array( 'user_url' => 'http://some-url' ) );
    Thread Starter StrangeAttractor

    (@strangeattractor)

    Thanks so much, greenshady. This information was difficult to find, and I had some trouble with it, because my understanding of arrays is not very good.

    Anyway, I got it to do what I wanted — fix a bug in the Register Plus plugin that was writing the website to the wrong table (usermeta instead user table), and thus making it impossible to update the website by editing the user profile.

    I posted my correction of the bug in this thread:
    http://wordpress.org/support/topic/246570

    (Actually, if you can see any problems — such as security issues — with what I posted, please let me know…)

    Thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘is there a function like update_usermeta to update wp_user table?’ is closed to new replies.