Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

Viewing 25 results - 251 through 275 (of 691 total)
  • Author
    Search Results
  • sincewelastspoke
    Participant

    How do I hide my ‘Members’ page from all except Admin?

    #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.

    #245646
    Venutius
    Moderator
    #245361
    Henry Wright
    Moderator

    In post #190874 on the topic you’ve linked to, snippet 2 has the line:

    $excluded_user='1'; // Id's to remove, separated by comma

    You can just add more user IDs like this and those IDs will be excluded from the loop:

    $excluded_user='1,34,56,201'; // Id's to remove, separated by comma

    #244817
    danbp
    Participant

    Hi,

    simply remove the delete group button from group admin. Give this a try, only site admin will see the button. Add snippet to bp-custom.php

    function kwahlquist_remove_group_admin_tab() {
    global $bp;
    	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
    	// other admin subnav items are: group-settings, group-avatar, group-invites, manage-members
    	$hide_tabs = array(    		
    		'delete-group' => 1
    	);
            // since BP 2.2
    	$slug = bp_get_current_group_slug() . '_manage'; 
    	
    	// Remove the nav item
    	foreach ( array_keys( $hide_tabs ) as $tab ) {
    		bp_core_remove_subnav_item( $slug, $tab );
    	}
    }
    add_action( 'bp_groups_setup_nav', 'kwahlquist_remove_group_admin_tab', 9 );
    #244254
    djsteveb
    Participant

    @nithin270 – any changes you make for search spiders is going to take weeks (at minimum) before they are reflected in the search results.

    I suggest doing some robots.txt additions (will list mine below) – however realize that long ago google made a decisions that even if your robots.txt says to disallow crawling something, if another page on the web links to your subpage that is blocked by robots.txt, it will still show the url in the search results – but have a description something like “this sites robots.txt prevents google from displaying description of this result”.

    There has been debate about that decision, but it is what it is.

    The only way to really prevent a page showing up in results is to hide it behind a password (like htpasswd) – however google does normally remove results if that page (or header info of images) includes “noindex” in the head of the page (there is a tricky way to add this to images – it was pointed out to me in the google webmaster forums)

    given that bp pages like members are kind of pseudo pages, using something like yoast (currently as far as I know) – will not give you an option to add noindex, nofollow to your member pages..

    you may be able to modify the code I got from wpmudev that checks “if is member page, then add meta description as…” –
    ( http://premium.wpmudev.org/forums/topic/bp-meta-tite-description-for-groups-and-members-pages#post-806736 )
    to… also check “if is members page” – then add “meta name=”robots” content “noindex, nofollow”..
    (something like that)

    that should remove your members pages next time google crawls your site and the crawlers send the info back to the main algo/index..

    I think there is a way to log into google webmaster tools if you have claimed /verified your site and click on urls to ask the big G to remove them as well. (I have not messed with that stuff in a while )

    I also suggest adding a robots.txt file similar to this:

    Disallow: */activity/p/*
    Disallow: /docs/
    Disallow: *send-invites*
    Disallow: */groups/*members*
    Disallow: */groups/*media*
    Disallow: *widget-title*
    Disallow: *members/*activity*
    Disallow: *members/*notifications*
    Disallow: *members/*friends*
    Disallow: *members/*groups*
    Disallow: *members/*docs*
    Disallow: *members/*media*
    Disallow: *acpage*
    Disallow: *messages*
    Disallow: *friends*
    Disallow: *settings*
    Disallow: /*/comment-page*
    Disallow: *register*
    Disallow: *login*
    Disallow: *profile*
    Disallow: *admin*
    Disallow: *includes*
    Disallow: *content*

    to prevent some other quirky indexing issues with bp.

    If your member profile stuff is sacred, then I would hunt the forums here for what others have been messing with that prevents profile info from being displayed if a user is not logged in… as there are plenty of indexing spiders that will not follow the robots.txt or robots index rules in <head> – in fact some specifically look for these things and purposely crawl and scrape stuff that is blocked –

    Disclaimer: I am not an expert, not a real coder. Research these things with other sources, your situation may vary.

    #244207
    danbp
    Participant

    hi,

    first snipppet removes the mention tab.
    Second remove the mention item from the top right usermenu below howdy.

    Condition is set to site admin. If you use custom capabilities, change that to your need.
    Code goes to bp-custom.php

    function bpfr_hide_mention_nav() {
    	//if ( bp_current_user_can( 'bp_moderate' ) )
    	if ( is_super_admin() ) {
    		return;
    	} 
    	bp_core_remove_subnav_item( 'activity', 'mentions' ); 
    }
    add_action( 'bp_ready', 'bpfr_hide_mention_nav' );
    
    function bpfr_admin_bar_remove_activity_mentions(){
    global $wp_admin_bar;
    	if ( is_super_admin() ) {
    		return;
    	}
    	$wp_admin_bar->remove_node('my-account-activity-mentions');
    }
    add_action('wp_before_admin_bar_render','bpfr_admin_bar_remove_activity_mentions');
    

    An alternate (IMO better) solution, is this premium plugin: http://www.philopress.com/products/buddynotes/

    danbp
    Participant

    BuddyPress use bbPress when you allow group forums.
    If the group is private, the attached forum is also hidden ton non members of that group. Same for public or private groups.

    You don’t have to change the group forum setting in the forum list.
    The right steps
    Create a group A
    A is set to private
    Allow a forum for A
    —— The wrong step ——–
    Going to dashboard forum admin, and set forum A to private. If you do this nobody will see it except site admin.

    Groups


    https://buddypress.org/support/topic/hide-buddypress-and-bbpress-items-from-guests/
    https://buddypress.org/support/topic/buddypress-private-group-is-not-visible-in-bbpress/

    atfpodcast
    Participant

    Deactivate and delete the admin bar plugin. Remove also any custom code you have added in the past concerning the toolbar. The idea is to revert back to a fully standard WP install.

    It was already deactivated. I wonder if it left anything altered? that other snip it i added to try does not exist.

    If this doesn’t work, you have to go to your db and check the wp_options table for the toolbar setting.
    Search for option_name hide-loggedout-adminbar where value must contain 1.

    im using godaddy so i guess that would be in myphpadmin?

    danbp
    Participant

    I can confirm that Raindrops theme is working correctly with BP and taht the admin bar is showing up to logged in users.

    Deactivate and delete the admin bar plugin. Remove also any custom code you have added in the past concerning the toolbar. The idea is to revert back to a fully standard WP install.

    If this doesn’t work, you have to go to your db and check the wp_options table for the toolbar setting.
    Search for option_name hide-loggedout-adminbar where value must contain 1.

    atfpodcast
    Participant

    Yes sir the bar is there when are not logged on. I added show_admin_bar( true ); in a function plugin and that did not work. I tried the 2014 theme with the same results. no tool bar. THe one i deactivated was the one from stranger studios hid admin bar to non admins and and I deactivated that.
    https://wordpress.org/plugins/hide-admin-bar-from-non-admins/

    djsteveb
    Participant

    @dangthrimble – no matter what you do to hide the admin username, the really good hack teams are running scans to get the admin names by running url checks like “yourdotcom /?author=2
    ?author=3

    and scraping the details wp is providing both on page, and in meta fields.
    Then adding those names to their pass cracking bot nets.
    (look in your raw access logs, you will see it)

    I’ve tried changing names on wp sites many times, the rssn hackers get getting the new names, you can tell if you check your fail log with “limit login attempts” plugin.

    I’ve played with some code to change in wp themes to hide details there, but my php is slightly below beginner and my understanding of what the theme code is doing is same.

    I tried a plugin from the wp-repo that is supposed to hide all that- but it’s not working.

    (you could htaccess geo block ukrain and chna from your site completely and probably prevent 90% of these issues anyway from what I have seen by checking logs)

    I found some htaccess someone posted that is supposed to suppress all requests for “/?auth [nc] or something like that – but since I do not understand what each part is doing, I have not deployed it.

    I think it needs to be htaccess add and include anything with “author” and a number to work well (reg ex for numbers?)

    Until I find a htaccess regex method I understand and trust, I have found that the best combo for prevention is:

    Geo IP Block
    (https://wordpress.org/plugins/ip-geo-block/ )
    (default settings are okay, I think it’s best to change the drop downs to block by country the plugins area, theme area, admin ajax, etc as well – options in settings
    Also some blogs may want to uncheck the “comment post” block by country
    )

    If this geoip block plugin author had a donate link I’d already sent him some bucks, it’s the most useful plugin I’ve found since… “good question”

    and succuri is an informative add on as well
    (shows that some bots have figured out how to bypass the limit login attempts max tries setting)

    The way WP is handling question marks in urls (string queries I think it’s called) and giving up 200 status codes and extra info (including author names) to bots is a big issue for me, this kind of relates to the unanswered support question I posted here:
    https://wordpress.org/support/topic/question-mark-url-return-200-not-404-string-query-noindex-or?replies=1

    shanebp
    Moderator

    Google: buddypress hide admin from members list

    shanebp
    Moderator

    I would like to be able to hide all the information about my site administrators

    What do you mean by ‘hide’?
    Make them invisible?

    If you’ve changed the name of the admin’s account so it doesn’t say ‘admin’, then why do you need to hide it?
    How would a scraper know that it’s the admin’s account?

    #241200
    Gnostic_Thought
    Participant

    I am not sure. I bought a plugin from codecanyon and am trying to alter it to work with buddypress. I think this is the code I will have to alter

    public function __construct() {
    		$this -> admin = WP_Atr_Admin :: get_instance();
    		# registration hooks:
    		add_action( 'login_enqueue_scripts', array( $this, 'initialize_registration' ) );
    		add_action( 'register_form', array( $this, 'add_checkboxes_to_registration' ) );
    		add_filter( 'registration_errors', array( $this, 'validate_registration' ), 10, 3 );
    
    		# mu
    		add_action( 'signup_header', array( $this, 'initialize_registration' ) );
    		add_filter( 'wpmu_validate_user_signup', array( $this, 'mu_validate_registration' ), 10, 3 );
    		add_action( 'signup_extra_fields', array( $this, 'mu_add_checkboxes_to_registration' ) );
    
    		# add button
    		add_filter( 'the_content', array( $this, 'add_button_to_pages' ) );
    		$this -> register_page_status();
    		if( is_multisite() ) {
    			add_filter( 'all_plugins', array( $this, 'hide_plugin_in_mu_sites' ) );
    		}
    	}
    

    I would figure I would prefix bp_ to some of the code here

    # registration hooks:
    add_action( ‘bp_login_enqueue_scripts’, array( $this, ‘initialize_registration’ ) );
    add_action( ‘bp_register_form’, array( $this, ‘add_checkboxes_to_registration’ ) );
    add_filter( ‘bp_registration_errors’, array( $this, ‘validate_registration’ ), 10, 3 );

    but it like there is more to it than that according to your link.

    #239335
    @mercime
    Participant
    #238788
    danbp
    Participant

    Additionaly you can use/be inspired by this:
    https://buddypress.org/support/topic/hide-admins-activities-from-all-activity-feeds-in-buddypress/#post-223433

    Successfully tested on BP 2.2.3.1 WP 4.2.2 Twenty Twelve

    #238363
    danbp
    Participant

    Try if ( !is_super_admin( $current_user_id))

    Or use the WP filter

    function hide_my_admin_bar() {
    	// by user role
        if ( current_user_can( 'manage_settings' ) ) {
            return true; // Show for admins
        } else {
            return false; // Hide for other users
        }
    }
    add_filter( 'show_admin_bar', 'hide_my_admin_bar' );
    #238357
    @mcuk
    Participant

    I’ve set up two users to test various things on site during development, one with Administrator and one with Subscriber roles. That’s what the wp dash is confirming under users.

    I also have another function to hide the wp admin bar at the top of the page which includes the is_super_admin(). When its active, the admin bar is removed for the subscriber but not the admin user as intended. So can only assume that there is a problem with my redirect function itself or perhaps its clashing with something else (though I have no other plugins atm).

    //Remove wordpress admin bar for all except admin 
    function bpmc_remove_admin_bar() {
    	if( !is_super_admin() ) 
    		add_filter( 'show_admin_bar', '__return_false' );
    }
    add_action('wp', 'bpmc_remove_admin_bar');
    danbp
    Participant

    hi @mcpeanut,

    this snippet useable from BP 2.0.1 and above, can be added to bp-custom.php
    it will hide the field ID 1 which is the default Name field to all, except site admin.

    it will also avoid the user to edit that field. So if you use this, i recommand you tell them on register page that once they entered a name it they could change it later. You can than ask them $$$$ to do it. 😀

    function bpfr_hide_profile_field_group( $retval ) {
    	if ( bp_is_active( 'xprofile' ) ) :	
    	
    	// hide profile group/field to all except admin	
    	if ( !is_super_admin() ) {		
    		//exlude fields, separated by comma
    		$retval['exclude_fields'] = '1';  
    		//exlude field groups, separated by comma
    		$retval['exclude_groups'] = '1'; 			
    	} 
    	return $retval;		
    	
    	endif;
    }
    add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );

    More here:

    Using bp_parse_args() to filter BuddyPress template loops

Viewing 25 results - 251 through 275 (of 691 total)
Skip to toolbar