Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

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

    Hi there

    Is there any way of preventing users (other than admin) from deleting their own activity eg. I don’t want them to be able to delete entries such as “User x updated their profile”.

    I’ve successfully prevented commenting on certain activities using bp_activity_can_comment and I’m thinking maybe I can use bp_activity_user_can_delete in a similar way, but can’t seem to make that work.

    Any suggestions would be gratefully received.

    With many thanks in advance.

    PS. I know I can hide “Delete” with CSS but would really prefer to use a filter instead.

    #272711
    Venutius
    Moderator

    Update – the following works:

    function venutius_hide_tab() {
    	if ( !is_super_admin() ) {
    		bp_core_remove_subnav_item( 'settings', 'general' ); 
    	}
    }
    add_action( 'bp_setup_nav', 'venutius_hide_tab', 15 );

    However it causes a page not found error when you click on Settings, this is due to the removed nav item being the default tab for the settings link. I’m currently trying to find the right code to reset this default.

    #272695
    Venutius
    Moderator

    So you could add something like the following to your functions or bp-custom.php:

    function venutius_hide_tab() {
    	if ( !is_super_admin() && !bp_is_my_profile() ) {
    		bp_core_remove_subnav_item( 'settings', 'general' ); 
    	}
    }
    add_action( 'bp_setup_nav', 'venutius_hide_tab', 15 );
    hiverizecaro
    Participant

    Hi,
    I would like to change the ‘show_tab’ arguments based on a setting made upon group creation.
    Something like:

    $is_wanted = groups_get_groupmeta( $group_id, ‘show-to’ );

    <?php if ($is_wanted): ?>
    ‘show_tab’=> ‘member’
    <?php else: ?>
    ‘show_tab’=> ‘admin’
    <?php endif; ?>

    How can this parameter be accessed?
    It would also be ok to hide the tab in the group compleatly, like

    $parent_nav_slug = bp_get_current_group_slug();
    $tab = ‘gruppen-stockkarte’;
    bp_core_remove_subnav_item( $parent_nav_slug, $tab, ‘groups’ );

    BUT based on the group_id and groups_get_groupmeta, not for all groups.

    Thanks for your help!

    ( sorry for doubbling the topic, I couldnt figure out how to edit)

    #272624
    panosa1973
    Participant

    @venutius you were right on the money! This worked. Now a member can see their Friends menu item even when they’re on another member’s profile but without having access to the other member’s friends. And you said it was gonna be difficult. Hah! 🙂
    Thank you yet again!

    function hide_friends_tab() {
    	global $bp;
    	if ( !bp_is_my_profile() && !is_super_admin() ) {
    		bp_core_remove_nav_item( 'friends' ); 
    
    		bp_core_new_nav_item( 
        	        array( 
                    'name' => __('Friends', 'buddypress'), 
                    'slug' =>  $bp->friends->slug, 
                    'position' => 50, 
                    'show_for_displayed_user' => false,
                    'default_subnav_slug' => 'friends'
        ));
    	
    	}
    }
    add_action( 'bp_setup_nav', 'hide_friends_tab', 15 );
    Venutius
    Moderator

    What plugin did you use to add the option to only display a menu item to logged in users? Seems like that is what is not functioning. hiding the activity link by hiding the menu item does not hide the activity page from non logged in users, if they know the url they will still be able to view it, to prevent that you should explore the security options available to you. There a number of privacy plugins for bp with a range of features, is it only the Activity page you want to hide?

    BuddyPress uses the default WordPress login page, there’s a number of customisers for this, for example: https://wordpress.org/plugins/admin-custom-login/

    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');
    #272402
    panosa1973
    Participant

    WordPress 4.9.5 -> BuddyPress 2.9.4

    Hi all,
    This is when viewing a user’s profile page. I removed the Friends tab with the below code but the View tab is still showing (it’s not necessary since the Profile tab is there and points to the same place, the user’s profile page). Is there a list somewhere of the slugs for the tabs or is there a function that can generate that? Or am I completely off about this 🙂
    Thanks in advance.

    function remove_nav_items() {
    if ( !bp_is_my_profile() && !is_super_admin()) {
    bp_core_remove_nav_item( 'friends' );
    bp_core_remove_nav_item( 'view' );
    }
    }
    add_action( 'bp_setup_nav', 'remove_nav_items',301);

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

    #270576
    otty-dev
    Participant

    I tried to implement the following code:

    function buddydev_hide_members_directory_from_all_except_admin() {
    
    	if ( bp_is_members_directory() && ! is_super_admin() ) {
    		//should we add a message too?
    		//bp_core_add_message( 'Private page.', 'error' );
    		bp_core_redirect( site_url('/') );
    	}
    }
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );

    in plugins> bp-custom.php. Just in case, I also tried to implement it by creating a new plugin folder > bp-custom.php in the child theme, but the member directory page is still visible to non-admin/non-logged in users.

    #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' );
    #270002
    ingohaeck
    Participant

    For privacy issues I want to hide certain links on profile view.
    i use the snippet, mentioned here (see script below):
    one

    This works fine with BP related links, but I cannot hide links from CPT like rtMedia and the link of this:

    `function bp_postsonprofile() {
    add_action( ‘bp_template_content’, ‘profile_screen_posts_show’ );
    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
    }

    function profile_screen_posts_show() {

    $myposts = get_posts( array(
    ‘posts_per_page’ => -1,
    ‘author’ => bp_displayed_user_id(),
    ‘post_type’ => ‘post’
    ));

    if( ! empty($myposts) ) {

    echo ‘<ul>’;

    foreach($myposts as $post) {
    setup_postdata( $post );
    echo ‘<li><a href=”‘ . get_permalink($post->ID) . ‘”>’ . get_the_title($post->ID) . ‘</a></i>’;
    }

    echo ‘</ul>’;

    wp_reset_postdata();

    } else {

    echo ‘<div class=”info” id=”message”><p>’. bp_displayed_user_fullname() .’ hat keine Beiträge veröffentlicht.</p></div>’;
    }
    }

    add_action ( ‘profile_screen_posts_show’ );`

    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’ ) ) :

    /** here we fix the conditions.
    * Are we on a profile page ? | is user site admin ? | is user logged in ?
    */
    if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) {

    /* and here we remove our stuff ! */
    bp_core_remove_nav_item( ‘activity’ );
    bp_core_remove_nav_item( ‘friends’ );
    bp_core_remove_nav_item( ‘groups’ );
    bp_core_remove_nav_item( ‘posts’ );
    bp_core_remove_nav_item( ‘forums’ );
    bp_core_remove_nav_item( ‘media’ );
    }
    endif;
    }
    add_action( ‘bp_setup_nav’, ‘bpfr_hide_tabs’, 15 );

    #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; // 
    }
Viewing 25 results - 101 through 125 (of 908 total)
Skip to toolbar