# gamipress/7.9.8/includes/widgets/earnings-widget.php

GamiPress – Gamification plugin to reward points, badges &amp; ranks in WordPress, now with AI, version 7.9.8. 48 lines.

- Page: https://pluginprobe.com/plugins/gamipress/7.9.8/code/includes/widgets/earnings-widget.php
- Raw: https://pluginprobe.com/plugins/gamipress/7.9.8/raw/includes/widgets/earnings-widget.php
- Modified: 2026-07-13T13:39:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gamipress/7.9.8/code/includes/widgets/earnings-widget.php#L10-L20`.

```php
<?php
/**
 * User Earnings Widget
 *
 * @package     GamiPress\Widgets\Widget\Earnings
 * @author      GamiPress <contact@gamipress.com>, Ruben Garcia <rubengcdev@gmail.com>
 * @since       1.3.9
 */
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;

class GamiPress_Earnings_Widget extends GamiPress_Widget {

    /**
     * Shortcode for this widget.
     *
     * @var string
     */
    protected $shortcode = 'gamipress_earnings';

    public function __construct() {
        parent::__construct(
            $this->shortcode . '_widget',
            __( 'GamiPress: User Earnings', 'gamipress' ),
            __( 'Display a list of user earnings.', 'gamipress' )
        );
    }

    public function get_tabs() {
        $tabs = GamiPress()->shortcodes[$this->shortcode]->tabs;

        // Add the widget title field to the general tab
        $tabs['general']['fields'][] = 'title';

        return $tabs;
    }

    public function get_fields() {
        return GamiPress()->shortcodes[$this->shortcode]->fields;
    }

    public function get_widget( $args, $instance ) {
        // Build shortcode attributes from widget instance
        $atts = gamipress_build_shortcode_atts( $this->shortcode, $instance );

        echo gamipress_do_shortcode( $this->shortcode, $atts );
    }
}
```
