• yatesa01

    (@yatesa01)


    When using the BuddyPress Nouveau template, using this plugin causes the “Add Friend” buttons to disappear from user profiles. Deactivating this plugin brings them back, or switching to the legacy template. Is there any update on fixing this issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Look for the bpro_nouveau_friend_button_hide() function in the plugin’s includes/core.php file. The filter isn’t returning a value.

    Don’t change the plugin code. Until the developer corrects the issue, you can add this to your theme’s functions.php file:

    remove_filter( 'bp_get_add_friend_button', 'bpro_nouveau_friend_button_hide', 101, 1 );
    
    function my_bpro_nouveau_friend_button_hide( $args ) {
    
      if ( ! function_exists('bp_nouveau') ) {
        return $args;
      }
      $moderated = bp_registration_get_moderation_status( get_current_user_id() );
      if ( function_exists( 'bp_displayed_user_id' ) ) {
        $displayed_moderated = bp_registration_get_moderation_status( bp_displayed_user_id() );
      }
    
      if ( $moderated || $displayed_moderated ) {
        if ( 'friends' === bp_nouveau()->members->button_args['component'] ) {
          bp_nouveau()->members->button_args = [];
        }
      }
    
      return $args;
    }
    add_filter( 'bp_get_add_friend_button', 'my_bpro_nouveau_friend_button_hide', 101, 1 );

    This dupes the code from the original function in the plugin, and simply adds the last line, “return $args;”

    I have a site that is doing the same thing.

    Tried the code above but no joy ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.