This topic has 9 replies, 2 voices, and was last updated 9 years by davidvitorino.
-
Author
Tagged: member's, ajax, pagination
-
February 5, 2015 at 23:57 #44881davidvitorinoParticipant
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.
February 6, 2015 at 00:34 #44882sharmstrModeratorDoes it work in a different theme?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
February 6, 2015 at 23:05 #45016davidvitorinoParticipantHello,
i have copied the page template to twentyfifteen theme, and got this error:
Fatal error: Call to undefined function sq_option() in /home/uklbiymd/public_html/wp1/wp-content/themes/twentyfifteen/page-player.php on line 102
Then i tried to add the kleo_framework folder and the functions in funtions.php to the twentyfifteen funtions.php.
Total crash!
Kleo has so many personalized functions that i cannot just “try the same code on different theme”.
I have attached the page template file to this message. Really hope you can help on this, as the site is live, and the problem arose only after we got members registering.
I’ve also atached the child theme functions.php, buddypress.php (edited line 99 to add page content to BP page) and the bp-custom.php that resides in plugin folder.
I have setup a test site with the same code on the same host, if you need access for testing i can provide.
Here is the link to the same page template (but with different member role) on test site.
http://wp1.kodeserver.net/player/Let me know, and thank you in advance
February 6, 2015 at 23:07 #45017davidvitorinoParticipantoops, trying to upload zip instead
Attachments:
You must be logged in to view attached files.February 6, 2015 at 23:21 #45020sharmstrModeratorWhen I first glanced at the code, all I saw was buddypress functions. I missed the one little bit of Kleo code which was sq_option.
Kleo has so many personalized functions that i cannot just “try the same code on different theme”.
Can you point out where in all of that code you are using Kleo functions other than sq_option?
As far as sq_options goes, you can replace that line with
COPY CODE'&per_page=' . sq_option('bp_members_perpage', 24)
with
COPY CODE'&per_page=24'
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
February 6, 2015 at 23:36 #45023davidvitorinoParticipantThank you for the quick answer.
You are right that function is the only KLEO one visible on the code.
I have made the changes and now there is no PHP error.Pagination is still broken though.
February 6, 2015 at 23:38 #45024sharmstrModeratorThat’s what I was trying to determine. Its not a Kleo issue. All of that is buddypress. You should ask over there.
I just wanted to make sure before I sent you over there. That’s all.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.