100 points - 0.99 timestamp (later in life)
90 points - 0.10 (the earliest sap, but not a winner)
+ * #1820556: Don't show achievement popups if the overlay is active.
+
Achievements 7.x-1.5, 2012-05-01
--------------------------------
'storage' => 'comment-count',
'points' => 100,
'images' => array(
- 'unlocked' => '/sites/default/files/example1.png',
+ 'unlocked' => 'sites/default/files/example1.png',
// 'secret' and 'locked' will use the defaults.
),
),
'description' => t("Go back to bed: it's still the weekend!"),
'points' => 5,
'images' => array(
- 'unlocked' => '/sites/default/files/example1.png',
- 'locked' => '/sites/default/files/example2.png',
- 'secret' => '/sites/default/files/example3.png',
+ 'unlocked' => 'sites/default/files/example1.png',
+ 'locked' => 'sites/default/files/example2.png',
+ 'secret' => 'sites/default/files/example3.png',
// all default images have been replaced.
),
),
function achievements_block_info() {
return array(
'achievements_leaderboard' => array(
- 'info' => t('Achievements leaderboard'),
+ 'info' => t('Achievements: All-time leaderboard'),
'cache' => DRUPAL_NO_CACHE,
),
);
include_once(drupal_get_path('module', 'achievements') . '/achievements.pages.inc');
return array( // stupid file that I have to include. WHERE"S MY FUNCTION REGSITERYR.
'content' => achievements_leaderboard_block(),
- 'subject' => t('Leaderboard'),
+ 'subject' => t('All-time leaderboard'),
);
}
}
// we don't check for access as this is info grubbing only.
$achievers = &drupal_static(__FUNCTION__);
- $days = isset($days) && $days > 0 ? $days : 0;
+ $days = !empty($days) ? $days : 0; // used in array keys.
$day_frame = module_exists('achievements_recent') && $days > 0;
$leaderboard_table = $day_frame ? 'achievement_totals_days' : 'achievement_totals';
* Implements hook_page_alter().
*/
function achievements_page_alter(&$page) {
- if (achievements_user_is_achiever()) {
+ // Achievement popups won't show if the overlay is active, so we'll defer until it isn't.
+ // See http://drupal.stackexchange.com/questions/35382/hide-module-when-path-is-overlay.
+ if (achievements_user_is_achiever() && !(module_exists('overlay') && path_is_admin($_GET['q']))) {
$unlocks = db_select('achievement_unlocks', 'au')->fields('au', array('achievement_id', 'rank', 'timestamp')) // find everything we've yet to see.
->condition('uid', $GLOBALS['user']->uid)->condition('seen', 0)->orderBy('timestamp')->execute()->fetchAllAssoc('achievement_id', PDO::FETCH_ASSOC);
}
/**
+ * Implements hook_block_info().
+ */
+function achievements_recent_block_info() {
+ $blocks = array();
+
+ foreach (achievements_recent_valid_days() as $days => $days_human) {
+ // Can't use '_recent_' as it'll be too long for DB delta column.
+ // Ease your mind: block deltas feel the same as the tabbed URLs.
+ $blocks['achievements_leaderboard_' . $days . '_day'] = array(
+ 'info' => t('Achievements: @days_human leaderboard', array('@days_human' => $days_human)),
+ 'cache' => DRUPAL_NO_CACHE,
+ );
+ }
+
+ return $blocks;
+}
+
+/**
* Recalculate a user's stats based on the number of days.
*
* @param $uid