This topic has 9 replies, 3 voices, and was last updated 9 years by rudik2.

  • Author
  • #45680
     rudik2
    Participant

    Hi,
    i would like to sort members results by current points from mycred plugins. Here is tutorial:
    http://mycred.me/support/tutorials/buddypress-sort-members-by-current-balance/
    but in sweetdate theme this don’t working. Please help.

    I tested with other instalation with buddypress but without sweetdate and all working ok.

    #46123
     Laura
    Moderator

    Hello, where have you added this code?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #46343
     rudik2
    Participant

    I added this code in funcions.php files on the child theme.

    #46696
     Andrei
    Moderator

    Hi @rudik2,

    I would need access to your wp instalation to see what happens around there.
    Could you please leave me credentials to your wp-admin and a ftp user in a private reply ?

    Once I have those credentials I could give a look as soon as I can find some spare time.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #46700
     rudik2
    Participant
    This reply has been set as private.
    #47248
     rudik2
    Participant

    Hi,
    can you test it?
    Please help.

    #47663
     Andrei
    Moderator

    Hi @rudik2,

    Unfortunately we’ve been extremely busy with the latest major updates of buddypress and woocommerce.
    As you can understand, this is an issue more related to the mycred plugin and not to our theme, but as soon as I will find some spare time I’ll give a look at your theme integrity and see if the error comes from our side.

    Looking forward.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #48327
     rudik2
    Participant

    Andrei will be grate. I tested this code on the buddypress (without sweetdate) and all working ok. I think that problem is in sweetdate.

    #60043
     rudik2
    Participant

    Admins please help with that problem. Will be greate then members are display in MEMBERS SITE by current balance.
    Members maybe then will be more active on the site.

    #60510
     rudik2
    Participant

    In file members-loop.php is code to display members results:
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ). '&per_page='.sq_option('buddypress_perpage') ) ) : ?>

    In MyCred tutorial i read that i must paste this code in function.php to have option “SORT MEMBERS BY CURRENT BALANCE”:

    COPY CODE
    /**
     * Add Sort Members Option
     * @since 0.1
     * @version 1.0
     */
    add_action( 'bp_members_directory_order_options', 'mycred_pro_add_sorting_options' );
    function mycred_pro_add_sorting_options() { ?>
    <option value="points-asc">Points Balance (Ascending)</option>
    <option value="points-desc">Points Balance (Descending)</option>
    <?php
    }
    
    /**
     * Adjust BP User Query
     * @since 0.1
     * @version 1.0
     */
    add_action( 'bp_pre_user_query', 'mycred_pro_pre_user_query' );
    function mycred_pro_pre_user_query( $BP_User_Query ) {
    	// Only run this if one of our custom options is selected
    	if ( in_array( $BP_User_Query->query_vars['type'], array( 'points-asc', 'points-desc' ) ) ) {
    		global $wpdb;
    
    		// Adjust SELECT
    		$BP_User_Query->uid_clauses['select'] = "
    SELECT DISTINCT u.{$BP_User_Query->uid_name} as id 
    FROM {$wpdb->users} u 
    INNER JOIN {$wpdb->usermeta} um 
    	ON ( u.{$BP_User_Query->uid_name} = um.user_id )";
    
    		// Adjust WHERE
    		$BP_User_Query->uid_clauses['where'] = "WHERE um.meta_key = 'mycred_default'";
    
    		// Adjust ORDER BY
    		$BP_User_Query->uid_clauses['orderby'] = "ORDER BY um.meta_value+0";
    
    		// Adjust ORDER
    		$BP_User_Query->uid_clauses['order'] = ( $BP_User_Query->query_vars['type'] == 'points-asc' ) ? 'ASC' : 'DESC';
    	}
    }

    I would like to display MEMBERS result by MyCred points balance. I think that i must change something in members-loop.php file in this line? :
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ). '&per_page='.sq_option('buddypress_perpage') ) ) : ?>

    Please help with this.
    Regards,
    Tomasz

Viewing 10 posts - 1 through 10 (of 10 total)

The forum ‘Feature requests’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?