Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

Viewing 25 results - 26 through 50 (of 692 total)
  • Author
    Search Results
  • #326080

    As I have not managed to code something that works to identify my specific group, I did a bit of lateral thinking and my code looks to see whether or not a “group_mod” is present in a group and (if not) the Join/Hide button is hidden, like the case of group_admins, when only one is present. I can live with it for now, as I just have to make sure that all other groups have at least one Moderator set, then they work as normal.

    It works fine for me, using BuddyPress Version 10.4.0, under WordPress 6.0.2 and a modified “Wellness Pro Version: 1.1.4” child theme under Genesis Framework Version: 3.3.5.

    I hope it helps, unless and until some kind BuddyPress dev comes in with a proper solution!

    #325855
    MickFrench
    Participant

    Thank you Michael,
    It doesn’t work. I have tried the second code for admnins and also the first code by excluding users by ID (numbers of the admins I want to hide).
    Tried at the root of folder Plugins and BuddyPress, also into the code directly in functions.php of my theme Sydney… nothing works.
    Hoping you or someone have another idea ?

    webmark487
    Participant

    Hi!

    How can I hide the BuddyPress “Profile Fields” menu entry (in the WP backend) for non-admin users?

    https://pasteboard.co/osvfH8ty1JYk.jpg

    They should not be able to make changes there.

    Thx in advance and best regards
    Markus

    manni65929
    Participant

    Hey!

    Is there a way to hide Admins from the general member’s directory – maybe with a plugin or a shot script? Also, would that not be a great feature to be included in the next update for BuddyPress?

    Thanks in advance

    #325014
    Anonymous User 16480907
    Inactive

    @andrew_long15

    use this code.

    /**
    * Removes send invite tab according to Group Invitations setting.
    *
    * @since 2.2.0
    */
    function remove_send_invite_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(
    ‘send-invites’ => 1,
    );

    $parent_nav_slug = bp_get_current_group_slug();
    $current_group_id = bp_get_current_group_id();
    $invite_status = groups_get_groupmeta( $current_group_id, ‘invite_status’, true );
    if ( ‘admins’ === $invite_status || ‘mods’ === $invite_status ) {
    // Remove the nav items.
    foreach ( array_keys( $hide_tabs ) as $tab ) {
    bp_core_remove_subnav_item( $parent_nav_slug, $tab, ‘groups’ );
    }
    }

    // You may want to be sure the user can’t access.
    if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) {
    bp_core_add_message( ‘No tienes suficientes permisos para acceder.’, ‘error’ );
    bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) );
    }
    }
    add_action( ‘bp_actions’, ‘remove_send_invite_tab’, 9 );

    #323623
    ayllachristinne
    Participant

    Thats the code:
    function buddydev_hide_members() {
    $allowed_roles = array( ‘administrator’, ‘editor’ );
    $hide = true;
    $user = wp_get_current_user();

    if(str_contains($_SERVER[‘REQUEST_URI’], ‘/membros/’)){
    //REDIRECIONA PARA LOGIN SE NÃO ESTIVER LOGADO
    if ( !is_user_logged_in() ) {
    wp_safe_redirect(get_permalink(get_page_by_path(‘login-registro’)));
    exit;
    }

    //CHECANDO SE TEM O PAPEL QUE PODE VISUALIZAR
    foreach ( $allowed_roles as $role ) {
    if ( in_array( $role, $user->roles, true ) ) {
    $hide = false;
    break;
    }
    }

    if( ! $hide ){
    return;
    } elseif(!bbp_is_user_home()) {
    wp_safe_redirect(bp_loggedin_user_domain());
    exit;
    }
    }
    }
    add_action( ‘bp_template_redirect’, ‘buddydev_hide_members’);

    ayllachristinne
    Participant

    Hi, I want to show the loggedin user profile if he/she tries to access other user’s profile.
    Here’s a list of what I want and what I’ve accomplished

    • OK – Redirect to own profile when entering /members/
    • X – Redirect to own profile when entering another profile via link
    • OK – WMDs can view member listings
    • OK – ADMs can view member profile

    This is the code i have until now

    function buddydev_hide_members_directory_for_all_except_users_with_specific_roles() {
      if ( ! bp_is_members_directory() ) {
        return;
      }
    
      if ( !is_user_logged_in() ) {
        bp_do_404();
        load_template( get_404_template() );
        exit( 0 );
      }
    
      $allowed_roles = array( 'administrator', 'editor' );
      $hide          = true;
      $user          = wp_get_current_user();
      
      foreach ( $allowed_roles as $role ) {
        if ( in_array( $role, $user->roles, true ) ) {
          $hide = false;
          break;
        }
      }
    
      if ( ! $hide ) {
        return;
      }
    
      /** 
       * bp_is_my_profile()
       * bp_is_user_profile()
       * bp_is_user()
       * bbp_is_single_user_profile()
       * bbp_is_user_home()
       * bbp_is_single_user()
       */
       if(!bbp_is_user_home()){
           wp_redirect(bp_loggedin_user_domain());
       }
    
      //REDIRECT TO USER PROFILE
      wp_redirect(bp_loggedin_user_domain());
      exit( 0 );
    }
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_for_all_except_users_with_specific_roles' );

    I tried some things like the last IF with the commented functions but none work, so I guess I’m doing something wrong. Can you help me plz?

    Thanks in advance

    #322843
    atfpodcast
    Participant

    How can I do this in the current version? Then when they login it is there so they can edit etc their profile.

    deaf25
    Participant

    Hello,

    I am looking for php code to be inserted into my custom function plugin so that my admin account will be visible hidden from members on members directory and else where.

    I did see some colder codes here but it does not seem to be working on the current BuddyPress version.

    Does anyone have the workable code?

    Thanks

    #319766
    veshop
    Participant

    Hello,

    does anybody know if such a tutoral exists also for buddypress?: https://www.champ.ninja/2020/05/show-passwords-feature-in-ultimate-member-forms/

    Maybe I was searching for the wrong terms. I have hide/show password with wp-admin.php of course but not for regular members when registering or loggin in, so I would like to add this.

    #319470
    nathan767
    Participant

    Good Day,
    I currently have BuddyPress Create Group Type and BuddyPress installed on my word press website. I use it such a way the administrators of each group do not necessarily have to edit a few of the settings because they are usually less tech savy. I would like to know is it possible to hide some of the settings on the front end in the management window such as settings, delete and forums.

    Also I would like to know if it is possible to have the email information that is sent to person when they are rejected from a group to be changed? Because we find the you have been rejected message a bit harsh.

    #319278
    gringanc
    Participant

    Dumb question, but is bbpress the same thing as buddypress? Will the bbp shortcodes work on Buddypress? Without a plugin? We have seen other references that [bc-…] are shortcodes for BuddyPress, where as [bbp-…] is for BBpress.

    Use case: We’re trying to have our own login page and hide the WordPress bar for non-admin users. The login does not need to be a WordPress.com login for our purposes.

    eddypiv
    Participant

    Hi,

    I want only the admin to have access to the memberslist.
    How to achieve that?

    juliamb
    Participant

    Hi!

    I’ve created a custom role that can edit groups, so it has the ‘manage_options’ capability assigned.
    Now I’m trying to hide the option Tools > BuddyPress from the administration menu for this role. I was following this tutorial but I cannot find the way to address that specific page.
    I’m using this code but it’s not working:

    remove_menu_page('bp-tools');

    The page URL is different from administrator role to the others.

    • URL for Administrators: /wp-admin/tools.php?page=bp-tools
    • URL for other roles: /wp-admin/export-personal-data.php?page=bp-tools

    How can I hide this menu option?

    Thanks, regards.

    #318912
    khocvole1197
    Participant

    hi there,
    i am looking for a way to hide user role in member page, i still don’t have a working solution. anyone have any ideas, thanks.

    I tried using this guide:
    https://wordpress.org/support/topic/hide-admin-users-from-being-displayed-in-members-directory/ is not working.

    #317942
    dnfoz45
    Participant

    I want to remove “HOME” in BP
    So the result should be first MENU Item is “FORUM” then “MEMBERS” “SEND INVITATIONS” and “ADMIN” (for admins only)

    As default the menu is :
    “HOME” then “FORUM” then “MEMBERS” “SEND INVITATIONS” and “ADMIN” (for admins only)

    But users that get’s in at the “HOME” level post messages thinking they are posting in the FORUM…? So that is why I want to hide it or take it off!

    Hope this solution works – But are unsure where to stick it… 🙂

    Best regards

    Ehhh any functions.php ?? Themes, BP or in a specific folder?

    emptypack
    Participant

    Hello, I wanted to ask, how can I exclude certain member role from showing on member list and be redirected to “wp-login” when non logged visitors try to access their profile.

      For first task, I use this code to exclude certain user ID from beeing in member list (but this code need modification to accept certain role and don’t show those member just for non logged visitors)

      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');
      For second task, I use this code but I dont know how to select certain member role{

      function nonreg_visitor_redirect() {
      global $bp;
      if ( bp_is_user() && !is_super_admin() ) {
      if(!is_user_logged_in()) { //just a visitor and not logged in
      wp_redirect( get_option('siteurl') . '/wp-login.php' );
      }
      }
      }
      add_filter('get_header','nonreg_visitor_redirect',1);
    petertucker
    Participant

    Here is the solution for anyone who is going to see this post in the future.

    1. Install the username change plugin:
    https://buddydev.com/plugins/bp-username-changer/
    2. Add to the plugins code (bp-change-username.php) on line 163;

    
    xprofile_set_field_data(1, $user_id,  $new_user_name);
    

    3. In your theme function.php file add the follow code to hide XProfile editing:

    
    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 groups, separated by comma
                    //$retval['exclude_groups'] = '1';
            } 
            return $retval;         
    
            endif;
    }
    add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );
    

    I hope this helps anyone who finds it.

    #316135
    haitianguy
    Participant

    Hi, i feel like im doing this properly but i never get the right result. i have a custom meta called “featured” in activity meta. For testing purposes the meta values are 1,2,3,4 my goal is to have an activity loop order activities by the meta value. i’ve checked the documentation and i came up with this.

    
    <?php
    
    get_header(); ?>
    
    <?php get_template_part('page-parts/general-title-section'); ?>
    
    <?php get_template_part('page-parts/general-before-wrap');
    
    $atts =  array(
    			'title'            => 'Latest Activity',// title of the section.
    			'pagination'       => 1,// show or not.
    			'load_more'        => 0,
    			'display_comments' => 'threaded',
    			'include'          => false,     // pass an activity_id or string of IDs comma-separated
    			'exclude'          => false,     // pass an activity_id or string of IDs comma-separated
    			'in'               => false,     // comma-separated list or array of activity IDs among which to search
    			'sort'             => 'DESC',    // sort DESC or ASC
    			'page'             => 1,         // which page to load
    			'per_page'         => 5,         // how many per page.
    			'max'              => false,     // max number to return.
    			'count_total'      => true,
    
    			// Scope - pre-built activity filters for a user (friends/groups/favorites/mentions).
    			'scope'            => false,
    
    			// Filtering
    			'user_id'          => false,    // user_id to filter on
    			'object'           => false,    // object to filter on e.g. groups, profile, status, friends
    			'action'           => false,    // action to filter on e.g. activity_update, new_forum_post, profile_updated
    			'primary_id'       => false,    // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
    			'secondary_id'     => false,    // secondary object ID to filter on e.g. a post_id.
    
    			// Searching
    			'search_terms'     => false,         // specify terms to search on.
    			'use_compat'       => bp_use_theme_compat_with_current_theme(),
    			'allow_posting'    => false,    // experimental, some of the themes may not support it.
    			'container_class'  => 'activity',// default container,
    			'hide_on_activity' => 1,// hide on user and group activity pages.
    			'for'              => '', // 'logged','displayed','author'.
    			'role'             => '', // use one or more role here(e.g administrator,editor etc).
                'for_group'        => '',// group slug.
    		);
    
    		$atts['meta_query']= array(
                                        array(
                                            'key' => 'featured',
                                            'value' => '0',
                                            'type' => 'numeric',
                                            'compare' => '!=',
                                            ),
                                            'meta_type' => 'numeric',
                                    'orderby' => 'meta_value_num',
                                    'meta_key' => 'featured',
                                    'order' => 'DESC'
                                    );
    
     ?>
    			<div id="buddypress">
    	
    
    		<?php do_action( 'bp_before_activity_loop' ); 
    		
    		
    		
    	
    
    if ( bp_has_activities( $atts ) ) : ?>
    
                <div class="<?php echo esc_attr( $atts['container_class'] ); ?> 
                <?php if ( ! $atts['display_comments'] ) : ?> hide-activity-comments<?php endif; ?>">
    
                    <ul id="activity-stream" class="activity-list item-list">
    
    					<?php while ( bp_activities() ) : bp_the_activity(); ?>
    						
    						<?php bp_get_template_part( 'buddypress/activity/entry' ); ?>
    					<?php endwhile; ?>
    
    					<?php if ( $atts['load_more'] && bp_activity_has_more_items() ) : ?>
                            <li class="load-more">
                                <a href="<?php bp_activity_load_more_link() ?>"><?php _e( 'Load More', 'buddypress' ); ?></a>
                            </li>
    					<?php endif; ?>
                    </ul>
    
    				<?php if ( $atts['pagination'] && ! $atts['load_more'] ) : ?>
                        <div class="pagination">
                            <div class="pag-count"><?php bp_activity_pagination_count(); ?></div>
                            <div class="pagination-links"><?php bp_activity_pagination_links(); ?></div>
                        </div>
    				<?php endif; ?>
    
                </div> 
    
            <?php else : ?>
                <div id="message" class="info">
                    <p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ); ?></p>
                </div>
            <?php endif; ?>
            
    ?>
    			</div>
    		
    
    		<?php do_action( 'bp_after_activity_loop' ); ?>
    
    <?php get_template_part('page-parts/general-after-wrap'); ?>
    
    <?php get_footer(); ?>
    

    everything here works except for the order. for some reason it always orders by activity ID. am i missing something here? Thanks in advance im going crazy with this.

    rando
    Participant

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

    i want a redirect code to a url
    &
    i want a code for echo a message without redirecting

    thanks

    #313798
    Achille
    Participant

    How to hide the admin profile in the section (recently active?)

    http://prntscr.com/ugge3r

    #313544
    amtenbrink
    Participant

    Hi,

    how can i hide the wordpress toolbar (adminbar) for logged in (!) buddypress members?

    thanks!

    #312915
    songdove
    Participant

    Update, I found a way to change the literal username, but if you’re admin, I don’t recommend it particularly if you are admin of a multi-site setup as I am. I had to change my username back to get to the multi-site administration area. Either way, the change did not hide the login name, it only changed it. Not the solution any of us are after.

    bluesweet
    Participant

    How do I remove/hide the “View Admins” button from groups page?

    #311661
    pierremaitre
    Participant

    Hi there,
    I would like to hide the admin bar for users, but I still want them to be able to edit and update their profile. Therefore, I need a link in the front end to the profile edit screen.
    Can you please help me achieve this?
    Thanks.

Viewing 25 results - 26 through 50 (of 692 total)
Skip to toolbar