Replies
- Anu Sharma on April 5, 2021 at 7:23 am in reply to: [Resolved] Limit BuddyPress Groups Per User version 2.0.2 doesn’t work with BuddyBoss #37459
Hi Thomas,
Thank you for the feedback. Our support team will check it and revert back to you soon.
Regards
Anu - Anu Sharma on April 4, 2021 at 6:51 am in reply to: [Resolved] BuddyPress Auto Friendship Pro feature suggestion #37457
Hi Tosin,
Thank you for the suggestion. We will think about this feature and implement in new update
Regards
Anu Hi Tosin,
Sorry for delay, our support team will get back to you soon.
Regards
Anu- Anu Sharma on April 1, 2021 at 9:00 am in reply to: Should BuddyPress User Profile Tabs Creator Pro work with the new BuddyBoss App? #37411
Hi Paul Henderson,
Thank you for using the plugin.
The plugin adds normal BuddyBoss profile tabs.
We don’t have BuddyBoss App, for this compatibility please contact to BuddyBoss support team and ask if 3rd party profile tabs(components) will work with the app?If they need us to make any change, Please let me know.
Regards
Anu Hi Enrons,
Welcome to the BuddyDev forum.To answer your question, let us inspect the edit template. If you open the yourtheme/members/single/profile/edit.php ( or buddypress/members/single/profile/edit.php ), you will see at the top a line, something like this
if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
bp_has_profile() function is responsible for building the loop. Note that bp_has_profile is passing the ‘profile_group_id’ as argument.
The function
bp_get_current_profile_group_id()
returns specific group id(if you are viewing edit profile group, e.g. example.com/members/yourname/profile/edit/group/2/ will return 2), in all other cases, the function returns 1.
So, if you are not on edit profile group, the function always returns 1. 1 is the ID of base profile group, that’s why it is always showing base profile group.
Note:-
Please do not usebp_get_template_part( 'members/single/profile/edit/group/4')
That line assumes you have a file named 4.php in your members/single/profile/edit/group/ folder in your theme( I don’t think that was your intention ).
Now, let us talk about the solutions to your issue:-
Method 1:-
Filter on ‘bp_get_current_profile_group_id’ like this
add_filter('bp_get_current_profile_group_id', 'my_profile_group_id'); function my_profile_group_id( $profile_group_id ) { if( $somecondition & this is my page ) {//replace this line with your condition $profile_group_id = 3;//or any other group id } return $profile_group_id; }
Or Method 2:-
Filter on ‘bp_before_has_profile_parse_args’ or ‘bp_after_has_profile_parse_args’ and modify the group. I prefer the 2nd hook as it gives parsed arguments.
Example:-
add_filter( 'bp_after_has_profile_parse_args', 'buddydev_modify_profile_edit_loop' ); function buddydev_modify_profile_edit_loop( $args ) { //check if it is not our page, just return the args if( ! $my_page ) { //modify it for the condition return $args; } //it is our page, modify the values $args['profile_group_id'] = 3;//change the profile group id //you can change the following fields too //possible fields are //$args['user_id'] = bp_loggedin_user_id();// , //$args['hide_empty_groups'] = true;// hide empty group? //$args['hide_empty_fields'] = false; //$args['exclude_groups'] = '1,3';//change it, It is comma separated list of profile groups ids to exclude //$args['exclude_fields'] = '';// // Comma-separated list of profile field IDs to exclude return $args; }
I have listed all the interesting options it provides and you can uncomment and use any of those to modify the loop
Method 3:-
I will personally prefer it as it is much simple.
Make a copy of yourtheme/members/single/profile/edit.php, include it wherever you want. Just make sure to modify the line
bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() )
to anything like this
$args = array( 'profile_group_id'=> 'some group_id', //all other available options are same from the step 2. ); bp_has_profile( $args )
Hope you choose the right approach that suits your need. Please do let me now if you need any further help.
Have a great day.
Anu