Forum Replies Created
-
Hi again,
So I suppose that I need to place that two lines of code after add_action, right?
if ( bp_is_user() ) { $field_data = xprofile_get_field_data( ‘Age’, bp_displayed_user_id() ); if ( ! empty( $field_data ) ) { return $name . ‘, <span class=”bp-user-age”>’ . $field_data . ‘</span>’; } } return $name; } add_action( ‘<strong>$user_info = get_userdata( bp_displayed_user_id() ); $nicename = $user_info->user_nicename;</strong> ’, ‘yzc_add_xprofile_field_data_in_profile_header’ );
Thank you @shanebp !! I check that link and tried multiple options for around an hour but I’m quite lost.
How can I apply that usernice name into this code?
function yzc_add_xprofile_field_data_in_profile_header( $name ) {
if ( bp_is_user() ) {
$field_data = xprofile_get_field_data( ‘Age’, bp_displayed_user_id() );
if ( ! empty( $field_data ) ) {
return $name . ‘, <span class=”bp-user-age”>’ . $field_data . ‘</span>’;
}
}return $name;
}
add_action( ‘bp_get_displayed_user_mentionname’, ‘yzc_add_xprofile_field_data_in_profile_header’ );
Thanks again 🙂
Hi @ukai-themes,
Your help was really helpfull but I’m still stucked trying to show the age after the user nicename in members profile. Your previous code showed after the user_mentionname but I need after nicename. Is that posible? I attach you an image:
Thanks!
Hi again,
I’m 99% sure that both results needs to be exactly the same. So if a field it’s “Chicago, IL, USA” the group has to be “Chicago, IL, USA”. You can test it with a simple result like “Chicago” and see if it’s working. Important: check that group-field has the same name and slug.
You should need to rename groups or fields yes.
Hi again, in Pattern field you need to place this: %answer%. Take a look to this: https://i.gyazo.com/5eb1ac4a6460c2aa9f4c958a0c0046a6.png
So if you have a Group called “Barcelona” and the user choose in city field “Barcelona”, he will join the group automatically.
Cheers!
@allnamestaken I tested Group-o-Matic and it’s actually working with the latest WP & BP installations
I don’t know if it’s compatible with gravity forms but it working perfectly for me adding automatically the members to a group corresponding with the same name of a certain field in their profile forms.
Thank you so much! That really helps
Cheers!
Wow, thank you so much!
The new class/style works perfect, but after add that new snippet, the age it’s not included on my profile member pages (it did on members directory perfectly and with latest code in wrong place… but now in any part of the profile page). I think it’s be related with a custom hook of my WP template, could you take a look if it is posible? Just to be sure that works and I’m not doing something wrong.
I wrote you an email to your github email direction with the link of the webpage
Thanks again!!
Hi, thanks for the snippet!
I works but it’s displayed different than the members directory:
How can I set it the username + age in the same line (“username, 18”)?
Also, it is posible to style the $field_data? In the original snippet, the age it’s in bold weight (same as name) and I would like to set a regular font weight.
@ukai-themes Following this link: https://gist.github.com/KaineLabs/f431ef4177757e61f9a638607c9879e0 If I want to show age in the profile page, I suppose that I need to add a hook to profile pages like it does with directoy:
if ( bp_is_members_directory() ) {
but I can’t make it work.
Do you know how could I do it?
Thanks
Any news about this? I think it’s a really interesting feature
You was right, I just needed to setup correctly Group-o-Matic. It was a little bit confuse but ir works perfect!
Thanks for your reply
Hi @shanebp
How can I place the current user id of the profile you are visiting? I have this but links to your own profile:
Thanks!
Hi, is there actually any alternative for this?
Hi @ukai-themes
That works perfectly, thanks a lot!! Also, how could I add the age to the user profile page?
Can anyone help me?
Any news? 😉
Solved, if anyone is interested:
I used the plugin “PHP Code For Posts” to create a shortcode with my php code and then I used the plugin “Shortcodes in Menus” to show it in my menu (Buddypress menu in this case).
Thank you shanebp 😉
Thank you so much, but I don’t get where I have to place/modify that code (in what FTP route).
Regards