Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • Iurie Malai
    Participant

    @flegmatiq

    @0bservator Thank you!


    Iurie Malai
    Participant

    @flegmatiq

    @SimpleOne, thank you, I will test that!


    Iurie Malai
    Participant

    @flegmatiq

    @simpleone,

    Can you show how you solved your problem? danbp‘s code did not work for me. As you, I also wanted to hide some xprofile fields and tabs that I don’t want users to be able to edit.


    Iurie Malai
    Participant

    @flegmatiq

    @danbp, I know how to check for errors, but this didn’t helped me too much :). I solved with the blank page, but no more. Your solution works for hiding some xProfile tabs from viewing, but not from editing them. Am I wrong? Sorry!

    This is my tested function (as I said, it hiding only from viewing, not from editing):

    
    function flegmatiq_profiles( $retval ) {
    
       if ( is_user_logged_in() && !bp_is_profile_edit() ) {
          $myfield = xprofile_get_field_data( 'User Type' );
          if( $myfield == "Faculty" ) {
             $retval['exclude_groups'] = '2';
    	 //$retval['exclude_fields'] = '6,18,39';
          }
       }
    
       return $retval;
    
    }
    
    add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );
    

    The next code works as I need, but I think it is not so elegant, and it not allow to use the group ID, only his order number, as ordered by admin:

    
    function hide_profile_group_tabs_from_editing( $group_names ){
    
       if ( is_user_logged_in() && bp_is_profile_edit() && xprofile_get_field_data( "User Type") != "Faculty" ) {
          for ($x=0; $x<=sizeof($group_names); $x++) {
             if ( $x != 3 ) echo $group_names[$x]; //3 is the order number (from 0) of the tab that I need to hide in the profile edit page. This is not the group ID.
          }
       } else {
          return $group_names;
       }
    
    }
    
    add_filter('xprofile_filter_profile_group_tabs', 'hide_profile_group_tabs_from_editing');
    

    Iurie Malai
    Participant

    @flegmatiq

    @danbp, I applied the patch but the function does not works. If I put your function in the bp-custom.php I have a clean white page (display) as a result.


    Iurie Malai
    Participant

    @flegmatiq

    @danbp, thank you! I tested your solution (the last function), but no success. Is enough to put this in the bp-custom.php file?

    I tried the next simple function to hide the extended fields group number 2 from editing for all members, but it not working.

    
    function flegmatiq_profiles( $retval ) {	
    	
    	if(  bp_is_profile_edit() ) {		
    		$retval['exclude_groups'] = '2';
    	}	
    	
    	return $retval;
    	
    }
    add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );
Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar