Hello, I have asked these questions at buddypress but I can’t seem to get an answer.
I have your premium plugins that come with your support package. I would like to match the visibility options order of buddypress to the order in your plugins.
Buddypress – Everyone, Only me, Friends Only, All Members
Your plugins – Everyone, Logged In Users Only, Friends Only, Only Me
I would also like to add followers to the options positioned after Logged In Users.
Thankyou for your help.
Hi Mark,
Thank you for asking.Here is the code that you can put in your bp-custom.php to change the order
/** * Update profile visibility option for BuddyPress. */ function buddydev_update_profile_field_privacy_options() { $levels = buddypress()->profile->visibility_levels; // and now we will override it's order. buddypress()->profile->visibility_levels = array( 'public' => $levels['public'], 'loggedin' => $levels['loggedin'], 'friends' => $levels['friends'], 'adminsonly' => $levels['adminsonly'], ); } add_action( 'bp_xprofile_setup_globals', 'buddydev_update_profile_field_privacy_options' );
I am just reusing BuddyPress’s default values in the above code and reordering them.
I am not sure if the follower option is supported by BuddyPress. To add that to profile visibility level, you will need to add a new visibility level and a handler for it.
I wrote a post a few years about the same here
https://buddydev.com/buddypress/extending-buddypress-profile-field-visibility/Hope that helps.
Regards
BrajeshHi Mark,
Here is how it looks to mehttps://i.imgur.com/mnQbNDk.png
Are you seeing a different order?
If yes, most probably another plugin is updating the order too.
A solution might be to change the priority of the function that we are using to reorder.
For example
add_action( 'bp_xprofile_setup_globals', 'buddydev_update_profile_field_privacy_options' );
Can be changed to this
add_action( 'bp_xprofile_setup_globals', 'buddydev_update_profile_field_privacy_options', 1001 );
and should most probably work.
No problem. Sometimes, overriding is only option. For example, the above code will have issues(If any plugin adds new visibility level, they will be hidden).
So, Please keep that in perspective while adding new visibility level.
Regards
BrajeshHi Mark,
Please post your code here using backticks(`) or link me to the code on pastebin or any other place.I will update it as needed.
Thank you
Brajesh
You must be logged in to reply to this topic.