WordPress.org

Ready to get started?Download WordPress

Forums

Extended Author Profiles (7 posts)

  1. Coolzor
    Member
    Posted 8 years ago #

    I want to extend the author profiles within wp, making it possible for authors to add address, zip code, city, birthday etc.

    I modded the profile.php file, and the fields I've created appear online in the profile page, but the content I enter isn't being reproduced when I click the 'update profile' button.

    So I figured something else should be changed.

    I then looked in the template-functions-author.php file and saw I could define includes, and so I added the ones of the fields I've created, but still no results.

    Then I saw the registration-functios.php file where I could add stuff in the update_usermeta list.

    Still no result.

    My question is: what should I change to make wp 1. remember what has been inputted in the fields I've created and 2. reproduce it correctly when the settings are saved.

    Thanks.

  2. Coolzor
    Member
    Posted 8 years ago #

    Okay, I'm a bit further down the road. I created extra fields in PHPMyAdmin, on the SQL server.

    For every category I wanted to add in the profile, a new field in the existing table wp_users.

    In profile.php I call the fields, they appear. So far so good. (see previous post)

    in registration-functions.php I added:

    update_usermeta( $user_id, 'street', $user_address );

    and so on... to the list of existing update_usermeta that already was there.

    In that same file, a bit higher there's an 'if ( $update )' section where I added:

    user_address = '$user_address' (and so on) before the WHERE ID = '$ID'";

    same file a bit below the previous rules I added it again where it says: $query = "INSERT INTO $wpdb->users

    I added user_address and so on for every desired field

    Then I also added to the VALUES section: '$user_address' and so on for every desired field

    In the file template-functions-author.php I added functions to call all fields created:

    function get_the_author_address() {
    global $authordata;
    return $authordata->user_address;
    }

    function the_author_address() {
    echo get_the_author_address();
    }

    and repeated that for every desired field.

    It still doesn't save the data I enter in the fields. What am I missing?

    Anyone?

  3. pramudita
    Member
    Posted 7 years ago #

    did you tried to edit admin-functions.php ?

  4. katesgasis
    Member
    Posted 7 years ago #

    You don't actually need another table for that. Use the usermeta. Here's the one I used.

    function mailinginfo_update() {
    global $user_ID;
    get_currentuserinfo();
    if(isset($_POST['street1'])) {
    update_usermeta($user_ID,'street1',$_POST['street1']);
    }
    if(isset($_POST['street2'])) {
    update_usermeta($user_ID,'street2',$_POST['street2']);
    }
    if(isset($_POST['city'])){
    update_usermeta($user_ID,'city',$_POST['city']);
    }
    if(isset($_POST['country'])){
    update_usermeta($user_ID,'country',$_POST['country']);
    }
    if(isset($_POST['country'])){
    update_usermeta($user_ID,'zipcode',$_POST['zipcode']);
    }
    }
    add_action('personal_options_update','mailinginfo_update');

    Use it in your plugin. Don't touch the core files or you'll regret it when upgrading time comes.

  5. kevandali
    Member
    Posted 7 years ago #

    I have installed the usermeta and userextra plugins and they have been activated.
    I can click on usernames at http://www.chocolatebones.co.uk/ucsm and i get an information page.
    What I would like to know is how do i change the question, add answers and also make the users appear in the side panel?

    any help at all appreciated, have searched everywhere and there dosn't seem to be any step by step account on how to get all this usermeta/userextra plugins working.

    The bottom line is i just want users to be able to click on other users and read their extended profiles, all from a list contained in the side bar, help required desperately

  6. defaultkitty
    Member
    Posted 7 years ago #

    To list the authors on the sidebar, just put this wherever you want:
    <?php wp_list_authors(); ?>

    The admin is excluded by default. There is a way to include the admin. Unfortunately I don't have that.

    As for adding the extended fields to the profile? I'm trying to figure that one out myself. :\

  7. rudolf45
    Member
    Posted 7 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags