• Resolved giovanniprior

    (@giovanniprior)


    Hello!

    I’ve been using your plugin in the last days in my website and i’ve set a list of achievement linked to the ID of different buttons.

    Problem is: some button triggers the achievement and some don’t. To make the broken button work i need to clean completely the cache of the browser, then they work again.

    Can you help me to understand how to fix this problem?

    thank you so much! Hope you’ll reply soon as i’ll have an event this saturday and i don’t know how to fix this by myself!

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Dioni Sánchez

    (@dioni00)

    Hi @giovanniprior

    Please make sure the events are set up correctly and do not have any limitations such as being limited to winning the event once per hour. Since you mention that some buttons work and others don’t

    On the other hand, if you have any caching plugin on your website, please disable it and check if the error persists.

    Best regards.

    Thread Starter giovanniprior

    (@giovanniprior)

    Hello Dionisio!!

    I’ve not set any limitations on these buttons, also because they can only be taken once in lifetime!

    Ah the Cache cleaner of the browser could be a problem? ok i’ll disable it and try immediately

    Thread Starter giovanniprior

    (@giovanniprior)

    Sorry to reply again, just to understand… i have WP fastest cache to clean the cache.

    Is it something that could relate with your suggestion?

    Thread Starter giovanniprior

    (@giovanniprior)

    i’ve done some more tests.

    It’s not depending on the cache plugin.
    My system works like this: users use my platform only via smartphone where they have done the login on their personal page; they join a live event and during the event they scan a qr code which leads them to a page with a specific button (and every button has a specific ID in it, linked to a specific achievement). Clicking the button brings users back to their home page, and unlocks an achievement which drives the visibility of information on their personal page. Sometimes i scan the QR CODE, i press the button, i go back to my homepage but the achievement is not unlocked. So i refresh the page and scan again and press the button again and sometimes it works; other time i’ve seen that in the backoffice i enter the setting of the achievement, saves the steps without changing anything and then i press the button again and it works.

    Would could it be? What triggers the logic of updating the achievement?

    Thank you for any help and support!!

    Plugin Author Dioni Sánchez

    (@dioni00)

    Hi @giovanniprior

    The Button event is fired using JavaScript. Detects when the button is clicked to launch the event. Please could you check if there is something blocking the GamiPress script? Could you also check if it happens to you from another browser?

    Thread Starter giovanniprior

    (@giovanniprior)

    mmm no luck
    and it appears to be somehow a random behaviour
    tested on edge and chrome on windows and same on iphone
    How can i check if something is preventing the javascript to run correctly? how can i debug the situation?

    Thread Starter giovanniprior

    (@giovanniprior)

    ok i found an error in consolle:

    (function($) {
    $('body').on('click', '.gamipress-button', function(e) {
    var $this = $(this);
    var type = $this.attr('type');
    var id = $this.attr('id');
    var classes = $this.attr('class');
    var form = $this.attr('form');
    var name = $this.attr('name');
    var value = $this.attr('value');
    var url = $this.data('url');
    var post = $this.data('post');
    var comment = $this.data('comment');
    $.ajax({
    url: gamipress_button.ajaxurl,
    method: 'POST',
    data: {
    action: 'gamipress_button_click',
    nonce: gamipress_button.nonce,
    type: type,
    id: id,
    class: classes,
    form: form,
    name: name,
    value: value,
    post: post,
    comment: comment
    },
    success: function(response) {}
    });
    if (url.length) {
    location.href = url
    }
    })
    }
    )(jQuery)

    gamipress-button.min.js?ver=1.0.5:1 Uncaught TypeError: Cannot read properties of undefined (reading ‘length’)
    at HTMLDivElement. (gamipress-button.min.js?ver=1.0.5:1:588)
    at HTMLBodyElement.dispatch (fjqom.js:3:39997)
    at v.handle (fjqom.js:3:37968)

    and also this:

    fjqom.js:3 POST https://habylon.com/wp-admin/admin-ajax.php 403 (Forbidden)
    [email protected]:3
    [email protected]:3
    (anonymous)@fjqom.js:7
    e.<computed>@fjqom.js:7
    (anonymous)@gamipress-button.min.js?ver=1.0.5:1
    [email protected]:3
    [email protected]:3

    may be of some help??

    Thank you!!!

    Thread Starter giovanniprior

    (@giovanniprior)

    ok, i think i have found the problem.
    My suggestion is that if the step to be done, set on the achievement settings, was to visit a specific post and then you change the step and set that the new rule is that system must be listening for a specific ID on a button (not a new rule but the same rule changed) i think that this thing makes the system angry

    Plugin Author Ruben Garcia

    (@rubengc)

    Hi @giovanniprior

    Glad to meet you were able to resolve this

    Something to take in count, did you placed the button using the shortcode/block/widget provided by our plugin or in a custom way?

    Since the JS error is talking about that one of the parameters does not exist

    Thread Starter giovanniprior

    (@giovanniprior)

    Hello Ruben!

    i set a standard wordpress (elementor) button setting:
    “CSS ID” as the same set in the achievement inside gamipress
    “CLASS CSS” as “gamipress-button”

    Plugin Author Ruben Garcia

    (@rubengc)

    Thanks @giovanniprior

    Its just to know how you placed the button to resolve the small error you found, this error is not a critical one and lets you work as normally but it’s just for our interest to have all our add-ons with 0 errors, even if they are a small ones

    Thread Starter giovanniprior

    (@giovanniprior)

    Glad i’ve helped ??

    i’ll have the event this weekend, i’ll let you know how it was! ??

    Thread Starter giovanniprior

    (@giovanniprior)

    Another question: is there any issue using safari on iphone? there should be any problem? is it different?

    Plugin Author Ruben Garcia

    (@rubengc)

    Hi @giovanniprior

    You should not face any issues in that browser, our scripts run correctly in all modern browsers and we keep some backward compatibility with the old ones

    Thread Starter giovanniprior

    (@giovanniprior)

    Hello!
    Just a quick update!

    The event went incredibly well and the customers were delighted!
    Just a side note: button trigger really is not reliable and i’m not able to understand the reason: there’s not a specific pattern, i’ve tested (on mobile) with all browsers and all devices but the results really are unpredictable. Sometimes it works, sometimes it does not, sometimes it works after two attempts, sometimes it does not work after ten attempts. So I radically changed the approach and took advantage of the integration with Forminator, creating a form without fields: the user would receive a trophy upon completion of a survey by clicking on the form button without any fields, being taken back to the homepage of the game but correctly triggering the achievement.

    Considering the experience I have accumulated with your amazing plugin, I think I will redo the site from scratch, going about creating the pages in a much cleaner and more essential way than I have done so far, installing only a few basic plugins in addition to yours (I use ultimate member to manage the players’ personal pages). I will let you know if maybe the situation improves this way.

    some side notes: the use of shortcodes was essential to make the management of the visibility of content, trophies and objects in the ‘inventory’ much quicker and easier; now my focus will be on two different functionalities: the possibility of joining two objects in the inventory (i.e. two achievements) by creating a third different one, and connected to this I will look for a way to remove an achievement from a player when he gets another one (now possible through the use of automatorWP, but for now I cannot afford other investments).

    I think that for the moment we can consider this topic close. Thank you for your support so far!

    Giovanni

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Sometime button only works cleaning the cache’ is closed to new replies.