Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display Location User Meta below User Role


  • kate.t
    Participant

    @katet-1

    Hi everyone, how do I display the location user meta below the user role?

    For eg, on the left of this reply box, below user name is user role, and below user role is the freshness of the post.

    I would like to display the location of the user below the user role, drawing from the user meta

    Thanks and I’ll really appreciate any help!

Viewing 7 replies - 1 through 7 (of 7 total)

  • kate.t
    Participant

    @katet-1

    Thank God! I found the answer just when I need it, and I’ll like to share with all of you. As well as for myself in case I forget.

    I went to loop-single-reply.php in bbpress-theme-compat/bbpress

    I added below residence;

    by the way ‘residence’ is the usermeta key that I have used for country of the author. I used the User Meta Pro plugin to create that field in registration and attached the usermeta key to that piece of information. Hope this helps whoever is looking for it

    • This reply was modified 12 years, 1 month ago by kate.t.

    kate.t
    Participant

    @katet-1

    i don’t know whats happening, the code is not showing


    kate.t
    Participant

    @katet-1

    I added below < ?php do_action( 'bbp_theme_after_reply_author_details' );


    $user_id = bbp_get_reply_author_id( $reply_id );
    $usermeta = get_userdata( $user_id, 'residence' );
    echo $usermeta->residence;


    Robin W
    Moderator

    @robin-w

    Kate t

    Thanks for posting this, saved me hours of trying to work out which file I needed to change, and how to code it.

    For those that want to add fields to their users, as well as Kate’s Meta pro, the following link shows how to add and use custom field, and the combination of these two made it quick and simple

    Adding and using custom user profile fields

    I also added the ability within BBpress for the user to change their location within the built in profile amend by changing Form-user-edit.php (located in web/wp-content/plugins/bbpress/templates/default/bbpress

    The following was added after line 125
    <?php bbp_edit_user_display_name(); ?>
    BBpress version 2.3.1

    <div>
    			<label for="town"><?php _e( 'Town', 'bbpress' ); ?></label>
    			<input type="text" name="town" id="town" value="<?php echo esc_attr( bbp_get_displayed_user_field( 'town' ) ); ?>" class="regular-text" tabindex="<?php bbp_tab_index(); ?>" />
    		</div>

    buzoo
    Participant

    @buzoo

    HI i was able to save and show the new field “location” under the name. How can i let user’s edit there location from there profile. I did tried above method given bu Robin but it aint work
    PS i have integrated buddy press- bbpress does it has to be editing the buddypress files o.o


    Robin W
    Moderator

    @robin-w

    I have no idea of this plugin works if you are using buddypress (it does with bbpress) but might be worth a quick test – let us know either way !

    https://wordpress.org/plugins/bbp-profile-information


    buzoo
    Participant

    @buzoo

    Nope bad luck it didn’t worked with buddypress user profile UI but it worked very well with bbpress. I installed Buddypress just to activate the Personal Messenger option to my forum which isn’t available in the bbpress :/

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar