Hello @rossfabio ,
Thanks for contacting us. Hope you are doing well.
This shortcode accepts only one parameter in based_on reference
[mycred_leaderboard based_on=”site_visit” total=1]
If you do it like [mycred_leaderboard based_on=”balance” total=1] then it will display leaderboard based on user balances.
Let me know if you have any questions. We will help you out.
Thanks & Regards,
WP Experts Support Team
Hi Daniyal thank you for taking the time to answer,
in /includes/classes/class.query-leaderboard.php on line 108 there is the following code to cope with multiple references separated by a comma
if ( $based_on != 'balance' ) {
$references = array();
if ( ! empty( $args['based_on'] ) ) {
foreach ( explode( ',', $based_on ) as $ref ) {
$ref = sanitize_key( $ref );
if ( strlen( $ref ) == 0 ) continue;
$references[] = $ref;
}
}
$this->references = $references;
$based_on = 'references';
}
$this->args['based_on'] = $based_on;
then on line 402
$reference_is = 'l.ref = %s';
$reference_values = $this->references[0];
if ( count( $this->references ) > 1 ) {
$reference_is = 'l.ref IN ( %s' . str_repeat( ', %s', ( count( $this->references ) - 1 ) ) . ' )';
$reference_values = $this->references;
}
and the query on line 426 is
if ( mycred_centralize_log() ) {
$query = $wpdb->prepare( "
SELECT DISTINCT l.user_id AS ID, SUM( l.creds ) AS cred
FROM {$mycred_log_table} l
WHERE {$reference_is} AND {$point_type_is}
{$time_filter}
{$exclude_user_filter}
GROUP BY l.user_id
ORDER BY SUM( l.creds ) {$this->order}, l.user_id ASC
{$this->limit};", $reference_values, $point_type_values );
}
so if the shortcode doesn’t parse multiple references queries there should be a function to call that does, can you point me in the right direction?
What i’m trying to do is filtering the points of a point type with different filters without having to create a thousand point types
For example, i organize events in different venues and users get points for attending, i need to be able to filter the points gained by event venue, type of event or both combined type and venue.
Hello @rossfabio ,
Thanks for sharing the details.
Currently, we do not have an option in mycred_leaderboard shortcode to pass multiple values in based_on attribute