• Hello,
    The showonce option is not working correctly for me, it is only working on localhost. Do you have any idea why, I don’t have any clue !
    I had to do a crappy fix with js/css:

        let popupcustom = sessionStorage.getItem('custompopup');
        if(popupcustom==null){
            sessionStorage.setItem('custompopup', 'true');
        } 
        if(popupcustom=='true'){
           document.body.classList.add('hide-popup')
        } 

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author merbmerb

    (@merbmerb)

    Sorry, for the delayed reply, I just tested ‘show once’ on a live site and it seemed to work OK. Note it does use cookies so if they are blocked then it will not work.

    Can you provide some more info, are you looking to show once per page or per site and what parameters did you set to implement it?

    Thread Starter classikd

    (@classikd)

    Hello,

    Again I encounter the issue on an other website.
    Cookies are not disabled.
    Here is my modal config:
    <!-- wp:bod/modal-block {"title":"Promotion","showOn":"load","showOnce":"yes","noShowDays":"7","showCloseBtn":"yes","btnCloseLabel":"Fermer","btnCloseAlign":"right"} -->

    What is the name of the cookie ? I can’t see a cookie related to the plugin.
    Thank you

    Plugin Author merbmerb

    (@merbmerb)

    You should have a cookie called bodModalOnce

    Thread Starter classikd

    (@classikd)

    There is no such a cookie, I’ve tested in all browsers.
    I saw that the cookie is created if “loadOnce” is true, but I don’t have that “data-once” attribute as you can see, so “loadOnce” is always false (modal.js line 105):

    Plugin Author merbmerb

    (@merbmerb)

    OK so it seems the non-creation of the cookie is the problem. What OS are you using, do you have a page I can look at? I tested using your exact config and it worked fine on Windows 11 / Chrome.

    Plugin Author merbmerb

    (@merbmerb)

    Strange that code is pretty simple:

    } else if (attributes.showOn === 'load') {
         if (attributes.showOnce !== 'no') {
    	return (
    	    <span className = "bod-block-popup-trigger type_load" data-delay={attributes.showDelay} data-once={attributes.showOnce} data-id={attributes.modalId} data-days={attributes.noShowDays}></span>
    				);
         } else {
    	return (
    	   <span className = "bod-block-popup-trigger type_load" data-delay={attributes.showDelay}></span>
    					);					
    				}

    It looks like it thinks the showonce attribute = no for some reason. Can you try a test page that just contains a modal with nothing else and see if sets the data-once correctly

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Showonce not working’ is closed to new replies.