mycred_give
Description
This shortcode allows you to give your users points when this shortcode is rendered. These points are created “out of thin air and not from a specific account / user. You can insert this in page/post content or in a template file.
Available since version 1.1
Please be cautious with this shortcode. The shortcode will generate points by simply being viewed or run using the do_shortcode function. Users who can publish content without moderation on your website could abuse this by generating points in their content! You can use the mycred_give_run filter to stop the plugin from functioning if needed.
Shortcode Attributes
Attribute | Type | Required | Default | Description |
---|---|---|---|---|
amount |
int or float | Yes | - | The amount of points to give. |
user_id |
int or string | No | current user | The user to receive the points. Accepts either a numeric user ID or the keyword "current" for the current user viewing the shortcode. |
log |
string | Yes | - | The log entry template to use when users get points. |
ref |
string | Yes | "gift" | The reference to log the points under. |
limit |
int | Yes | 0 | The maximum number of times each user can gain points from this shortcode. Use zero for unlimited. |
type |
string | No | mycred_default | The point type to give. Should not be used if you only have one point type installed. |
CSS Styling
This shortcode does not return any stylable elements.
Examples
Example 1: Give the current user 10 points for viewing this page.
[mycred_give amount=10 log="Bonus points for reading our special article" ref="bonus_points"]