Okay
  Public Ticket #3738891
Hide subscribe button
Open

Comments

  •  2
    selinkocagoncu started the conversation

    Hello,

    I would like to hide the Subscribe button found on events to be visible+usable only to logged-in users. Is there a way to make this possible?

    Thank you


  •  852
    Zhivko replied

    Hi,

    1) Open your event template with the builder.

    2) Insert "Custom JS" element in the template. You can place it somewhere at the bottom.

    4420775295.png

     

    9616595219.png

    3) Open the Custom JS element settings by clicking on the cogwheel icon.

    8412339803.png

    4) In the JavaScript textarea place the following javascript code:

    (function () {
    
        const userId = STEC_VARIABLES?.current_user?.data?.id;
    
        if (!userId) {
            
            const elementToHide = document.querySelector('.stec-event-share-and-export-subscribe');
    
            if (elementToHide) {
                elementToHide.style.display = 'none';
            }
        }
    
    })();

    5224446060.png

    2116825314.png


    Stachethemes Developer

  •  2
    selinkocagoncu replied

    Thank you very much! I've just realized, would it be possible to do the same thing for the event Comments sections in STEC?

  •  2
    selinkocagoncu replied

    Or make it calendar-specific? So I would be able to set Calendar A as a no-comment calendar, to display before log in, and set Calendar B as the inside calendar..

  •  2
    selinkocagoncu replied

    Hello,

    Thank you very much, the subscribe buttons are now hidden for logged out viewers :) Could you help me do the same for Comments, please?

  •  852
    Zhivko replied

    You can do it via the template builder.

    Open your template.

    Click on the Row Section that wraps the Comments:

    6078385424.png

    Click on the cogwheel button to enter its settings.

    In the Conditions selector add: "Logged-in":

    9945749778.png

     


    Stachethemes Developer