Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

Viewing 25 results - 301 through 325 (of 628 total)
  • Author
    Search Results
  • #170721

    In reply to: hide members

    @mercime
    Participant

    @famous You can limit who views the members directory page to the Site/Super Admin only by surrounding the members directory section using is_super_admin https://codex.wordpress.org/Function_Reference/is_super_admin then either echo message that the section is restricted or just redirect non-Admin users to another page if visitors try to use the members slug in your site.

    #169691
    marmuel
    Participant

    Hi there,

    I´ve added the code in the functions.php of my child-theme.
    In the “Who´s online”-widget, I still see the super admins. Any ideas to hide them in the widget?
    Thank you!
    Cheers
    Marco

    #169550
    bp-help
    Participant

    @merosler
    If your adding php code I hope you have made a child theme as @philipstancil did because that is the proper way. I would never add custom code to a parent theme’s functions.php because if you update the theme then it may get overwritten. Anyway, make sure whenever you add code to functions.php it always needs to be between opening and closing php tags like this:

    
    <?php
    // Remove admin from directory
    
    add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
    function bpdev_exclude_users($qs=false,$object=false){
     //list of users to exclude
     
     $excluded_user='1';//comma separated ids of users whom you want to exclude
     
     if($object!='members')//hide for members only
     return $qs;
     
     $args=wp_parse_args($qs);
     
     //check if we are listing friends?, do not exclude in this case
     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;
     
    }
    
    //Remove admin from member count
    
    add_filter('bp_get_total_member_count','bpdev_members_correct_count');
    function bpdev_members_correct_count($count){
    $excluded_users_count=1; //change it to the number of users you want to exclude
    return $count-$excluded_users_count;
    }
    ?>
    
    Ishanna
    Participant

    @aces

    Yes! Thank you, it works. 😀

    aces
    Participant

    @ishanna

    Could your problem be a copy/paste error?

    You appear to be using and – they should all be '

    Ishanna
    Participant

    Hallo @sbrajesh !

    I tried use code:

    
    add_action(‘bp_friends_setup_nav’,'bpdev_custom_hide_friends_if_not_self’);
    
    function bpdev_custom_hide_friends_if_not_self(){
    if(bp_is_my_profile()|| is_super_admin())
    return ;
    
    bp_core_remove_nav_item(‘friends’);
    
    }
    
    

    I copied and pasted the code into the ‘bp_custom.php’ file but it did not work for me.
    I’m new to wordpress, html, php and css but I seem to find my way til now. Some advise please? I really need this option to work and I can’t find a plugin that cover this.

    Kind regards,

    #169307
    aces
    Participant
    #169148
    philipstancil
    Participant

    Crazy that we both found this old thread within 12 hours of each other. I got it working with this code:

    // Remove admin from directory
    
    add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
    function bpdev_exclude_users($qs=false,$object=false){
     //list of users to exclude
     
     $excluded_user='1';//comma separated ids of users whom you want to exclude
     
     if($object!='members')//hide for members only
     return $qs;
     
     $args=wp_parse_args($qs);
     
     //check if we are listing friends?, do not exclude in this case
     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;
     
    }
    
    //Remove admin from member count
    
    add_filter('bp_get_total_member_count','bpdev_members_correct_count');
    function bpdev_members_correct_count($count){
    $excluded_users_count=1; //change it to the number of users you want to exclude
    return $count-$excluded_users_count;
    }
    
    #168790

    In reply to: remove admin-bar

    Developer ICAN
    Participant

    In the latest BuddyPress – 1.9 – i want to hide the admin bar but keep it for WP site users (editors, admins) that aren’t BP users? Is that possible?

    #168629
    David Cavins
    Keymaster

    As a hack I can hide them using css by adding this to my functions.php file:

    function hide_group_admin_tabs($classes) {
      $user_id =  bp_loggedin_user_id();
      $group_id =  bp_get_current_group_id();
      if ( bp_is_groups_component() ) {
        if ( groups_is_user_admin($user_id, $group_id) ) {
          $classes[] = 'group-member-admin-cap';
        } else if ( groups_is_user_mod($user_id, $group_id) ) {
          $classes[] = 'group-member-mod-cap';
        }
      }
      return $classes;
    }
    add_filter( 'body_class', 'hide_group_admin_tabs', 98 );

    And then adding display:none; rules to the tabs. But I would like to handle the navigation the right way (and not with a css hack). Any ideas?

    Thanks for your help,

    -David

    #167792
    nobodymove
    Participant

    @bphelp. I think I have discovered the culprit to this little mystery.. I have been using the Buddypress Members Import plugin: http://www.youngtechleads.com/buddypress-members-import/

    For some reason when I import my database, the plugin does not seem to process the xProfile Field visibility settings properly.. The profile fields are still listed as “Admins Only” But for some reason they are still visible to all users.

    Earlier, I manually added some new test profile fields and they worked fine. I also discovered, that if I edit, and re-save a user’s profile field after import, all profile fields for that user will then revert to the proper visibility settings.

    I have contacted the plugin author to make him aware of the issue, hopefully he can fix it. If you have any suggestions that might be a quick fix for this I’m all ears! 🙂

    #167767
    nobodymove
    Participant

    @bphelp. Upon a little further research, I wanted to note that I created a new User Profile Group, created a private field seen by Admins Only in that group, and the settings seem to be working fine in that group. In my Base (Primary) group though, all profile fields still remain visible to all users. Does the Base (Primary) group automatically force all fields visibility public by default? If so, is there way to override?

    If there is no way to change the visibility in the Base (Primary), I suppose I can just put private info in the other Profile Group, but I’m curious if or how that may effect my database import..

    #166430
    shanebp
    Moderator

    While very doable, this will require custom coding.
    You can contact me at PhiloPress

    #166428
    dpeters
    Participant

    WP Version: 3.5.1
    BuddyPress: 1.7.2

    You want to ‘hide’ the profile page for a member who hasn’t paid their dues?
    What should happen if that page is accessed by that member or another member?
    Redirect? Custom message page ?

    Either redirect to a listing of all active members or display an error page would be fine, (i.e. “This member is not currently an active member.”)

    If ‘paid dues’ is a boolean, then it’s easy to write a function.
    Where is that boolean stored?

    It would be stored in their profile as an Admin-editable field, per the original post.

    Does that member still appear on the Members page? In the Activity stream?

    No to both. Hidden users would be able to login and update information but their profile wouldn’t be public-facing, just them and the admins.

    This would be useful as we have staggered dues, allowing profiles to turn off/on.

    #166426
    shanebp
    Moderator

    You need to state which versions of WP & BP you use.

    You want to ‘hide’ the profile page for a member who hasn’t paid their dues?
    What should happen if that page is accessed by that member or another member?
    Redirect? Custom message page ?

    If ‘paid dues’ is a boolean, then it’s easy to write a function.
    Where is that boolean stored?

    Does that member still appear on the Members page? In the Activity stream?

    iow. you need to be more specific about the behaviour that you want.

    #166423
    Tecca
    Participant

    You can download a plugin like Theme My Login — it automatically redirects logged out/non-registered users to a log-in page with your site’s style.

    #166419
    dpeters
    Participant

    Any ideas?

    #166119
    Liltiger
    Participant

    *My theme also… haha sorry for bad grammar

    #166118
    Liltiger
    Participant

    Hey,

    If you go to Dashboard Settings > Buddypress > Settings, then the first option is ‘Show the Toolbar for logged out users’. Just uncheck it.

    My theme is also has a setting for the login toolbar, so you may want to check out your theme settings.

    I hope it helps!

    #164980
    WPAgentur
    Participant

    Hi, i put the code in my theme funktions.php but superadmin is still visible in memberslist.

    add_action(‘bp_ajax_querystring’,’bpdev_exclude_users’,20,2);
    function bpdev_exclude_users($qs=false,$object=false){
    //list of users to exclude

    $excluded_user=’1′;//comma separated ids of users whom you want to exclude

    if($object!=’members’)//hide for members only
    return $qs;

    $args=wp_parse_args($qs);

    //check if we are searching for friends list etc?, do not exclude in this case
    if(!empty($args[‘user_id’])||!empty($args[‘search_terms’]))
    return $qs;

    if(!empty($args[‘exclude’]))
    $args[‘exclude’]=$args[‘exclude’].’,’.$excluded_user;
    else
    $args[‘exclude’]=$excluded_user;

    $qs=build_query($args);

    return $qs;

    }

    Iam using WP: 3.5.1 and BP: 1.7.2 with the buddyboss-theme.

    #164526

    In reply to: BuddyPress 1.7.1

    Suraj
    Participant

    you guys are just awesome.
    I have a feature request. I searched for the same using Google and almost across all the buddypress related support forum and tried all the codes but the thing is not working for me, I want to hide the admin activities to appear on my site, but it is not working, if possible, can you add a feature to hide all the activity of any particular user if he wants to including his/her online status.

    Ben Hansen
    Participant

    i’m not using that one i’m using this one:

    <?php
    
    //hide superadmin
    
    add_action("plugins_loaded","bpdev_init_sm_mode");
    function bpdev_init_sm_mode(){
    if(is_site_admin())
    remove_action("wp_head","bp_core_record_activity"); //id SM is on, remove the record activity hook
    }
    
    ?>
    #163561
    danzigism
    Participant

    You’re right @shanebp

    After reading that manage_options much gives that role access to the entire Settings feature of WordPress I realized that isn’t good. Needless to say, I have used Adminimize to hide the “Settings” tab from the Manager user role for the time being but certain savvy people could still access it if they knew the URL to those settings pages.

    I submitted the bug to: https://buddypress.trac.wordpress.org/ticket/4991#ticket

    Thanks again for all of your help!

    #163334
    rypo73
    Participant

    @chouf1

    OK – you’re onto something… And it seems your initial hunch of PBCK was spot on – feeling foolish, but enlightened now!

    SO… I had some code in my custom-functions.php file to ‘hide’ the site admin activity (see below). Because we have several users with ‘Administrator’ roles, it seems this particular user was affected. Others MAY have been if they had logged in more often…

    Seems this code was not the best to use:
    // Don’t record activity by the site admins or show them as recently active
    function my_admin_stealth_mode(){
    if ( is_site_admin() ) {
    global $bp;
    remove_action(‘wp_head’,’bp_core_record_activity’);
    delete_user_meta($bp->loggedin_user->id, ‘last_activity’);
    }
    }
    add_action(‘init’,’my_admin_stealth_mode’);

    SO I’ve removed it in favour of THIS version, specifically masking the activity of INDIVIDUAL users with ‘Administrator’ roles, like our site admin user.

    // Don’t record activity for a user or show them as recently active
    function my_user_stealth_mode(){
    $current_user = wp_get_current_user();
    if(is_user_logged_in()) {
    if(‘YourUsername’ == $current_user->user_login) {
    remove_action(‘wp_head’,’bp_core_record_activity’);
    delete_user_meta($current_user->ID, ‘last_activity’);
    }
    }
    }
    add_action(‘init’,’my_user_stealth_mode’);

    Hope it might be of use to others in future. Thanks for responding to my post. I’m now a LOT more familiar with meta data fields as a result.

    p.s. you’re right about # plugins, we do need a lot, but not ALL of those. It’s our dev environment after all. Often a case of playing with different ones to see what fits the bill.

    #161330
    meg@info
    Participant

    In functions.php file of your current theme 😛

Viewing 25 results - 301 through 325 (of 628 total)
Skip to toolbar