Home › Forums › Calendar Products › Events Calendar PRO › Using swpm partial protection
- This topic has 7 replies, 3 voices, and was last updated 6 years, 1 month ago by wrcmc.
-
AuthorPosts
-
March 19, 2018 at 10:07 am #1483112wrcmcParticipant
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 ?
March 20, 2018 at 1:38 pm #1484324AndrasKeymasterHey 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,
AndrasMarch 20, 2018 at 3:58 pm #1484459wrcmcParticipantHi 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
March 20, 2018 at 10:45 pm #1484586MathewParticipantwrcmc,
I haven’t tested this one in a while, but it should still work.
Hope this helps.
March 21, 2018 at 1:55 am #1484628AndrasKeymasterHey 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.
March 21, 2018 at 9:18 am #1484943wrcmcParticipantThe updates suggested in Mathew’s link worked.
Thanks for your help.
Regards
Dan
March 22, 2018 at 3:54 am #1485723AndrasKeymasterThat’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,
AndrasPS: 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/ -
AuthorPosts
- The topic ‘Using swpm partial protection’ is closed to new replies.