Using swpm partial protection

Home Forums Calendar Products Events Calendar PRO Using swpm partial protection

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1483112
    wrcmc
    Participant

    I am trying to use swpm partial protection in combination with Events Calendar.

    This uses a shortcode [swpm_protected]. The reason for using this is to protect specific details in the event text to be only available to logged in members. This works fine when accessing a single event directly however when listing via any other method the full text appears, or in the case of the month view the tooltip displays the full text.

    I can understand that you can’t test with all plugins but can you provide any pointers as to how I maybe able to modify the code to implement the restrictions.

    In the link below you will see that the event text has a message “Only registered users can view full rally details” but when you access any other via the protected text “£18 per unit per night, includes electric hookup” appears.

    Any pointers ?

    #1484324
    Andras
    Keymaster

    Hey wrcmc,

    Thanks for reaching out to us!

    I think I will be able to help you out with this.

    For the views (e.g. list view, month view) you could create template overrides and remove the sections that you do not want to show to the audience.

    You can find more details on template overrides in our Themer’s Guide – https://theeventscalendar.com/knowledgebase/themers-guide/

    You can remove the content, or you can implement some code found on the swpm docs page here.

    I hope this can get you started. Let me know if you need further assistance.

    Cheers,
    Andras

    #1484459
    wrcmc
    Participant

    Hi Andras,

    Thanks for information. It has been very informative.

    Using the Themer’s Guide as a basis I actually found a more straight forward method of getting swpm partial protection to work. In the file ‘the-events-calendar/src/functions/template-tags/general.php’ in the tribe_events_get_the_excerpt function there is the following piece of code

    /**
    * Allow shortcodes to be Applied on the Excerpt or not
    *
    * @var bool
    */
    $allow_shortcodes = apply_filters( ‘tribe_events_excerpt_allow_shortcode’, false );

    I found that by changing the setting to true the swpm shortcodes work.

    My only remaining question is where should I create the custom general.php file that I need ?

    Regards

    Dan

    #1484586
    Mathew
    Participant

    wrcmc,

    I haven’t tested this one in a while, but it should still work.

    https://theeventscalendar.com/support/forums/topic/change-excerpts-to-show-full-description/#dl_post-1139678

    Hope this helps.

    #1484628
    Andras
    Keymaster

    Hey Mathew, thanks for chiming in with that idea! Might work.

    @Dan, unfortunately it is not possible to create a template override for general.php. You would need to make the change in the core file itself, but you would lose the changes when a plugin update comes.

    Using the 2 filters Mathew referenced might do the trick though.

    It is only possible to create overrides for the files that are in the src/views folder and its subfolders.

    A.

    #1484943
    wrcmc
    Participant

    The updates suggested in Mathew’s link worked.

    Thanks for your help.

    Regards

    Dan

    #1485723
    Andras
    Keymaster

    That’s awesome! Happy to hear that did the trick!

    Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please create a new ticket and we’ll be happy to help.

    Cheers,
    Andras

    PS: We’d be grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Thanks!

    PS2: If you like our plugins, and you didn’t yet do so 🙂 we would also be happy to receive a review in the wordpress.org repository. Much appreciated!
    https://wordpress.org/support/view/plugin-reviews/the-events-calendar/
    https://wordpress.org/support/view/plugin-reviews/event-tickets/

     

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Using swpm partial protection’ is closed to new replies.