Forum Replies Created
-
AuthorPosts
-
in reply to: Problem with congrats license key #9216This reply has been marked as private.in reply to: Exclude Site Admin from Leader Board #9197
This isn’t heavily tested, but my head is saying it should work. Please test and let me know if you get the wrong results.
/** * Filter the update leaders function and conditionally undo addition of admins. * * @param $leaders Array of current leaders for the leaderboard * @param $leaderboard_id Leaderboard ID we are updating. * @param $original_leaders Array of original leaders before most recent addition. * * @return array */ function custom_exclude_admins_from_leaderboard( $leaders, $leaderboard_id, $original_leaders ) { // Grab all of our current site admins. $admins = new WP_User_Query( array( 'role' => 'Administrator' ) ); $admin_users = $admins->get_results(); $admin_ids = array(); // Loop over the admins to get an array of just their IDs. foreach ( $admin_users as $user ) { $admin_ids[] = $user->ID; } // Placeholder boolean to hold whether or not to update the leaderboard data. $should_update = false; foreach ( $leaders as $key => $leader ) { if ( in_array( $leader['user_id'], $admin_ids ) ) { // We found an admin being added to the leaderboard data. $should_update = true; } } if ( $should_update ) { // Since we just added an administrator, we need to re-set the leaderboard data to // the state it was previously at. update_post_meta( $leaderboard_id, '_badgeos_leaderboard_leaders', $original_leaders ); return $original_leaders; } return $leaders; } add_filter( 'badgeos_leaderboard_update_leaders', 'custom_exclude_admins_from_leaderboard', 10, 3 );
Gist version: https://gist.github.com/tw2113/fa6d3b6ca5260509f053
Should be fine to be added via your functions.php or if you want, a quick custom plugin.
in reply to: Exclude Site Admin from Leader Board #9196Looking into writing a sample snippet that works. I’m encountering unexpected issues, granted it’s not a simple plugin at times.
in reply to: Installing Leaderboard #9128Morning. I have just triggered a re-sent receipt, which should enable another download opportunity. If it’s still giving you troubles, let me know, and I’ll find another way to get you the files.
Thank you for your patience, and sorry for the troubles thus far.
in reply to: badges not showing up #9006Have you refreshed your permalink/rewrite rules yet? You can do that simply by visiting the permalinks settings page, and hit save without editing anything. Hope that fixes this.
in reply to: Leaderboard missing points #8998I can’t find anything obvious. For the example with homan’s profile, are all of those achievements earned by referral link?
I did notice that their user profiles are listing the right point total, and that’s what the leaderboard is querying for. So, to me that says the issue isn’t with the leaderboard, the issue is with how the achievements are being earned and what’s going on during the awarding process.
in reply to: Leaderboard missing points #8993Received, will try to look into it more later.
in reply to: Link leaderboard to 1 lesson or course? #8975Hi TJ,
I may be wrong, as I haven’t checked the source code that closely at the present moment, but I’m not sure we have that finite of detail available at the moment. Not saying it wouldn’t be possible, but it would need to be custom development work done.
in reply to: Leaderboard missing points #8958I may as well, since you’re willing. Please set up an account for michael@webdevstudios.com. I can’t guarantee I’ll determine the issue with it, but it’s more likely than I am now 😀
in reply to: Error – No access to * at this time #8957For your information, this page came from me: http://badges.lib.asu.edu/activity-code-redemption/
I managed to submit a couple activity codes and it awarded it to me each time. Maybe I’m missing the issue?
I did notice that some of those activity code certificates awarded me other things, which I found to be because it still had steps associated with other achievements. I forget if it was you or someone else that reported similar issues, but I know I have a bug ticket on GitHub for that topic.
Perhaps is there a specific certificate achievement that is proving troublesome with the activity codes?
in reply to: Error – No access to * at this time #8951Received and will aim to look into this later today.
Thanks Tammy.
It’s definitely possible to do, it’s just going to take some development time like you mention.
If they had helper functions that did directly what we need, I’d be able to amend what I typed up previously. However, we’re having to extract usernames from URLs to be used to fetch user IDs, and then also having to mess around with confirming whether or not a rendered page has used a shortcode, which is a bit messy.
Hrrm. Neither part is as simple as I was hoping for, to be honest.
Regex is never a simple thing, as far as I’m concerned. While the action provided is a nice touch, not as flexible as we need.
in reply to: Error – No access to * at this time #8937set up a user account for michael@webdevstudios.com. That’ll reach me.
in reply to: Widget not working/showing since WP4.3. – URGENT #8912Just pushed out a proper update for this one, so that everyone can benefit.
in reply to: Widget not working/showing since WP4.3. – URGENT #8908Awesome.
in reply to: Leaderboard missing points #8880So you know, I’m not ignoring this thread, I’m just not sure what’s going on at the moment. I can’t think of anything in the Leaderboard plugin that would limit point values. It should be fetching the whole value.
in reply to: Funky formatting in badge description #8875Welcome.
Not seeing what we need in their free “lite” version, and I don’t have access to the support for the full premium version.
I realize now I didn’t quite have the earlier code correctly, but we can amend that.
Could you contact their support and ask if they have a function available to fetch the numeral user ID of the current displayed user profile? We also need to know if they have any sort of boolean function that can be used to check if we’re on a ProfilePress user profile.
The user ID will be for fetching the displayed user’s achievements, and the last part will be so we can conditionally set it only when we’re needing to.
in reply to: Funky formatting in badge description #8855Figured out a hotfix for this and made a quick install-able plugin for you. Should be good until we can make amends to the core plugin to account for this.
-
AuthorPosts