, Ruben Garcia * @since 1.0.0 */ // Exit if accessed directly if( !defined( 'ABSPATH' ) ) exit; /** * Register GamiPress dashboard widget. * * @since 1.0.0 * @updated 1.4.8 Added network and user checks */ function gamipress_dashboard_widgets() { // Bail if GamiPress is active network wide and we are not in main site if( gamipress_is_network_wide_active() && ! is_main_site() ) { return; } // Bail if current user can manage GamiPress if( ! current_user_can( gamipress_get_manager_capability() ) ) { return; } wp_add_dashboard_widget( 'gamipress', 'GamiPress', 'gamipress_dashboard_widget' ); } add_action( 'wp_dashboard_setup', 'gamipress_dashboard_widgets' ); /** * GamiPress dashboard widget output. * * @since 1.0.0 */ function gamipress_dashboard_widget() { // Get our types $achievement_types = gamipress_get_achievement_types(); $points_types = gamipress_get_points_types(); $rank_types = gamipress_get_rank_types(); ?>

'date', 'order' => 'DESC', 'items_per_page' => 5, 'no_found_rows' => true, 'cache_results' => false, ) ); $user_earnings = $query->get_results(); if ( count( $user_earnings ) > 0 ) { echo '
'; echo ''; echo '' . esc_html__( 'View all user earnings', 'gamipress' ) . ''; echo '
'; } else { echo '

' . __( 'Nothing to show :)', 'gamipress' ) .'

'; } wp_reset_postdata(); }