Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • MSoliman
    Participant

    @moefahmy

    i have tried to redirect the non friends members to another tap “profile” instead of “activity” tab .. using the following code .. but it takes too long to redirect then i get “redirected you too many times” error

    function redirect_to_profile() {
    if ( bp_is_user() && ! bp_is_my_profile() && ! friends_check_friendship( bp_displayed_user_id(), bp_loggedin_user_id() ) ) {
    		global $bp;
    		bp_core_redirect( bp_displayed_user_domain() . 'resume' );
    		exit();
     }
     }
    add_action( 'bp_ready', 'redirect_to_profile' );

    please if someone just helping me to sorting this code .. i want just to set the default landing tab for non friends to profile instead of activity tab .. and keep activity tab a default landing tab for profiles owners


    MSoliman
    Participant

    @moefahmy

    I’m using these code to hide taps for non friends members , the problem is . i need to hide the activity tap for non friends .. but without changing the default landing tab for the profile owner .. i want to dynamically set the landing tab for non friends to “profile” .. and for the profile owner to “activity”

    //remove profile tabs for non friends members//
    		function bpfr_maybe_hide_friends_nav_etc() {
    			$retval = false;
    			// condition 
    			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 ok
    			if ( ! bpfr_maybe_hide_friends_nav_etc() ) {
    				return;
    			}
    			// otherwise we remove the nav items
    			// bp topnav items
    			
    			bp_core_remove_nav_item( 'groups' );
    			bp_core_remove_nav_item( 'activity' );
    			bp_core_remove_nav_item( 'events' );
    			bp_core_remove_nav_item( 'media' );
    			bp_core_remove_nav_item( 'profile' );
    			bp_core_remove_nav_item( 'friends' );
    			//bp subnav items
    			bp_core_remove_subnav_item( 'activity', 'friends' ); 
    			bp_core_remove_subnav_item( 'activity', 'mentions' ); 
    			
    		}
    		add_action( 'bp_ready', 'bpfr_hide_friends_nav_to_non_friends' );

    MSoliman
    Participant

    @moefahmy

    Hi max , the only solution i reached is controlling who can see the activities post form , showing and hiding it based on the current user role


    MSoliman
    Participant

    @moefahmy

    any help please?!!


    MSoliman
    Participant

    @moefahmy

    help please


    MSoliman
    Participant

    @moefahmy

    help please


    MSoliman
    Participant

    @moefahmy

    would someone help me ? .. i want member search each others by the user_login only , not the nicename or first or last name .. only the user login … any help will be highly appreciated


    MSoliman
    Participant

    @moefahmy

    i’m using the buddypress groups to add a user role to members in the same group .. i hook into the groups_member_after_saveto add the role , which means when the user become a member he get the role .. and groups_member_before_remove to remove the role ,when the user leave the group the role been removed. my code is working like charm now . what i need is , to add this role when the user become admin to the group , and remove the role when he be demoted to mod or member, or be banned or removed.. this is my current code , to add the role to joined members:

    function bpmp_add_member($bp_group_admin)
    {
      $bp_group = _bpmp_get_group($bp_group_admin->group_id);
      $user = new WP_User($bp_group_admin->user_id);
      $user->add_role(_bpmp_get_role($bp_group));
    }
    
    function bpmp_remove_member($bp_group_admin)
    {
      $bp_group = _bpmp_get_group($bp_group_admin->group_id);
      $user = new WP_User($bp_group_admin->user_id);
      $user->remove_role(_bpmp_get_role($bp_group));
    }
    
    add_action('groups_member_after_save', 'bpmp_add_member', 90, 1);
    add_action('groups_member_before_remove', 'bpmp_remove_member', 10, 1);

    i just need to know what’s the right hooks to use .. i found these hooks but don’t know how to use its functions parameters with the code above

    // define the groups_promote_member callback 
    function action_groups_promote_member( $group_id, $user_id, $status ) { 
        // make action magic happen here... 
    }; 
    
    // add the action 
    add_action( 'groups_promote_member', 'action_groups_promote_member', 10, 3 );
    // define the groups_demote_member callback 
    function action_groups_demote_member( $group_id, $user_id ) { 
        // make action magic happen here... 
    }; 
    
    // add the action 
    add_action( 'groups_demote_member', 'action_groups_demote_member', 10, 2 );

    any help will be highly appreciated

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