Support » Plugin: GamiPress » How can users claim achievements themselves?

  • Resolved pyoil

    (@pyoil)


    How do I give the option to users to click on a button to mark or unmark a quest as complete? I guess quests equivalent in is achievement in gami press.

    I want to create quests that the user can mark as complete to get points. I have seen this being done in a fitness website nerdfitness.com where there are quests like to measure different parts of your body or do 10 push-ups for 10 days. Once the user does that, they should be able to click a button and complete the quest. They can also unmark a quest that they have previously marked as complete.

    My website will not validate if they have completed the quest and the user is personally accountable for any of the quests they mark or unmark as complete. As they complete quests, they get XP and increase in level.

    How do I create this kind of gamification system with Gamipress?

    Here are the images of this functionality from Nerdfitness
    2019-10-07_1911
    2019-10-07_1913
    2019-10-07_1916

    • This topic was modified 3 months, 2 weeks ago by pyoil.
    • This topic was modified 3 months, 2 weeks ago by pyoil.
    • This topic was modified 3 months, 2 weeks ago by pyoil.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author rubengc

    (@rubengc)

    Hi @pyoil

    Actually there isn’t any add-on that brings you this functionality

    Probably, a way you can accomplish it is through our Link add-on that you can check here:
    https://wordpress.org/plugins/gamipress-link/

    This add-on gives you the ability to place links and to configure achievements that can be earned by clicking this link

    So in this way you can make unique links for each achievement and configure each achievement to be earned by clicking it’s link

    Hope it helps

    Best regards

    Thanks. I think I can make this work.

    I see how the user can click a button and give themselves the achievement. However, when I create the achievement, I don’t see a way I can make the user automatically revoke the achievement.

    I want the user to be able to give or revoke achievements themselves.

    How do I achieve the revoke achievement functionality in Gamipress? If this feature does not exist, I am open to using a custom PHP that will do this.

    Also to display the right toggle button to give and revoke achievement, I am creating a shortcode that displays text inside a shortcode depending on whether the user has or does not have the achievement. So I have two shortcodes one to show the button to revoke the achievement and one to hide the button to get the achievement I will pass the post id of the achievement in the shortcode.

    Revoke button will show when the user has the achievement.
    [gamipress_show has_achievement = "custompostid4231"]Show Button To Revoke Achievement [/gamipress_show]

    Get button will be hidden when the user has the achievement.
    [gamipress_hide has_achievement = "custompostid4231"]Show Button To Get Achievement [/gamipress_hide]

    This is the PHP I have so far to create this shortcode. I need help replacing i_need_help_with_gamipress_function below with the appropriate function that will check if the user has achievement for the custompostid I pass in the shortcode:

    
    add_shortcode( 'gamipress_show', 'gamipress_show_shortcode' );
    function gamipress_show_shortcode($atts = [], $content = null, $tag = '')
    {
        // normalize attribute keys, lowercase
        $atts = array_change_key_case((array) $atts, CASE_LOWER);
    
        // start output
        $o = '';
    
        // start box
        $o .= '<div class="wcr-box">';
    
        $current_user = wp_get_current_user();
    
        if ( i_need_help_with_gamipress_function ) {
            // enclosing tags
            if (!is_null($content)) {
                // secure output by executing the_content filter hook on $content
                $o .= apply_filters('the_content', $content);
            }
    
        } else {
            // User does not have achivement
        }
        // end box
        $o .= '</div>';
    
        // return output
        return $o;
    }
    

    Thank you in advance for all the help

    • This reply was modified 3 months, 2 weeks ago by pyoil.
    • This reply was modified 3 months, 2 weeks ago by pyoil.
    Plugin Author rubengc

    (@rubengc)

    Hi @pyoil

    Sorry, we can’t provide support about custom code or customizations

    Also, a similar shortcode (to show and also to hide) can be found in our Restrict Content add-on that you can check here:
    https://gamipress.com/add-ons/gamipress-restrict-content/

    Best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.