Skip to:

Display Location User Meta below User Role

  • kate.t


    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 4 replies - 1 through 4 (of 4 total)

  • kate.t


    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 1 year, 6 months ago by  kate.t.



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



    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


    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

    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

    			<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(); ?>" />
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.