Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

  • bruce7075
    Participant

    @bruce7075

    Sorry, I know what goes wrong now. Sorry for this.


    bruce7075
    Participant

    @bruce7075

    Weird! I use Notepad++ to create bp-custom.php and I add only the codes you provide, no other codes. I just tried again and it let my whole site become completely blank.

    Or, is there any available plugin which can do the same thing? Thanks very much for your very kind help in this case!!!


    bruce7075
    Participant

    @bruce7075

    Oops! Sorry for this. I didn’t know this. Next time I will use button.

    This is the first time I use bp-custom.php. There is no other codes/functions in this file. Could it be possibly caused by other plugins?


    bruce7075
    Participant

    @bruce7075

    Yes, I have read codex abot bp-custom. I also have added php tag as below.

    <?php
    // hide friendship activity stream sitewide
    function bpfr_maybe_hide_friends_nav_etc() {
        $retval = false;
       
        if ( bp_is_user() && ! bp_is_my_profile() && ! friends_check_friendship( bp_displayed_user_id(), bp_loggedin_user_id() ) ) {
            $retval = true;
        }
       
        return $retval;
    }
    
    function bpfr_hide_friends_nav_to_non_friends() {
       
        // Stop if condition is not filed
        if ( ! bpfr_maybe_hide_friends_nav_etc() ) {
            return;
        }
        // otherwise, we remove the nav
        bp_core_remove_nav_item( 'friends' ); // bp topnav
        bp_core_remove_subnav_item( 'activity', 'friends' ); //bp subnav (my activities, my groups, etc)
    }
    add_action( 'bp_ready', 'bpfr_hide_friends_nav_to_non_friends' );
    
    // we want also to remove all friends related activities to non friends
    function bpfr_hide_friends_activity_type_to_non_friends( $activity_action = array(), $component_id = '' ) {
       
        // if condition is not filed we go back to original output
        if ( 'friends' != $component_id || ! bpfr_maybe_hide_friends_nav_etc() ) {
            return $activity_action;
        }
       
        // otherwise, we remove member from context
        $activity_action['context'] = array_diff( $activity_action['context'], array( 'member' ) );
       
        return $activity_action;
    }
    add_filter( 'bp_activity_set_action', 'bpfr_hide_friends_activity_type_to_non_friends', 10, 2 );
    ?>

    bruce7075
    Participant

    @bruce7075

    Hi,

    Thanks! I upload the bp-custom.php to /wp-content/plugins/ and it causes my site completely blank. Please kindly help.


    bruce7075
    Participant

    @bruce7075

    Hi, need to add above code to which file? Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar