Profile Visibility Lock

As the plugin provides [ Profile Visibility Lock ] setting for members to set the profile visibility level, the plugin needs to override the BuddyPress default members home template, but if you are using a theme that already overrides BuddyPress templates than you may not be able to see the desired structure of members page which your theme uses as the plugin uses buddypress core template file. To solve the issue you may need to copy the structure from your theme/buddypress/members/single/home.php to plugins override file. Please follow the following steps to accomplish the task.
  1. Search in your theme directory that if there is a file present at the path BuddyPress/members/single/home.php file.
  2. If the file is present in parent theme copy the home.php file content and place it inside the buddypress-private-community-pro/templates/members/single/home.php.
  3. Once you copy theme’s file to the plugin’s file, add $blpro_prof_visib = apply_filters( ‘blpro_profile_visility_home_override’, $visib = true ); after do_action( ‘bp_before_member_body’ );.
  4. Now, you are supposed to find and replace the following content.
Find the following content in the home.php file :
  1. if ( bp_is_user_front() ) :
  2. bp_displayed_user_front_template_part();
  3. elseif ( bp_is_user_activity() ) :
  4. bp_get_template_part( ‘members/single/activity’ );
  5. elseif ( bp_is_user_blogs() ) :
  6. bp_get_template_part( ‘members/single/blogs’    );
  7. elseif ( bp_is_user_friends() ) :
  8. bp_get_template_part( ‘members/single/friends’  );
  9. elseif ( bp_is_user_groups() ) :
  10. bp_get_template_part( ‘members/single/groups’   );
  11. elseif ( bp_is_user_messages() ) :
  12. bp_get_template_part( ‘members/single/messages’ );
  13. elseif ( bp_is_user_profile() ) :
  14. bp_get_template_part( ‘members/single/profile’  );
  15. elseif ( bp_is_user_forums() ) :
  16. bp_get_template_part( ‘members/single/forums’   );
  17. elseif ( bp_is_user_notifications() ) :
  18. bp_get_template_part( ‘members/single/notifications’ );
  19. elseif ( bp_is_user_settings() ) :
  20. bp_get_template_part( ‘members/single/settings’ );
  21. // If nothing sticks, load a generic template
  22. else :
  23. bp_get_template_part( ‘members/single/plugins’  );
  24. endif;
Wrap above content with an if condition like below:
  1. if ( $blpro_prof_visib ) {
  2. if ( bp_is_user_front() ) :
  3. bp_displayed_user_front_template_part();
  4. elseif ( bp_is_user_activity() ) :
  5. bp_get_template_part( ‘members/single/activity’ );
  6. elseif ( bp_is_user_blogs() ) :
  7. bp_get_template_part( ‘members/single/blogs’    );
  8. elseif ( bp_is_user_friends() ) :
  9. bp_get_template_part( ‘members/single/friends’  );
  10. elseif ( bp_is_user_groups() ) :
  11. bp_get_template_part( ‘members/single/groups’   );
  12. elseif ( bp_is_user_messages() ) :
  13. bp_get_template_part( ‘members/single/messages’ );
  14. elseif ( bp_is_user_profile() ) :
  15. bp_get_template_part( ‘members/single/profile’  );
  16. elseif ( bp_is_user_forums() ) :
  17. bp_get_template_part( ‘members/single/forums’   );
  18. elseif ( bp_is_user_notifications() ) :
  19. bp_get_template_part( ‘members/single/notifications’ );
  20. elseif ( bp_is_user_settings() ) :
  21. bp_get_template_part( ‘members/single/settings’ );
  22. // If nothing sticks, load a generic template
  23. else :
  24. bp_get_template_part( ‘members/single/plugins’  );
  25. endif;
  26. }
Once you replace the content you will be able to see the results generated by the plugin. Suppose if a member A has set Profile Visibility to friends only then a member B who is not a friend of A will see a message like below if he/she tries to access member A’s profile.
Update on November 27, 2018