Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
  • in reply to: Custom member page Pagination problem (Ajax?) #44881
     davidvitorino
    Participant

    Sorry about first message saying only Hello!

    I am having a problem with 2 custom member list pages.

    http://www.careercoach.it/coach/
    http://www.careercoach.it/player/

    Those page filter members by WP role, and pagination is not working correctly, when you click page 2 on the pagination links, it works, but when you click the previous button link or page 1 link, it stays on the same page.

    Pagination is working correctly on the main member page though.
    http://www.careercoach.it/members/

    I have already tried to disable non theme plugins, but did not solve the problem.

    here is some of the code that i use on the coach member page:

    COPY CODE
    <?php do_action( 'bp_before_members_loop' ); ?>
                
    <?php if ( bp_has_members( bp_ajax_querystring( 'members') . '&exclude=' .bp_exclude_users_but_coach() . '&per_page=' . sq_option('bp_members_perpage', 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' ); ?>

    and here is the code i use on child theme functions.php:

    COPY CODE
    <?php
    /**
     * @package WordPress
     * @subpackage Kleo
     * @author SeventhQueen <themesupport@seventhqueen.com>
     * @since Kleo 1.0
     */
    
    /**
     * Kleo Child Theme Functions
     * Add custom code below
    */ 
    
    function remove_nav_items() {
        bp_core_remove_nav_item( 'forums' );
        bp_core_remove_nav_item( 'groups' );
        //bp_core_remove_nav_item( 'notifications' );
        //bp_core_remove_subnav_item( 'profile', 'change-avatar' );
    }
    add_action( 'bp_setup_nav', 'remove_nav_items');
    
    function pc_get_userrole ($user_id) {
    
    $user = new WP_User($user_id);
    
    $userclean = $user->roles[0];
    
    return $userclean;
    
    }
    
    // aggiunge colonne backend - utenti
    
    function cc_modify_user_table( $column ) {
        $column['RuoloScelto'] = 'Ruolo Scelto';
    
        return $column;
    }
    
    add_filter( 'manage_users_columns', 'cc_modify_user_table' );
    
    // popola la nuova colonna
    
    function cc_modify_user_table_row( $val, $column_name, $user_id ) {
        $user = get_userdata( $user_id );
        
        switch ($column_name) {
            case 'RuoloScelto' :
                return xprofile_get_field_data( 'Tipo di profilo', $user_id); //$user->user_url;
                break;
    
            default:
        }
    
        return $return;
    }
    
    add_filter( 'manage_users_custom_column', 'cc_modify_user_table_row', 10, 3 );

    Also here is my bp-custom.php file:

    COPY CODE
    <?php
    
    /*
    add_filter( 'bp_registration_needs_activation', '__return_false' );
    
    function register_role($user_id) {
        $user_role = strtolower(xprofile_get_field_data('Tipo di profilo', $user_id));
        switch($user_role) {
    
            case "Player":
                $new_role = 'player';
                break;
            case "Coach":
                $new_role = 'coach';
                break;
            case "Senior Coach":
                $new_role = 'seniorcoach';
                break;        
    
        }
        wp_update_user(array(
            'ID' => $user_id,
            'role' => $new_role
        ));
    }
    add_action( 'user_register', 'register_role');
    */
    
     
    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;
    }
    
    // toglie link dalle voci profilo
    function remove_xprofile_links() {
        remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    }
    add_action( 'bp_init', 'remove_xprofile_links' );
    
    /**
     * Change BuddyPress default Members landing tab.
     */
    define('BP_DEFAULT_COMPONENT', 'profile' );
    
    function cc_change_profile_tab_order() {
    global $bp;
    
    $bp->bp_nav['profile']['position'] = 10;
    $bp->bp_nav['activity']['position'] = 20;
    //$bp->bp_nav['friends']['position'] = 30;
    $bp->bp_nav['groups']['position'] = 40;
    //$bp->bp_nav['blogs']['position'] = 50;
    $bp->bp_nav['messages']['position'] = 60;
    $bp->bp_nav['settings']['position'] = 70;
    }
    add_action( 'bp_setup_nav', 'cc_change_profile_tab_order', 999 );
    
    ?>

    Sorry for the long post.

Viewing 1 post (of 1 total)

Log in with your credentials

Forgot your details?