Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

Viewing 25 results - 176 through 200 (of 634 total)
  • Author
    Search Results
  • Masoud
    Participant

    @danbp
    first of all i have to thank you for your quick answer and great support.
    i am very satisfied with the support of this plugin. you guys are great.
    thank you very much.
    —-
    1 & 2 ) the function worked great, but the “private message” button in profile still remains!
    i mean if a user can not send message so there is no need to show them that button.
    is it possible to show that button only to admins too?

    3)
    oh no no. i didnt mean WP DASHBOARD.
    i dont want users to be able to change their email account on their own, after sign-up(bp sing up form), unless they contact admin of site, and request the change of email.
    the option of changing email account is in
    Setting Tab > General Tab
    there is a place for them to write their new email and …
    i want to hide and disable it for normal users and available only for admin.
    look at this picture please.
    the red area.

    danbp
    Participant

    @5high Yep! You’re right. The form is now build separately. To hide it conditionnaly, it’s much easier as previously.

    What you have to do from now on, is to add a condition on the template part call.

    The form template file is post-form.php (activity/post-form.php)

    On each activity template (swa, members, groups,…), there a call to this file. bp_get_template_part( 'activity/post-form' );

    To solve your problem, you have just to add the condition you want for this call.

    In your case, as you want to disallow the form only on swa and on member’s activity, you modify
    child-theme/buddypress/activity/index.php (site wide activity) and child-theme/buddypress/members/single/activity.php (profile activity)

    For example i hide the form to any user except site admin by using:

    if ( is_user_logged_in() && is_super_admin() )
    	bp_get_template_part( 'activity/post-form' );

    Hope to be clear ! 😉

    danbp
    Participant

    Give this a try: (add to bp-custom.php) 1) & 2):

    function bpfr_hide_tabs() {
    global $bp;
    
    	if ( bp_is_user() && !is_super_admin() ) {
    		bp_core_remove_nav_item( 'notifications' );
    		bp_core_remove_subnav_item( 'messages', 'compose' );
    	}
    	
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    3) With BP and xprofile component activated, a user doesn’t need access to WP dashboard. He can change his profile credentials from front-end.
    Easiest way would be to use this plugin.

    Retrieving them the possibility to change their email is anyway not a good idea. What happen when a user changed from yahoo to gmail, but can’t login because he lost his password ? Where will the new pwd be sent ?

    Perhaps you have also to remove this from the BP usermenu on toolbar ?
    Here’s how you can do it:

    function admin_bar_remove_this(){
    global $wp_admin_bar;
    	$wp_admin_bar->remove_node('my-account-messages-compose');
    }
    add_action('wp_before_admin_bar_render','admin_bar_remove_this');
    #253283
    semperaye
    Participant

    There is this code posted by someone on this thread 2.5 years ago:

    https://buddypress.org/support/topic/hide-certain-admins-as-being-online/

    /* disable Recording Site Activity for Admins */
    add_action(“bp_loaded”,”bpdev_init_sm_mode”);
    function bpdev_init_sm_mode(){
    if(is_super_admin())
    remove_action(“wp_head”,”bp_core_record_activity”);//id SM is on, remove the record activity hook
    }
    /* ——————————————– */

    But not sure if that is custom css, or if that is something that needs to be placed in the bp-custom.php file? Also, that code appears to only block admin activity, not profile, and members list….

    Is there a way to do all of this via some custom CSS? That would obviously be the easiest way to solve this since there are no currently working plugins.

    #252295
    shanebp
    Moderator

    You mean group admins?

    I don’t think group admins can leave a group.

    To remove the ability to delete groups for everyone except site admins, try:

    function janhart_remove_group_admin_tab() {
    	if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) {	
    		return;
    	}
    
    	// Add the admin subnav slug you want to hide in the following array
    	$hide_tabs = array(
    		'delete-group' => 1,
    	);
    
    	$parent_nav_slug = bp_get_current_group_slug() . '_manage';
    
    	// Remove the nav items
    	foreach ( array_keys( $hide_tabs ) as $tab ) {
    		bp_core_remove_subnav_item( $parent_nav_slug, $tab );
    	}
    
    	// You may want to be sure the user can't access
    	if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) {
    		bp_core_add_message( 'You are not allowed to delete this group.', 'error' );
    		bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) );
    	}
    }
    add_action( 'bp_actions', 'janhart_remove_group_admin_tab', 9 );

    The capabilities you want to adjust are not related to WP roles.

    #251886
    giilour
    Participant

    hi – I have a multi author website and want people to be able to view authors profiles. I also have subscribers – is there a way to deny access for people to view subscribers profiles even if they type in the full web address and username?

    I found this code for admins and am using it atm – is there a way to have it for subs as well.

    // deny access to admins profile. User is redirected to the homepage
    function bpfr_hide_admins_profile() {
    global $bp;
    if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
    wp_redirect( home_url() );
    exit;
    endif;
    }
    add_action( ‘wp’, ‘bpfr_hide_admins_profile’, 1 );

    #251280
    @mcuk
    Participant

    Yeah it’s possible 🙂 (assuming that the bit you are talking about is the one im thinking of haha).

    Two methods:

    1. CSS

    li#wp-admin-bar-site-name {
        display: none;
    }

    2. Add this to functions.php file

    function remove_site_name( $wp_admin_bar ) {
    	$wp_admin_bar->remove_node( 'site-name' );
    }
    add_action( 'admin_bar_menu', 'remove_site_name', 999 );

    Both will hide the word for both ALL users including admins (I prefer the second but its up to you).

    If you want to leave the word Pretitude there for admins only to access the dashboard then adding an if statement into the function (similar to the one in the remove_admin_bar() function) should work.

    Hope it works!

    #251278
    Georgio
    Participant

    Sorry, I didn’t explain it well: I want to keep the admin bar for non-admins (it is usefull for the notifications etc) but make disappear the word “Pretitude” (that gives access to dashboard).
    Well, after using your code, non-admins don’t have access to dashboard any more, but the word Pretitude stays visible and points to the home page. This word been now useless, I want to hide it for esthetical reasons, because it is near the logo and the whole thing is ungly. Is that possible?

    Thanks again for the code!

    #251238
    Georgio
    Participant

    With your code and the use of the plugin Better Admin Bar I have made a nice unobtrusive admin bar.
    Any idea how to hide/remove the dashboard link for NON-admins? Thanks.

    screenshot

    #251115
    shanebp
    Moderator

    Try:

    function bpfr_hide_admins_profile() {
    
    	if( bp_is_user() )
                if ( bp_displayed_user_id() == 1 && bp_loggedin_user_id() != 1 ) 
    		bp_core_redirect( home_url() );
    
    }
    add_action( 'wp', 'bpfr_hide_admins_profile', 1 );
    #250762
    @mcuk
    Participant

    This might help (change ID from 1 in the appropriate places to the ID of your administrator(s). ID’s found in your database ):

    https://buddypress.org/support/topic/hide-all-admins-from-all-buddypress-activities/

    #250727
    blogook
    Participant

    Hi,

    You can use the code from buddydev. You just have to change one single thing

    <?php
    //filter on pre_user_query
    add_action( 'pre_user_query', 'devb_exclude_loggedin_user', 201 );
    
    function devb_exclude_loggedin_user( $query ) {
        // code below we do not need
        //don't modify the query if the user is not logged in
        // if ( !is_user_logged_in() )
        //    return;
    
        //do not hide users inside the admin
        if ( is_admin() && !defined('DOING_AJAX') )
            return;
        $qv = $query->query_vars;
    
        global $wpdb;
        //hide little change at the end of the query.I changed it to user_id : 1
        // but userID can be anything. I chose 1 because that is my admin user_id
        $query->query_where .= $wpdb->prepare(" AND {$wpdb->users}.ID !=%d ", 1 );
    }
    ?>
    RONO2
    Participant

    Hide Admin Bar Toolbar is what I used. I’m still trying to link my buddypress with my bbpress not going over well. LoL Hope this helps.

    #249827
    jino01
    Participant

    So there are two things I need to do:
    1) Hide admin mentionname somehow
    2) Members to have name and last name instead of the mentionname, maybe this will help with point 1?

    #249233
    Kookidooki
    Participant

    Thank you!

    It works fine, but when a (non-administrator) user is logged in, they cannot log out anymore because the logout button is missing which you can find in the “Howdy… [name][avatar][settings][logout button]” box at the upper right side. Also missing is the name of the user with his avatar, messages / notifications, etc. So this box is missing.

    So what I need is a script that hides the admin bar on the front end when you’re logged out, but is visible when you’re logged in.

    Any idea?

    ThanX!

    #248850
    Slava Abakumov
    Moderator

    All fields that are in the first Base fields groups will appear on registration page.
    So you can just move those fields to another fields group, that you can create on this page /wp-admin/users.php?page=bp-profile-setup using this link http://cosydale.com/wp-admin/users.php?page=bp-profile-setup&mode=add_group.

    Another option

    Find the ID of a field that you want to hide in admin area (when you edit the field it’s in the URL like this /wp-admin/users.php?page=bp-profile-setup&group_id=1&field_id=2&mode=edit_field = field_id=2 is what you need), make sure that this field is NOT required, then open style.css of your theme and add there something like this:
    #profile-details-section.register-section .editfield.field_2 {display:none}
    For reference: http://take.ms/lONUD

    #248412

    In reply to: Private Pages Glitch?

    fscbmwcca
    Participant

    I know the plugin doesn’t address my issue but keeps BuddyPress for members only and hide it from non-logged in users. Privacy is very important to our members. I will upload the members that are truly members from a csv file from a list that is provided for me and give the Contributor Role. What I meant by subscriber is the “Subscriber” Role (vs Contributor, Author, Editor, Administrator).
    I’m sorry I haven’t expressed myself well and now off topic. I was just trying to provide a solution for making pages private.

    #247818
    buckyb
    Participant

    Thank you for replying, I tried to figure it out on my own, but I cant get it to work. I changed some of the lines, and included what you have, but it breaks the site. (still learning, please bear with me)

    function bpfr_hide_profile_field_group( $retval ) {
    $displayed_user_level = some_s2_function( bp_displayed_user_id() ); 
    if( is_super_admin() && $displayed_user_level == 'access_s2member_level1' )  {
    // exlude groups, separated by comma
    		$retval['exclude_groups'] = '6,5';          		
    	} 
    	return $retval;	
    }
    add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );
    #247706
    shanebp
    Moderator

    The above is wrong – unless you are using the bp-default theme – not recommended.

    ‘Hide’ the Create a Group link by turning it off in Groups Settings > Group Creation
    .../wp-admin/admin.php?page=bp-settings

    #247432

    In reply to: hide bp toolbar

    dwsowash
    Participant

    This in you function php hides it from everyone but admins

    //Removes BuddyBar from non-admins only
    function splen_remove_admin_bar() {
    	if( !is_super_admin() ) 
    		add_filter( 'show_admin_bar', '__return_false' );
    }
    add_action('wp', 'splen_remove_admin_bar');
    

    Is that what you mean?

    #246529
    danbp
    Participant

    Try

    function bpfr_hide_tabs() {
    global $bp;
    	 /**
    	 * class_exists() & bp_is_active are recommanded to avoid problems during updates 
    	 * or when Component is deactivated
    	 */
    
    	if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) :
    
    	if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) {
    		bp_core_remove_nav_item( 'groups' );
    		bp_core_remove_nav_item( 'forums' );
    		bp_core_remove_subnav_item( 'activity', 'groups' );
    	}
    	endif;
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );
    #246528
    danbp
    Participant

    @paragbhagwat,

    try this:

    function bpfr_hide_tabs() {
    global $bp;
    	 /**
    	 * class_exists() & bp_is_active are recommanded to avoid problems during updates 
    	 * or when Component is deactivated
    	 */
    
    	if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) :
    
    	if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) {
    		bp_core_remove_nav_item( 'groups' );
    		bp_core_remove_nav_item( 'forums' );
    		bp_core_remove_subnav_item( 'activity', 'groups' );
    	}
    	endif;
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );
    #246094
    splufford
    Participant

    Hi, struggling to get any of the the code in post #190874 to work. I have created a bp-custom.php file which I have uploaded to the root of the buddpress folder and my code looks like this:

    <?php
    // deny access to admins profile. User is redirected to the homepage
    function bpfr_hide_admins_profile() {
    	global $bp; 
    	if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
    		wp_redirect( home_url() );
    	exit;
    	endif;
    }
    add_action( 'wp', 'bpfr_hide_admins_profile', 1 );
    
    // Remove admin from the member directory
    function bpdev_exclude_users($qs=false,$object=false){
        
        $excluded_user='1'; // Id's to remove, separated by comma
    	
        if($object != 'members' && $object != 'friends')// hide admin to members & friends 
        return $qs;
    	
        $args=wp_parse_args($qs);
    
        if(!empty($args['user_id']))
        return $qs;	
    	
        if(!empty($args['exclude']))
    		$args['exclude'] = $args['exclude'].','.$excluded_user;
        else
    		$args['exclude'] = $excluded_user;
    	
        $qs = build_query($args);
    
        return $qs;
    	
    }
    add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
    
    // once admin is removed, we must recount the members !
    function bpfr_hide_get_total_filter($count){
        return $count-1;
    }
    add_filter('bp_get_total_member_count','bpfr_hide_get_total_filter');
    // hide admin's activities from all activity feeds
    function bpfr_hide_admin_activity( $a, $activities ) {	
    	
    	// ... but allow admin to see his activities!
    	if ( is_site_admin() )	
    		return $activities;	
    	
    	foreach ( $activities->activities as $key => $activity ) {	
    		// ID's to exclude, separated by commas. ID 1 is always the superadmin
    		if ( $activity->user_id == 1  ) {			
    			
    			unset( $activities->activities[$key] );			
    			
    			$activities->activity_count = $activities->activity_count-1;			
    			$activities->total_activity_count = $activities->total_activity_count-1;			
    					$activities->pag_num = $activities->pag_num -1;				
    		}		
    	}		
    	// Renumber the array keys to account for missing items 	
    	$activities_new = array_values( $activities->activities );		
    	$activities->activities = $activities_new;	
    	
    	return $activities;
    	
    }
    add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 );
    ?>

    Not sure what I am doing wrong. All help gratefully received! Thanks

    #246041
    mrjarbenne
    Participant

    You could try this: https://github.com/r-a-y/bp-hide-user

    I don’t use it to hide admin members, but to hide users who are members of a subsite on multisite who I don’t want seen in the main activity feed. If it doesn’t do exactly what you want, I’m sure it’s a great start.

    #246031
    pnet
    Participant

    I have been searching for the same, hide admins from GROUP members list.
    It seems all the forums point to https://buddypress.org/support/topic/hide-admin-from-members-and-activity/

    Which the second block of code does not work, for me anyway, breaks my site.

    So how do I hide the admins from GROUP members list, not all members list, I have those hidden.

Viewing 25 results - 176 through 200 (of 634 total)
Skip to toolbar