Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

Viewing 25 results - 101 through 125 (of 670 total)
  • Author
    Search Results
  • panosa1973
    Participant

    WordPress 4.9.5 -> BuddyPress 2.9.4 -> Agama Blue Child Theme

    I ended up with the below code from posts in these forums but it doesn’t do quite what I need it to do.
    Users should not be able to see other users’ friends so the Friends tab when viewing another user’s profile page must be removed along with the functionality. Here’s my code:

    function bpfr_hide_tabs() {
    	if ( !is_super_admin() && !bp_is_my_profile() ) {
    		bp_core_remove_subnav_item( 'profile', 'friends' );  // This does nothing
    		//bp_core_remove_nav_item( 'friends' );  //Or this but this also hides the Friends main menu item, not just the Friends tab in the user's profile page 
    	}
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    I’ve switched between both options in the code. bp_core_remove_subnav_item( 'profile', 'friends' ); doesn’t really do anything and bp_core_remove_nav_item( 'friends' ); does remove the Friends tab from another user’s profile but it also removes it from the main menu which is a different thing. The main menu Friends link points to my own Friends whereas the Friends tab in another user’s profile points to their friends. Any help would be appreciated.

    #272469
    panosa1973
    Participant

    I managed to hide the View tab with CSS:

    function remove_some_tabs() {
        if ( !is_super_admin()) {
    		//This hides the View tab
    		echo '<style>li#public-personal-li {Display: none;} </style>';
    		//This hides the additional members input box when sending a msg
    		echo '<style>#send-to-input {Display: none;} </style>';        
    	}
    }
    add_action( 'wp_head', 'remove_some_tabs');
    #272344

    In reply to: Hiding the admin user

    shanebp
    Moderator

    You could use the overload method.
    imo, using hooks is easier.

    For example, to hide admin users from the members loop, you could put this into bp-custom.php… untested…

    function grw_members_loop_ghosts( $retval ) {
    
        if ( bp_is_members_directory() ) {
    
            $admins = get_users( array(
    				'fields' => 'ID',
    				'role'   => 'administrator',
    			      ));
            
            $admins = implode(',', $admins );
    
            $retval['exclude'] = $admins;
        }
    
        return $retval;
    }
    add_filter( 'bp_before_has_members_parse_args', 'grw_members_loop_ghosts' );
    #272335
    GRWebs
    Participant

    Hi How do you hide the admin user from Buddypress? Thanks!

    #271778
    andyjay83
    Participant

    Wordpress 4.9.5, BuddyPress 2.9.4, BuddyBoss Theme, http://www.torus.drumsbygenre.com

    I am trying to hide all admin accounts from all BuddyPress touch points using this code found on the BuddyDev website:

    add_filter( ‘bp_after_has_members_parse_args’, ‘buddydev_exclude_users_by_role’ );

    function buddydev_exclude_users_by_role( $args ) {
    //do not exclude in admin
    if( is_admin() && ! defined( ‘DOING_AJAX’ ) ) {
    return $args;
    }

    $excluded = isset( $args[‘exclude’] )? $args[‘exclude’] : array();

    if( !is_array( $excluded ) ) {
    $excluded = explode(‘,’, $excluded );
    }

    $role = ‘administrator’;//change to the role to be excluded
    $user_ids = get_users( array( ‘role’ => $role ,’fields’=>’ID’) );

    $excluded = array_merge( $excluded, $user_ids );

    $args[‘exclude’] = $excluded;

    return $args;
    }

    This code seemed to have worked for a lot of people but isn’t currently working for me. I tried putting it into my child theme’s functions.php and also tried making a bp-custom.php file in my wp-content/plugins directory and that didn’t work either. I even refreshed cache and cookies after each of these attempts. Still nothing.

    I’m not advanced when it comes to this stuff. I know that I must be doing something wrong. Any help or guidance would be greatly appreciated.

    #271107
    kwavewd
    Participant

    this code works perfectly to block the admin

    // 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 );

    can’t we just change

    if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
    wp_redirect( home_url() );

    and make it subscribers in stead of id and loggedin d?

    stevie79
    Participant

    I saw a thread here:
    https://buddypress.org/support/topic/how-can-i-disable-the-last-active-time/

    However, I’d like it to hide for everybody apart from me, the Admin.

    Doable?

    #270566
    keshabee
    Participant

    Good day,
    Am not sure if this is the right place to put this but please do pardon me .
    I wanted to ask any one or the buddy-press support team on how where they able to implement the this certain functions to the site.
    https://postimg.org/image/urrv2bmbp/

    1) Have a create new topic button on the admin menu tab
    2 ) is there a way to hide the Mysites – from other users except admin ( as I do make use of a multisite)
    – if its not possible is there a way to customize it from My site to something like “Site Tool” and a way to change the W – logo to something else.
    In all Thank you very much, as I do appreciate your help and assist

    keshabee
    Participant

    Good Afternoon, I wanted to ask if there was any-one who has an ides how to hide site > my site which is created by buddypress on the admin dashboard area. as below
    https://postimg.org/image/dop3730kl/

    As i was able to find a way to hide the site from the user profile thanks to @vapvarun
    using the function

    function vap_remove_buddypress_sites_tabs() {
    	global $bp;
           // to remove main menu for sites.
           bp_core_remove_nav_item('blogs' );
    }
    add_action( 'bp_setup_nav', 'vap_remove_buddypress_sites_tabs', 999 );
    

    But the question is how do i hide it also in the admin dashboard.
    As preferable I would likely wish if i could hide it specifically from other users except admin and site owner.
    Thank you in advance

    #270027
    leog371
    Participant

    Just to be sure of what your asking, Are you trying to hide these from everyone including the person who owns the profile?

    Just in case you dont want to hide them from the profile owner, you should know that any links that are edit, upload rtmedia links only display for the profile owner and no one else and most other things like this are hidden by default from users and friends anyways. Only a profile owner can upload and make changes to his profile or post activity on their profiles.

    Also, each member has privacy options in their profile settings. You can set defaults in the dashboard for this as well.

    If this is not the case, could you clarify what you hope to achieve?

    If you simply wish to remove links for everyone in your site including the profile owner, just use something like this in bp-custom.php file

    /* Example to Remove subnav tabs from Group Settings  https://codex.buddypress.org/developer/navigation-api/#examples*/ 	
    	function remove_group_manager_subnav_tabs() {   
        // site admin will see all tabs
        if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) {
            return;
        }
           // all subnav items are listed here.
           // comment those you want to show
            $hide_tabs = array(             
            //  'group-settings'    => 1,
            //    'delete-group'      => 1,
             //   'group-avatar'      => 1,
            //  'group-invites'     => 1,
             //   'manage-members'    => 1,
            //  'forum'             => 1,
            //  'group-cover-image' => 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, 'groups' );
        }   
    }
    add_action( 'bp_actions', 'remove_group_manager_subnav_tabs' );
    #269956
    leog371
    Participant
    /* Example to Change item names of user’s and group’s nav menus ...
    Profile Menu https://codex.buddypress.org/developer/navigation-api/#examples
    */ 
    function bpcodex_rename_profile_tabs() {
      
          buddypress()->members->nav->edit_nav( array( 'name' => __( 'My Forums', 'textdomain' ) ), 'forums' );
          buddypress()->members->nav->edit_nav( array( 'name' => __( 'MY Groups', 'textdomain' ) ), 'groups' );
      
    }
    add_action( 'bp_actions', 'bpcodex_rename_profile_tabs' );
    /* Example to Rename Group Menus https://codex.buddypress.org/developer/navigation-api/#examples*/ 	
    function bpcodex_rename_group_tabs() {
     
        if ( ! bp_is_group() ) {
            return;
        }
        
        buddypress()->groups->nav->edit_nav( array( 'name' => __( 'Group Discussion', 'buddypress' ) ), 'forum', bp_current_item() );
    	buddypress()->groups->nav->edit_nav( array( 'name' => __( 'Group Members', 'buddypress' ) ), 'members', bp_current_item() );
    	buddypress()->groups->nav->edit_nav( array( 'name' => __( 'Group Activity', 'buddypress' ) ), 'home', bp_current_item() );
    }
    add_action( 'bp_actions', 'bpcodex_rename_group_tabs' );	
    	
    /* Example to Remove subnav tabs from Group Settings  https://codex.buddypress.org/developer/navigation-api/#examples*/ 	
    	function bpcodex_remove_group_manager_subnav_tabs() {   
        // site admin will see all tabs
        if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) {
            return;
        }
           // all subnav items are listed here.
           // comment those you want to show
            $hide_tabs = array(             
            //  'group-settings'    => 1,
            //    'delete-group'      => 1,
             //   'group-avatar'      => 1,
            //  'group-invites'     => 1,
             //   'manage-members'    => 1,
            //  'forum'             => 1,
            //  'group-cover-image' => 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, 'groups' );
        }   
    }
    add_action( 'bp_actions', 'bpcodex_remove_group_manager_subnav_tabs' );
    
    #269848
    HDcms
    Participant

    Hello,
    How to hide the button “Members” in the display of a group?
    https://screenshots.firefox.com/4fhh6NF0U12mYFQu/null

    The following code does not work:

    function bpex_hide_members_menu_tabs() {
    	if ( bp_is_group() ) {
    	if ( is_super_admin() ) 
     	return ;
    		bp_core_remove_nav_item('members');
    	}
    }

    Regards

    #269446
    darren1985
    Participant

    Hi,

    I have a site and on the sidebar i have buddypress login widget, if the user enters nothing and clicks login their directed to a custom version of wp-login and asked to log in.

    before when the user then logged in from here it would redirect them to the main page of the buddypress site.

    but i then wanted to hide the fact that it is a wpsite by using a plugin to edit wp-admin.php to login.php.

    upon installing this plugin, when you login from what was wp login form it then directs you the the wp-admin page.

    i didnt want this so i deleted the plugin, but it didnt revert back as such, the link now says wp-login but they users dont redirected to the site, they redirect to wp-admin.

    how can i redirect users when using this form to go direct to the site and not wp-admin.

    thanks

    #269331
    HDcms
    Participant

    Hello Gorges
    And thank you 🙂

    In fact, I want to hide these tabs to everyone except for a wordpress role and the super admin
    It works (a priori) but do not hesitate to suggest an improvement.
    I am not sure of my code!

    Regards

    add_action('wp_head', 'HD_maj_activite');
    function HD_maj_activite() {
    	$bp_loggedin_user_id = bp_loggedin_user_id();
    	$user_info = get_userdata($bp_loggedin_user_id);
    	$user_roles = $user_info->roles;
    	if (is_super_admin() || in_array('membre2', $user_roles)) 
     	return ;
    	$output .= '<style type="text/css">body.activity.directory #activity-friends {display: none;}</style>';
    	$output .= '<style type="text/css">body.activity.directory #activity-groups {display: none;}</style>';
       echo $output; // 
    }
    Kookidooki
    Participant

    Hello Boone,

    Thank you for your input.

    I’ve checked permission status of uploads: 755.

    Cleared all caches, Cloudflare, and pauzed SSL but still no luck with the posting of updates or uploading of images in posts, activity stream or in Media Library (shows a blank page, no thumbnails, etc.).

    But on top of this I’ve found other (probably related) problems:

    1. Even our administrators couldn’t create new user accounts or update existing accounts. All we see is an avatar, no name, email, no edit,etc. See image below:

    users

    2. Database error:
    WordPress database error: [Duplicate entry ‘0’ for key ‘PRIMARY’] 
INSERT INTO kuyrsd79sdn_bp_activity ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( 82, ‘activity’, ‘activity_update’,

    MySQL said:
    #1062 – Duplicate entry ‘0’ for key ‘PRIMARY’

    3 SQL query:


    — Indexes for table kuyrsd79sdn_options

    ALTER TABLE kuyrsd79sdn_options
    ADD PRIMARY KEY (option_id),
    ADD UNIQUE KEY option_name (option_name),
    ADD KEY wpe_autoload_options_index (autoload)

    Any idea how to fix this?

    naomibuch
    Participant

    Hi Again,

    This is a list of all my plugins:

    WP Mail SMTP
    WP Crontrol
    WP All Import Pro
    WordPress Mass Email to users
    WordPress Importer
    W3 Total Cache
    tagDiv Social Counter
    tagDiv Composer
    SiteOrigin Widgets Bundle
    Shortcodes Ultimate
    rtMedia for WordPress, BuddyPress and bbPress
    RSS Importer
    Remove Dashboard Access
    PushLive – Staging Site to Live Site in One Click
    Page Builder by SiteOrigin
    Newsletter
    Knowledge Base for Documents and FAQs
    Invite Anyone, by Boones 🙂
    iframe
    Hide This
    Hide Admin Bar
    Easy Affiliate Links
    Contact Form 7
    Buddypress Shortcodes
    Buddypress Friend of a Friend (FOAF)
    BuddyPress Follow
    BuddyPress Extended Friendship Request
    BuddyPress Edit Activity
    BuddyPress Block Activity Stream Types
    BuddyPress Activity ShortCode
    BuddyPress Activity Privacy
    BuddyPress Activity Filter
    BuddyPress Activity Autoloader
    BuddyPress
    BP Show Friends
    Amazon Auto Links
    All In One SEO Pack Pro
    Akismet Anti-Spam
    Advanced Profiles Plugin 2.0 for BuddyPress
    Activity Reactions For Buddypress

    #269152
    DragoWeb
    Participant

    Hi, I have this error message

    “There was a problem cropping your profile photo.”

    when I try to upload an avatar image with a width of 450px and above. Starting to 451px it works (even with an height of 150px). I get a warning message only if I try to upload an image under 150x150px :

    “You have selected an image that is smaller than recommended. For best results, upload a picture larger than 150 x 150 pixels.”

    So, I suppose this problem doesn’t come from a setting option somewhere.

    The problem is the same when I switch to the default theme Twenty Fifteen and I have no other plugin activated (except HideMySite). Cover image works without problem. Cropping image works with Ultimate-member plugin and in WP admin -> Media -> Edit/crop as well.

    Config:
    Wordpress (new install) v4.9
    Buddypress 2.9.2
    php 5.6
    GD enabled

    Thanks.

    tackleb0x
    Participant

    Hello,

    I would like to modify the default Member’s page to remove the “bp_member_latest_update”. Currently the page shows the list of members, not including the “Admins”. I achieved this by adding the following function to the functions.php page:

    add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users_by_role' );
     
    function buddydev_exclude_users_by_role( $args ) {
        //do not exclude in admin
        if( is_admin() && ! defined( 'DOING_AJAX' ) ) {
            return $args;
        }
    
        $excluded = isset( $args['exclude'] )? $args['exclude'] : array();
    
        if( !is_array( $excluded ) ) {
            $excluded = explode(',', $excluded );
        }
    
        $role = 'administrator';//change to the role to be excluded
        $user_ids =  get_users( array( 'role' => $role ,'fields'=>'ID') );
    
        $excluded = array_merge( $excluded, $user_ids );
    
        $args['exclude'] = $excluded;
    
        return $args;
    }

    The page shows the default behavior: Avatar, Name, Latest Activity (with a link that reads “view”), and the last active time.

    I would like to remove/hide the latest activity (including the word “view”) from the list altogether. Any ideas on how I could achieve this? Perhaps with a snippet to add to the functions.php file?

    I have the following installed:
    BuddyPress – 2.9.1
    WordPress – 4.8.2
    Theme – Buddy (child)

    I appreciate any help in advance!

    Max
    Participant

    Hi moefahmy,

    That’s actually a clever solution to address this issue. The difference with me is that my customer needs a few specific groups to be restricted to only let himself post in it. But since only administrators like my customer needs to post I can target only the administrator role to view the post-an-update form, and hide them for every other user role. I can code something to make this only happen on the groups I want it to.

    Thanks for activating the bulb inside my brain haha, I really appreciate this solution. Well done!!

    #268412
    ariktwena
    Participant

    Hi

    I really need some help here. I have different user-roles on my website, but I want to exclude a specific user-role from showing up on the overall activity page/feed.

    I forund this code where the admin is excluded:

    
    // 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 == 784  ) {			
    
    			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 );
    

    So i’m hoping someone can help me adjust it. I need for the users that have the user-role ‘Banditter’ && ‘Participant’ not to show up on the overall activity feed, but for them to see their own activity. Plus for the Admin to see all activity

    I don’t know so much PHP, so i’m hoping for some help 🙂

    Thanks

    #268397
    Kristian Yngve
    Participant

    Oh sorry, I had copied it as is by the other moderator from a very old post. Thank you for cleaning that up for me, this should be the only one as a How to & Troubleshooting category.

    So, I did the changes and it didn’t work. I also tried changing the last part: hide_admins_profile’, 1 ); to hide_admins_user’, 1 ); but didn’t work sadly… resorted back to profile for that part.

    Any other suggestions that may work? I had also cleared the cache after any changes.

    #268389
    Kristian Yngve
    Participant

    Just over 3 years ago, the moderator, Danbp, had the once working code that went straight into your bp-custom.php file:

    // 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 );

    **However, this no longer works with all those updates to the plugin.

    Anyone have an idea on what would be the up to date code that would work to actually deny all non-admin users access to admins profile?

    #268054
    xmginc
    Participant

    Hey guys,

    Would anyone know how to hide and disable member pages based on their role type. (e.g. yoursite.com/members/username)

    Goal: if a member is set to a WordPress Administrator role, we would like to make his/her page inaccessible from the public

    Purpose: while we have been able to hide specific roles from displaying in the member directory, their member/page is still visible if you know the URL.

    Similar to how we can make the WordPress Author page inaccessible, we’d like to do the same for BuddyPress’s equivalent Member page.

    Thanks in advance

Viewing 25 results - 101 through 125 (of 670 total)
Skip to toolbar