1. Documentation
  2. Shortcodes
  3. [gamipress_points]

[gamipress_points]

Output an user points balance.

Preview:

Attributes:

  • type – Single, or comma-separated list of, points type(s) to display. Accepts: all or any slug of any points type. Default: all
  • thumbnail – Display the points type featured image. Accepts: yes, no Default: yes
  • label – Display the points type label (singular or plural name, based on the amount of points). Accepts: yes, no Default: yes
  • current_user – Show points balance of current logged in user. Accepts: yes, no Default: no
  • user_id – Show only points earned by a specific user. Leave blank to show the site points (points sum of all users).
  • inline – Display the points inline (as text). Accepts: yes, no Default: no
  • period – Filter points balance based on a specific period selected. By default “None” that will display user or site current points balance. Accepts: today, yesterday, this-week, past-week, this-month, past-month, this-year, past-year and custom
  • period_start – Period start date. Leave blank to no filter by a start date (points balance will be filtered only to the end date). Accepts: Accepts any valid PHP date format. (More information).
  • period_end – Period end date. Leave blank to no filter by an end date (points balance will be filtered from the start date to today). Accepts: Accepts any valid PHP date format. (More information).
  • columns – Columns to divide each points balance. Accepts: 1, 2, 3, 4, 5, 6 Default: 1
  • layout – Layout to show the points. Accepts: left, top, right, bottom or none Default: left
  • wpms – Show points from all network sites.

Example:
[gamipress_points type="all" columns="3" thumbnail="yes" label="yes" user_id="1" layout="left"]

Showing site points

[gamipress_points] includes the ability to show the sum of all user’s points balances in your site (per type). The unique thing you need is don’t provide any user to the shortcode.

By default, [gamipress_points] shortcode sets the current_user attribute to no so if you don’t provide current_user and user_id attributes then the points shown will be based on the sum of all user points balances.

Example about show a sum of all users balances of all types (the sum will be separated by type):
[gamipress_points type="all"]

Example about show a sum of all users “credits” balances:
[gamipress_points type="credits"]

Points on a period

[gamipress_points] includes the ability to show the user’s points balance on a set of predefined periods. There are a few examples:

Points earned this week of all types:
[gamipress_points type="all" period="this-week"]
Credits earned past year:
[gamipress_points type="credits" period="past-year"]

In addition, you have the ability to define custom time periods if you set the period attribute to custom. There are a few examples:

Points earned last 10 day of all types:
[gamipress_points type="all" period="custom" period_start="10 days ago" period_end="today"]
Credits earned on year 2018:
[gamipress_points type="credits" period="custom" period_start="2018-01-01" period_end="2018-12-31"]

Check the date fields page for more information about formats supported on period_start and period_end attributes.

How can we help?