Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

Viewing 25 results - 326 through 350 (of 915 total)
  • Author
    Search Results
  • evitorino
    Participant

    My wordpress is 4.1 and Buddypress 2.1.1

    Hello Community,

    I am having a problem with a custom member page pagination, when clicking link to pagination page 2, pagination takes us to page 2 and adds the string “?upage=2” to the site URL.

    After that, clicking page 1 or back symbol on pagination links does nothing, only refreshes page.

    Problematic page: http://wp1.kodeserver.net/coach/
    I have set the page above in Twentyfifteen theme as to exclude any third party theme related errors.

    If we use the default member page “http://wp1.kodeserver.net/members/” then pagination works ok.

    I believe the error might be caused by the member filter i made or maybe i messed up the template.

    Hope you can help.

    Below is the code i am using:

    functions that i use to filter member loop by member types on the site:

    function bp_exclude_users_but_player() {
    $excluded_users_but_player = implode(',',get_users('role=coach&fields=ID'));
    $excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=seniorcoach&fields=ID'));
    $excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=subscriber&fields=ID'));
    $excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=editor&fields=ID'));
    $excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=administrator&fields=ID'));
    return $excluded_users_but_player;
    }

    function bp_exclude_users_but_coach() {
    $excluded_users_but_coach = implode(',',get_users('role=player&fields=ID'));
    //$excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=seniorcoach&fields=ID'));
    $excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=subscriber&fields=ID'));
    $excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=editor&fields=ID'));
    $excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=administrator&fields=ID'));
    return $excluded_users_but_coach;
    }

    function bp_exclude_users_but_senior_coach() {
    $excluded_users_but_senior_coach = implode(',',get_users('role=player&fields=ID'));
    $excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=coach&fields=ID'));
    $excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=subscriber&fields=ID'));
    $excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=editor&fields=ID'));
    $excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=administrator&fields=ID'));
    return $excluded_users_but_senior_coach;
    }

    function bp_exclude_cc_backend_users() {
    $excluded_cc_backend_users = implode(',',get_users('role=subscriber&fields=ID'));
    $excluded_cc_backend_users = $excluded_cc_backend_users.','.implode(',',get_users('role=editor&fields=ID'));
    $excluded_cc_backend_users = $excluded_cc_backend_users.','.implode(',',get_users('role=administrator&fields=ID'));
    return $excluded_cc_backend_users;
    }

    Member Loop that calls member “Coach” filter:
    <?php if ( bp_has_members( bp_ajax_querystring( 'members').'&exclude='.bp_exclude_users_but_coach().'&per_page=24' ) ) : ?>

    And this is the problematic page template code (The one that filters by role type (coach))

    <?php
    /**
    * The template for displaying all pages
    *
    * This is the template that displays all pages by default.
    * Please note that this is the WordPress construct of pages and that
    * other 'pages' on your WordPress site will use a different template.
    *
    * @package WordPress
    * @subpackage Kleo
    * @since Kleo 1.0
    */

    get_header(); ?>

    <?php get_template_part('page-parts/general-title-section'); ?>

    <?php get_template_part('page-parts/general-before-wrap'); ?>

    <?php
    if ( have_posts() ) :
    // Start the Loop.
    while ( have_posts() ) : the_post();
    /*
    * Include the post format-specific template for the content. If you want to
    * use this in a child theme, then include a file called called content-___.php
    * (where ___ is the post format) and that will be used instead.
    */
    get_template_part( 'content', 'page' );
    endwhile;
    endif;
    ?>

    <?php do_action( 'bp_before_directory_members_page' ); ?>
    <section class="container-wrap main-color">
    <div class="section-container container">

    <div id="buddypress">

    <?php do_action( 'bp_before_directory_members' ); ?>

    <?php do_action( 'bp_before_directory_members_content' ); ?>

    <!--<div id="members-dir-search" class="dir-search" role="search">
    <?php //bp_directory_members_search_form(); ?>
    </div>--><!-- #members-dir-search -->

    <?php do_action( 'bp_before_directory_members_tabs' ); ?>

    <form action="" method="post" id="members-directory-form" class="dir-form">

    <div id="subnav" class="item-list-tabs" role="navigation">

      <!--<li class="selected" id="members-all">"><?php //printf( __( 'All Members <span>%s</span>', 'buddypress' ), bp_get_total_member_count() ); ?>--> <!--Contatore membri totali-->

      <?php //if ( is_user_logged_in() && bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
      <!--<li id="members-personal">"><?php //printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?>-->
      <?php //endif; ?>

      <?php //do_action( 'bp_members_directory_member_types' ); ?>

      <?php //do_action( 'bp_members_directory_member_sub_types' ); ?>

      <!--<li id="members-order-select" class="last filter">
      <label for="members-order-by"><?php //_e( 'Order By:', 'buddypress' ); ?></label>
      <select id="members-order-by">
      <option value="active"><?php //_e( 'Last Active', 'buddypress' ); ?></option>
      <option value="newest"><?php //_e( 'Newest Registered', 'buddypress' ); ?></option>

      <?php //if ( bp_is_active( 'xprofile' ) ) : ?>
      <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
      <?php //endif; ?>

      <?php //do_action( 'bp_members_directory_order_options' ); ?>
      </select>
      -->

    </div><!-- .item-list-tabs -->

    <div id="members-dir-list" class="members dir-list">

    <?php

    /**
    * BuddyPress - Members Loop
    *
    * Querystring is set via AJAX in _inc/ajax.php - bp_legacy_theme_object_filter()
    *
    * @package BuddyPress
    * @subpackage bp-legacy
    */

    ?>

    <?php if ( bp_has_members( bp_ajax_querystring( 'members').'&exclude='.bp_exclude_users_but_coach().'&per_page=24' ) ) : ?>

    <div id="pag-top" class="pagination">
    <div class="pag-count" id="member-dir-count-top">
    <?php bp_members_pagination_count(); ?>
    </div>
    <div class="pagination-links" id="member-dir-pag-top">
    <?php bp_members_pagination_links(); ?>
    </div>
    </div>

    <?php do_action( 'bp_before_directory_members_list' ); ?>

    <ul id="members-list" class="item-list row kleo-isotope masonry">

    <?php while ( bp_members() ) : bp_the_member(); ?>

    <?php $user_info = get_userdata(bp_get_member_user_id()); ?>
    <?php
    $user_roles = $user_info->roles;
    $user_role = array_shift($user_roles);

    // echo 'User ID: ' . $user_info->ID . "\n";
    // echo bp_core_get_user_displayname( $user_info->ID ) ;
    // echo $user_info->ID ;
    ?>

    <li class="kleo-masonry-item type-<?php echo $user_role; ?>">

    ID ; ?>' value='show/hide'> <!-- link che apre info's nascoste -->

    <div class="member-inner-list animated animate-when-almost-visible bottom-to-top">

    <div class="item-avatar rounded">
    <!--
    ">
    --> <?php bp_member_avatar( 'type=full&height=150&width=150' ); ?>
    <!--
    -->
    <?php //do_action('bp_member_online_status', bp_get_member_user_id()); ?>
    </div>
    <!-- "> -->
    <div class="item">
    <div class="item-title"><span class="loop-nome"><?php bp_member_name(); ?></span><span class="loop-cognome"><?php bp_member_profile_data( 'field=Cognome' ); ?></span></div>

    <!-- <?php if ( bp_get_member_latest_update() ) : ?>
    <span class="update"> <?php bp_member_latest_update(); ?></span>
    <?php endif; ?>
    -->
    <?php do_action( 'bp_directory_members_item' ); ?>

    <?php
    /***
    * If you want to show specific profile fields here you can,
    * but it'll add an extra query for each member in the loop
    * (only one regardless of the number of fields you show):
    *
    * bp_member_profile_data( 'field=the field name' );
    */
    ?>

    </div>

    </div><!--end member-inner-list-->
    <!-- link che apre informazioni nascoste -->
    <div id="contenuto-nascosto-<?php echo $user_info->ID ; ?>" class="hidden-infos">
    <div class="nascondi-infos">
    ID ; ?>' value='show/hide'>
    <i class="icon-cancel"></i>

    </div>
    <div class="unhidden-infos unhidden-infos-first ">
    <div class="item-avatar-small">
    ">
    <?php bp_member_avatar( 'type=full&height=50&width=50' ); ?>

    <?php do_action('bp_member_online_status', bp_get_member_user_id()); ?>
    </div>
    </div>
    <div class="unhidden-infos">
    <div class="item-title">
    ">
    <span class="loop-nome"><?php bp_member_name(); ?></span>

    ">
    <span class="loop-cognome"><?php bp_member_profile_data( 'field=Cognome' ); ?></span>

    </div>
    </div>
    <div class="unhidden-infos">
    <span class="nomeazienda-titolo custom-title">Azienda:</span>
    <span class="nomeazienda custom-infos"><?php bp_member_profile_data( 'field=Azienda' ); ?></span>
    </div>
    <div class="unhidden-infos">
    <span class="pos-lavorativa-title custom-title">Funzione:</span>
    <span class="pos-lavorativa custom-infos"><?php bp_member_profile_data( 'field=Funzione' ); ?></span>
    </div>
    <div class="unhidden-infos">
    <span class="settore-title custom-title">Settore:</span>
    <span class="settore custom-infos"><?php bp_member_profile_data( 'field=Settore' ); ?></span>
    </div>
    <div class="unhidden-infos">
    <span class="laurea-title custom-title">Laurea:</span>
    <span class="laurea custom-infos"><?php bp_member_profile_data( 'field=Laurea' ); ?></span>
    </div>

    <div class="action">

    <div class="generic-button" id="send-private-message">
    " title="Clicca per profilo completo" class="send-message">Profilo Completo
    </div>

    <?php //do_action( 'bp_directory_members_actions' ); ?>

    </div>
    </div>

    <script type="text/javascript">
    jQuery(document).ready(function(){
    jQuery('#nascondi-mostra-<?php echo $user_info->ID ; ?>').live('click', function(event) {
    jQuery('#contenuto-nascosto-<?php echo $user_info->ID ; ?>').toggle('show');
    });
    });
    </script>

    <?php endwhile; ?>

    <?php do_action( 'bp_after_directory_members_list' ); ?>

    <?php bp_member_hidden_fields(); ?>

    <?php else: ?>

    <div id="message" class="info">
    <p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p>
    </div>

    <?php endif; ?>

    <?php do_action( 'bp_after_members_loop' ); ?>

    </div><!-- #members-dir-list -->

    <?php do_action( 'bp_directory_members_content' ); ?>

    <?php wp_nonce_field( 'directory_members', '_wpnonce-member-filter' ); ?>

    <?php do_action( 'bp_after_directory_members_content' ); ?>

    </form><!-- #members-directory-form -->

    <?php do_action( 'bp_after_directory_members' ); ?>

    </div><!-- #buddypress -->

    </div>
    </section>

    <?php do_action( 'bp_after_directory_members_page' ); ?>

    <?php get_template_part('page-parts/general-after-wrap'); ?>

    <?php get_footer(); ?>

    #233941
    format19
    Participant

    Hi Henry,

    Thanks for that, yes I did realize that I have been all over the codex as you can imagine but figuring out exactly what code I needed was getting me a bit bogged down.

    I have managed to achieve it a different way.
    I used USER ROLE EDITOR to create a new role again called Editor Plus but this time copied the settings from Administrator then took away privileges
    Finally I used Adminimize to hide additional menu items.

    This has worked perfect, Now my 2 site owners are set as Editor Plus and Moderators they can see all users data including Extended info but cant see any of the stuff that can actually break the site 🙂

    Thanks again
    M

    #233512
    Henry Wright
    Moderator

    Hi @screampuff

    You can make that link private by doing something like this:

    function screampuff_hide_achi() {
        // Bail if the current user is the displayed user.
        if ( bp_loggedin_user_id() == bp_displayed_user_id() )
            return;
    
        // Bail if the current user is an admin.
        if ( current_user_can( 'manage_options' ) )
            return;
    
        // Bail if not the achievements page.
        if ( bp_current_action() != 'achievements' )
            return;
    
        // Redirect.
        wp_redirect( home_url() );
        exit;
    }
    add_action( 'template_redirect', 'screampuff_hide_achi' );

    Please note I haven’t tested. Also, I’m assuming the current action is ‘achievements’. It may be something else in which case the function will need a minor tweak.

    #233511
    screampuff
    Participant

    Hello, I have Buddypress and Achievements for WordPress (the author is not active or providing support). This is an internal company site and I want to make the Achievements private so that users can only see their own achievements.

    I’ve figured out how to make the xprofile Achievements tab only appear for the current user and admins with this code:

    function hide_achievements_from_users() {
    global $bp;
    if ((bp_loggedin_user_id() == bp_displayed_user_id()) || (current_user_can('manage_options'))){
    return;
    }
    bp_core_remove_nav_item('achievements');
    }
    add_action( 'bp_setup_nav', 'hide_achievements_from_users', 99 );

    However a user can still browse other user’s achievements by manually typing out the url like http://mysite.com/members/username/achievements/

    Is there a way I can make this section of user’s profiles private so that only they (and admins) can view it? Users should still be able to visit another user’s profile, it is only the /achievements/ at the end of the URL which needs to be blocked.

    #233342
    David13_13
    Participant

    Hello

    I only want to hide it because it shows my username to access admin panel in WordPress too… A hacker only would need to hack my pass.

    It’s not possible to hide it in all the website?

    Thanks

    #233226
    danbp
    Participant

    hi @david13_13,

    be more specific please.
    @username is used all over the site, and for anybody.
    Even if you hide only YOURS on a specific part, like your profile header, users will see your username on activities, or when they mention you.

    Do you need this to aply only to you, as site admin, on your profile page ?
    Or elsewhere too ?

    David13_13
    Participant

    Hello!

    I want to ask if there is some way of remove the @username in the Admin’s profile because it shows my user for log in in WordPress.

    I have read about hide the Admin from member list and online members, but I don’t want that. I only want to hide the @username

    Thanks

    #233041
    Garrett Hyder
    Participant

    Update – Found an issue with my code when you go to the second page of the Members Groups list it reverts to showing hidden, etc. This is due to the call being done with AJAX which is considered an admin so !is_admin is false. To correct this I’ve updated the if statement to check if DOING_AJAX:

    // Buddypress Filter Hidden Groups from Groups Loop
    function filter_hidden_groups_sql($sql) {
    	if (!is_admin() || (defined('DOING_AJAX') && DOING_AJAX)){
            $sql_parts = explode('WHERE', $sql);
            $new_sql = $sql_parts[0] . "WHERE g.status != 'hidden' AND" . $sql_parts[1];
    	    return $new_sql;
    	} else {
    		return $sql;
    	}
    }

    Basically this allows the backend admin to list all groups but the front end hides the hidden ones.

    Cheers

    screampuff
    Participant

    Thanks for the reply. I made some changes to the code before reading and was able to accomplish removing the tab from buddypress profiles with this:

    function hide_achievements_from_users() {
    global $bp;
    if ((bp_loggedin_user_id() == bp_displayed_user_id()) || (current_user_can('administrator'))){
    return;
    }
    bp_core_remove_nav_item('achievements');
    }
    add_action( 'bp_setup_nav', 'hide_achievements_from_users', 99 );

    However I’m stuck on how to 404 the pages if they manually type out the URL

    In your code I see:

        // I guess we should 404 this page because this member isn't an admin or the displayed member.
        $wp_query->set_404();
        status_header( 404 );
        nocache_headers();

    How do I get this to apply only when it is http://mysite.com/members/<username>/achievements?

    #232706
    youmin
    Participant

    i have a question for r-a-y, is it not possible to make it one time select able (for users), i mean locking down after selecting once or twice.
    but admin can change it on user request ?

    or making it available on registration form only ?

    i also saw the ticket above mentioned but its just hiding the box from user, i dont think its a perfect solution. i will be good to hide after selecting a member type by a user .

    Henry Wright
    Moderator

    Hi @screampuff

    You could try the following function which will stop unwanted users from viewing the page directly if they tried typing the URL:

    function my_hide_achievements_page() {
        $role = xprofile_get_field_data( 'Membership' );
    
        if ( ( $role != 'Administrator' ) || ( bp_current_user_id() == bp_displayed_user_id() ) )
            return;
    
        // I guess we should 404 this page because this member isn't an admin or the displayed member.
        $wp_query->set_404();
        status_header( 404 );
        nocache_headers();
    }
    add_action( 'init', 'my_hide_achievements_page' );
    screampuff
    Participant

    Hello, I have the “Achievements for WordPress” Plugin, it basically creates an “Achievements” tab in every user’s profile and displays their Achievements.

    I would like to hide this so that only the user and admins can see their own achievements.

    I tried adding this code:

    
    function hide_achievements_from_users() {
    $role = xprofile_get_field_data( 'Membership' );
    if( $role !='Administrator' )
    bp_core_remove_nav_item('achievements');
    }
    add_action( 'bp_setup_nav', 'hide_achievements_from_users', 99 );
    

    However this obviously hides it from everyone but admins, and I can still see the achievements by going to /members/<username>/achievements, I need this to be completely hidden so the user would get a 404 error or redirect if they tried to type out the URL.

    Thanks

    lustek
    Participant

    Hi guys,
    I have a small problem with not acitvaed accounts.

    I have less users listed here:
    /wp-admin/users.php?page=bp-signups
    than in the wp_users table with status 2. I checked wp_usermeta and those missing users have activation_key defined for each of them.

    So they are in the database, they have activation key defined, but they are not in the back office panel.

    I suspect the reason is that those records are very old. Is there a mechanism to hide old sign-ups without activation?
    thanks in advance

    EDIT:
    I’ve just realised, that those users were moved from our previous cms and they have activation key from that system.

    I made a test and it occurs that during activation it’s not the value of activation_key from wp_usermeta taken to compare. For a new user registered I changed this value in the database, but it could still be activated using the activation link from the email.

    So my question changes:
    what is the algorithm to create a proper activation key?

    #231785
    Kir 2012
    Participant

    Hi there, I’m sorry to jump in on your post, I would like to know how to do this too – kind of.
    OP,I think this may be of some help to you.

    Admin, it may just be me being slow today, but I can’t see how to start a new thread or help request from my dash, could you pop a link here for me? Sorry about that! 🙁

    Anyone, I would like to know how to hide (not remove) only the top nav menu, with ‘profile, activity, messages, friends’ etc. I have this menu elsewhere. I want to remove it from all other places. But I need to keep the subnav links visible.

    I know how to -remove- an item nav/subnav – but want to -hide- top links without removing the actual function of the url in order that I can still link to it from my own menu.

    I can edit the css in buddypress.css, I’ve tried a few things but nothing works so far, like.

    #buddypress div.item-list-tabs {display:none};

    I’ve also tried finding the link to the menu in the home or message-header.php in buddypress/bp-templates/bp-legacy/buddypress/members/single to amend it there.

    If anyone could help I’d be so grateful, and sorry OP for riding your post, hope the link helped you. Admin if you could post me a link to start a new thread that would be great 🙂 Thank you

    #231678
    delphy69
    Participant

    Hi,

    I will try to explain my problems, sorry I am french and I dont spaeck english as well.

    I find budypress this week, and It seems to be a good solution for my company.
    We would like to build a website, where some external employees can be registred and fill a form with their skills.
    By budypress, I find the way to create this plateform.

    In the same time, we must surch an external consultant. I have install the BP search profil, and it works good.

    All will be fine, but I would like that this external consultants will not be able to see other profiles.

    Is it possible to forbidden the access of the members profils to them ? only the administrator will have the right to see and surch all members, for exemple.

    Thanks for all your help

    #231282
    shanebp
    Moderator

    This will hide fields on the profile edit page and on the register page.
    You need to add the field IDs.
    Put the function in bp-custom.php.

    function oazar_hide_profile_fields( $retval ) {
    	
    	if( is_super_admin () )
    		return $retval;
    
    	if(  bp_is_profile_edit() || bp_is_register_page() )
    		$retval['exclude_fields'] = '3';	//field ID's separated by comma
    
    	return $retval;
    
    }
    add_filter( 'bp_after_has_profile_parse_args', 'oazar_hide_profile_fields' );
    #231214
    shayne
    Participant

    I figured it out. For some reason WordPress decided it would be a good idea to hide custom menus added to the toolbar(when did they change the name from admin bar?) when viewing it on mobile devices.

    If you browse through the WordPress directory you will find the css for the toolbar in wp-includes\css\admin-bar.css.

    This line hides everything but the default items from the toolbar.

    	/* Show only default top level items */
    	#wp-toolbar > ul > li {
        		display: none;
    	}

    By changing “display: none” to “display: block”. That fixed the problem i was having.

    So hopefully that information is useful to someone.

    Oh and one more thing. If you need to modify the toolbars css don’t do it there. You shouldn’t modify WordPress’s core files. Instead you should copy that css to your themes style sheet.

    #230995
    Anonymous User
    Inactive

    Hi @danbp asked me about this.. So here’s a way to hide the tabs

    
    function turker_remove_group_admin_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(
    		'group-avatar' => 1,
    		'delete-group' => 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 );
    	}
    
    	// You may want to be sure the user can't access
    	if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) {
    		bp_core_add_message( 'Sorry buddy, but this part is restricted to super admins!', 'error' );
    		bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) );
    	}
    }
    add_action( 'bp_actions', 'turker_remove_group_admin_tab', 9 );
    #230896
    webplayer
    Participant

    I am not a coder, but I’m looking for a snippet that can do this:

    Add Function: Change Admin Bar Login and Register Links
    
    if user is logged out
    
    Remove WordPress/buddypress admin bar Login and Register links
    
    Add New Login and Register Links
    
    New Login Link: <a data-reveal-id="tmpl_reg_login_container" href="javascript:void(0);" onclick="tmpl_login_frm();">New Login Link</a>
    
    New Register Link: <a data-reveal-id="tmpl_reg_login_container" href="javascript:void(0);" onclick="tmpl_registretion_frm();">New Register Link</a>
    
    if user is logged in don't do any of the above (i.e.) show their buddypress username and hide register links, etc...
    

    Does anyone know how to make this happen in code that I can drop into functions.php or bp-custom.php

    #230854
    shayne
    Participant

    When viewing my site on a mobile device, or shrinking the browser window, the admin bar hides the notifications bubble and custom menus I have added.

    Where would I find the css that is affecting the display of the admin bar when viewed with low screen resolutions?

    #230718
    danbp
    Participant

    Hi @amic58, @tecca

    When BP is installed and xProfile is activated, the original WP profile settings are not accessible to user.

    The WP register process use only username, password and email and BuddyPress add by default a Name field as base for other extended profile fields.

    In short this means that username and name fields can contain a same information(a name, a pseudonym, a first or/and a last name). The plugin you mention is best for a WP install where user had choosen first/last name as output on post, comments, etc Once BP is activated, this became a little different.

    Now to the initial question.
    The CSS trick is a very inelegant solution as it lets everybody knowing how BP works to surround this invisibility. You’re also loosing any flexibility if you want to show some fields privately for example.

    You can do this properly with a little snippet, as explained here:

    Using bp_parse_args() to filter BuddyPress template loops

    Here’s an example which let you hide fields or fiels group to members, but not to site admin

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

    Add it to bp-custom.php or your child-theme functions.php

    Of course you can also choose to show a field or group, but remove the possibility for the user to edit it later. Simply add more conditionnal to the function.

    Here another example:

    function bpfr_hide_profile_edit( $retval ) {	
    	// remove field from edit tab
    	if(  bp_is_user_profile_edit() ) {		
    		$retval['exclude_fields'] = '54'; // ID's separated by comma
    	}	
    	// allow field on register page
    	if ( bp_is_register_page() ) {
    		$retval['include_fields'] = '54'; // ID's separated by comma
    		}		
    	
    	// hide the field on profile view tab
    	if ( $data = bp_get_profile_field_data( 'field=54' ) ) : 
    		$retval['exclude_fields'] = '54'; // ID's separated by comma	
    	endif;	
    	
    	return $retval;	
    }
    add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );

    Hope to be clear.

    #230302
    Emineminero
    Participant

    Hi, i’m on wordpress 4.0.1 and buddypress 2.1.1 and i’m having this issue, when i configure the pages “Registration” and “activate” none of them work, they are always empty. Searching in google i found out that i’m not the first one experiencing this issue, but i didn’t find a solution so here i am, any ideas what can i do?
    List of plugins:
    add actions and filters
    ajax event calendar
    akismet
    plugin update
    antispam bee
    ap gravatars
    autoblog
    average head footer code
    bbpress
    bbpress search widget
    bienvenido nuevo partner
    bienvenido nuevo usuario
    buddypress
    buddypress group email subscription
    chimpy lite mailchimp wordpress plugin
    contact form 7
    contact form 7 autoresponder addon plugin
    contact form db
    custom author link
    custom login
    cw image optimizer
    default featured image
    easy modal
    edit author slug
    email before download
    email login
    export user data
    featured image in rss feed
    featured images in rss w size and position
    feedburner email subscription
    fix rss feeds
    global hide toolbar
    global hide toolbar bruteforce
    google analytics by yoast
    hello dolly
    hungryfeed
    invite anyone
    mailchimp
    menu exporter
    multisite bulk user management
    multisite user management
    network username
    nice login widget
    p3 plugin performance profiler
    php code widget
    really simple captcha
    redirection
    revive old post former tweet old post
    share buttons by addtoany
    shortcodes ultimate
    simple login log
    social login
    spider catalog
    swiftype search
    syntaxhighlighter evolved
    unconfirmed
    under cons uction
    user activation keys
    user meta shortcodes
    videojs pro
    widget importer exporter
    widgetize pages light
    wiki
    wordfence security
    wordpress download monitor
    importador de wordpress
    wordpress move comments
    wordpress seo
    wp biographia
    wp custom admin bar
    wp facebook open graph protocol
    wp no category base wpml compatible
    wp nofollow post
    wp smtp
    wptouch mobile plugin

    robertosalemi
    Participant

    Wordpress 4.0
    buddyPress 2.1.1

    Hi,
    in admin toolber, I would disable the section about buddyPress, I detected it by css code:
    ul#wp-admin-bar-my-account-buddypress.

    Can I hide it?

    Thanks.

    #229193
    shanebp
    Moderator

    Assuming the user_id for the admin is 1, try this:

    function infok_exclude_users($qs=false,$object=false){
        //list of users to exclude
         $excluded_users = '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']))
            return $qs;
        
        if(!empty($args['exclude']))
            $args['exclude']=$args['exclude'].','.$excluded_users;
        else 
            $args['exclude']=$excluded_users;
          
        $qs=build_query($args);
         
       return $qs;   
    }
    add_action('bp_ajax_querystring','infok_exclude_users',20,2);
    #229192
    Pamela
    Participant

    How do I remove admin which is the site administrator from http://ibsregister.com/members/ please

    I tried

    
    function custom_bp_core_get_users($users, $params) {
    
    		$users_ids_to_hide = array(1);
    
    		if (isset($users['users'])) {
    			foreach($users['users'] as $user_idx => $user) {
    				if (in_array($user->ID, $users_ids_to_hide) !== false) {
    					unset($users['users'][$user_idx]);
    				}
    			}
    			$users['users'] = array_values($users['users']);
    			$users['total'] = count($users['users']);
    		}
    
    		return $users;
    	}
    	add_filter( 'bp_core_get_users', 'custom_bp_core_get_users', 10, 2 );
    

    But I only end up with 19 instead of 40 members.

    Thanks

Viewing 25 results - 326 through 350 (of 915 total)
Skip to toolbar