Display Location User Meta below User Role
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!
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 4 years, 9 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' );
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
<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>
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
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 !
- You must be logged in to reply to this topic.