Let’s to see how to configure achievements and ranks to let’s user unlock them by expending an amount of points.
Unlock an achievement with points
Configuring the points required
On the achievement edit screen you have the Achievement Data box that includes some useful options to configure the way an achievement will work. At bottom of this box you will see a toggleable option named Allow unlock with points.
Checking this option will display new fields letting you configure the points type and amount required for optionally unlocking this achievement with points.
On this example we are defining that users can optionally unlock this achievement by expending 100 credits.
Showing the unlock button
Now showing this achievement by the different methods provided by GamiPress (through shortcodes, widgets or on the achievement single page) will appear a button noticing that this achievement can be unlocked by an amount of points.
When user clicks on the unlock button he will get notified instantly about the result of this process (if is allowed to unlock this achievement or if he does not meets the required points).
Notes
User will earn the achievement but not their steps.
If the achievement has configured a congratulations text this text will shown on successfully unlock the achievement instead of the default text “Congratulations! You unlocked the {Achievement Type} {Achievement Title}.”.
If user does not meets the required amount of points or already has unlocked the achievement the maximum number of times allowed, the unlock button will not be shown.
Reach a rank with points
Configuring the points required
On the rank edit screen you have the Rank Data box that includes some useful options to configure the way a rank will work. At bottom of this box you will see a toggleable option named Allow reach with points.
Checking this option will display new fields letting you configure the points type and amount required for optionally reaching this rank with points.
On this example we are defining that users can optionally reach this rank by expending 100 gems.
Showing the unlock button
Now showing this rank by the different methods provided by GamiPress (through shortcodes, widgets or on the rank single page) will appear a button noticing that this rank can be reached by an amount of points.
When user clicks on the unlock button he will get notified instantly about the result of this process (if is allowed to reach this rank or if he does not meets the required points).
Notes
User will reach to this rank but not their requirements.
If the rank has configured a congratulations text this text will shown on successfully reach the rank instead of the default text “Congratulations! You reached the {Rank Type} {Rank Title}.”.
If user does not meets the required amount of points or already has reached the rank (or is in a higher rank priority), the unlock button will not be shown.
Confirmation
GamiPress 1.7.8.1 release introduces a confirmation message previously to the unlock process. You can preview it here:
This confirmation is active by default, if for some reason, you want to disable this, there is a code snippet that shows you what you need.