/** * Use the above is_() functions to output a body class for each possible scenario * * @param array $wp_classes * @param array $custom_classes Optional * @return array Body Classes * @since Achievements (3.0) */ function dpa_body_class($wp_classes, $custom_classes = array()) { $achievements_classes = array(); // Archives if (dpa_is_achievement_archive()) { $achievements_classes[] = dpa_get_achievement_post_type() . '-archive'; } // Components if (dpa_is_single_achievement()) { $achievements_classes[] = dpa_get_achievement_post_type(); } // Does the user have any pending notifications? if (dpa_user_has_notifications()) { $achievements_classes[] = 'achievement-notifications'; } // Clean up // Add achievements class if we are on an Achievements page if (!empty($achievements_classes)) { $achievements_classes[] = 'achievements'; } // Merge WP classes with Achievements classes $classes = array_merge((array) $achievements_classes, (array) $wp_classes); // Remove any duplicates $classes = array_unique($classes); return apply_filters('dpa_body_class', $classes, $achievements_classes, $wp_classes, $custom_classes); }
/** * Backwards compatibility with pre-3.5: print the old-style notifications for the current user to the page footer. * * Notifications were overhauled in version 3.5 and were replaced with the heartbeat-powered "live notifications" system. * This function used to be called "dpa_print_notifications". * * @deprecated Achievements (3.5) * @since Achievements (3.0) */ function dpa_deprecated_print_notifications() { // If user's not active or is inside the WordPress Admin, bail out. if (!dpa_is_user_active() || is_admin() || is_404() || !dpa_user_has_notifications()) { return; } // Get current notifications $notifications = dpa_get_user_notifications(); if (empty($notifications)) { return; } echo achievements()->shortcodes->display_feedback_achievement_unlocked(); }