Home › Forums › Calendar Products › Events Calendar PRO › Press Permit Pro (and basic) conflict with The Events Calendar (Modern Tribe)
- This topic has 15 replies, 2 voices, and was last updated 11 years, 10 months ago by
Barry.
-
AuthorPosts
-
June 19, 2014 at 4:18 pm #236404
websherpa
Participant…revisited. I don’t believe that the “potential” solutions given on this forum are really the solution, as in both cases they are suggesting workarounds disabling the permissions functionality of PressPermit in order to fix what appears to be a bug in the AJAX / Javascript handling of a data change in an unrefreshed browser window of The Events Calendar.
In my case have the same results with the latest Chrome, and Safari on the Mac.
I’ve isolated a minor (albeit annoying because it’s a show stopper) conflict between Press Permit Pro 2.1.45 and The Events Calendar 3.6.1 and WordPress 3.9.1 (Custom Theme). I used Theme and Plugin testing procedure to isolate and confirm that the issue ONLY happens when Press Permit Pro 2.1.45 is Activated and the Core Settings for Filtered Post Types (Modify Permissions) includes “Events” which is the TEC custom post type. The problem occurs in default Themes as well, so it is not a result of the theme in use.
The fault occurs when a user is NOT logged in, or logged in to the site with any privileges OTHER than Administrator, and only that Press Permit is Activated and “Events” is a selected Post Type for filtering (which should be a viable option to enable the calendar to show private events to “some” PP Groups and not others).
What happens is that when landing on or refreshing a Monthly Event Calendar, all the events show up properly and are correctly filtered by Press Permit.
However, if one uses the “month forward / backward” navigation links to view a new month, NONE of the events (no matter what permissions they have) will show (unless the user is logged in with Administrator privileges). (I believe TEC uses AJAX / Javascript to refresh the calendar in place.)
If the screen is refreshed (by the web browser Reload), the Events will show again (no matter whether logged out, in, or user level). This occurs in multiple browsers on a Mac.
The site is http://www.campwaterdown.com and the Calendar http://www.campwaterdown.com/events/
PPCore is essential to how we use the site, The Events Calendar is just beginning to be used heavily, but the conflict is especially annoying.
Any ideas if there is an issue or suggestion from Tribe’s side that can address this (it is the PP Plugin that causes the conflict, TEC works properly with any other of our plugins activated, but still, TEC should work as other Custom Post Types do with PP’s sophisticated Group Permissions management and it seems like a conflict in the way the calendar is refreshed using the AJAX routine)?
Please let me know if there is any additional information or access I can provide.
Thank you,
Wayne Powell
June 20, 2014 at 7:10 am #238167Barry
MemberIt sounds like perhaps Press Permit is filtering queries in a way that conflicts with our own filtering of those same queries. Though I can’t unfortunately offer any guarantees about fixing this, I’d be more than happy to take a quick look.
Can you provide access to an up-to-date copy of that plugin?
June 20, 2014 at 7:21 am #238198websherpa
Participant(Keep in mind that the two work cooperatively together and do the CORRECT filtering in all cases EXCEPT when you use the “Previous Month” “Next Month” links in the Calendar view. Something about the way the data is reloaded during that process is different than during an original page load or refresh.)
I am happy to provide FTP access to a development version of the site in question so you can access the code directly, or if you would like me to forward a copy of the plugin, just provide me with an email address.
June 20, 2014 at 9:32 am #238484websherpa
ParticipantThis reply is private.
June 20, 2014 at 10:02 am #238559Barry
MemberYes, it is safe to share credentials by private reply (and we anyway remove them from the forum once we’ve got them for an added layer of protection) – however we’d rather you simply upload a copy of the plugin somewhere and share the link (whether via your own website or Dropbox or whatever – and again, you could share the link privately) as we prefer not to access customer sites by FTP unless there is a really overwhelming reason to do so.
Thanks!
June 20, 2014 at 10:15 am #238578websherpa
ParticipantThis reply is private.
June 24, 2014 at 8:58 am #247327Barry
MemberSo you might need to further refine this (it is, admittedly, a bit of a hack) but it might serve as a functional workaround, or at least the basis of one:
add_action( 'init', 'pp_events_helper', 5 ); function pp_events_helper() { if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) return; if ( ! isset($_POST['tribe_calendar'] ) ) return; $GLOBALS['pagenow'] = '__PP_EVENTS_HELPER__'; add_filter( 'pp_nofilter_uris', 'pp_events_add_nofilter_uri' ); } function pp_events_add_nofilter_uri( $uris ) { $uris[] = '__PP_EVENTS_HELPER__'; return $uris; }I’m not massively familiar with Permit Press Core but there didn’t seem to be any particularly more graceful ways of accomplishing this – though I could easily be missing something. In any case, if you can add that to your theme’s functions.php file hopefully it will alleviate the problem.
Thanks!
June 24, 2014 at 1:18 pm #248067websherpa
ParticipantUnfortunately that didn’t work for me (no change in behaviour that I can detect).
The only thing I can think of, off-hand, is forcing a page refresh when clicking those next/prev month links. If you Open As New Tab the next/prev month links, then it will force a refresh and the filtered events appear.
Unfortunately I don’t know how to modify the code for the links to make that happen.
June 24, 2014 at 2:07 pm #248168websherpa
ParticipantSeems a little silly to do, but modifying the Plugin code like this with Javascript onclick function to force a page reload does fix the problem for me (but takes twice as long to load a calendar, of course):
File: the-events-calendar/public/template-tags/month.php
Starting at Line241
/**
* Display an html link to the previous month. Used in the month navigation.
*
* @return void
* @author Jessica Yazbek
* @uses tribe_get_previous_month_text()
* @since 3.0
**/
function tribe_events_the_previous_month_link() {
$url = tribe_get_previous_month_link();
$date = TribeEvents::instance()->previousMonth( tribe_get_month_view_date() );
$text = tribe_get_previous_month_text();
$html = '<span>«</span> '. $text .' ';
echo apply_filters('tribe_events_the_previous_month_link', $html);
}/**
* Display an html link to the next month. Used in the month navigation.
*
* @return void
* @author Jessica Yazbek
* @uses tribe_get_next_month_text()
* @since 3.0
**/
function tribe_events_the_next_month_link() {
$url = tribe_get_next_month_link();
try {
$date = TribeEvents::instance()->nextMonth( tribe_get_month_view_date() );
$text = tribe_get_next_month_text();
$html = ''. $text .' <span>»</span>';
} catch ( OverflowException $e ) {
$html = '';
}
echo apply_filters('tribe_events_the_next_month_link', $html);
}
I realize that modifying the parent code isn’t a good idea, but I throw this out there because it illustrates my issue (and a relative solution).
June 24, 2014 at 2:09 pm #248172websherpa
ParticipantOops, my guess at the forum’s code tag didn’t work properly or it’s filtered, here’s the code again untagged:
/**
* Display an html link to the previous month. Used in the month navigation.
*
* @return void
* @author Jessica Yazbek
* @uses tribe_get_previous_month_text()
* @since 3.0
**/
function tribe_events_the_previous_month_link() {
$url = tribe_get_previous_month_link();
$date = TribeEvents::instance()->previousMonth( tribe_get_month_view_date() );
$text = tribe_get_previous_month_text();
$html = ‘<span>«</span> ‘. $text .’ ‘;
echo apply_filters(‘tribe_events_the_previous_month_link’, $html);
}/**
* Display an html link to the next month. Used in the month navigation.
*
* @return void
* @author Jessica Yazbek
* @uses tribe_get_next_month_text()
* @since 3.0
**/
function tribe_events_the_next_month_link() {
$url = tribe_get_next_month_link();
try {
$date = TribeEvents::instance()->nextMonth( tribe_get_month_view_date() );
$text = tribe_get_next_month_text();
$html = ‘‘. $text .’ <span>»</span>‘;
} catch ( OverflowException $e ) {
$html = ”;
}
echo apply_filters(‘tribe_events_the_next_month_link’, $html);
}June 24, 2014 at 2:10 pm #248176websherpa
Participantok, never mind, the forum filters the link HTML.
essentially I am adding onclick=”location.reload();” to the $html=
June 24, 2014 at 2:33 pm #248216Barry
MemberHmm, shame that didn’t work – it did for me locally – but there could be other factors at play.
Sorry also about your troubles when trying to share code. Regrettably the forum isn’t currently well equipped for this and its far better to share code by linking to it on Pastebin, Gist or some similar service.
Generally we don’t recommend altering core code but so long as you understand the risks and you feel comfortable taking that route you’re certainly welcome to. What would be awesome, though, is if Press Permit had a hook to selectively turn off its filtering of queries (and perhaps there is one and I simply missed it) … so it could be worth talking to them about that.
June 24, 2014 at 9:49 pm #249043websherpa
ParticipantThank you for all the time on this.
Don’t I want Press Permit to filter it’s queries? (Isn’t that the point of Press Permit, to filter Posts and Custom Post Types by User / Group Filters?) or am I misunderstanding the use of terms (sorry I am not a hardcore WP coder, only glancingly familiar with the mechanics of it).June 25, 2014 at 6:30 am #249962Barry
MemberSimilarly, remember I’m not massively familiar with Press Permit – we have to dive into many different plugins and themes in the course of providing support and we just can’t be intimately familiar with them all 🙂
I understood the problem from your point of view though to be that the public could not see events when they page forwards/backwards in month view – and my snippet was basically a crude attempt to trick Press Permit into not running in those circumstances.
If that’s not ideal/doesn’t fully meet your needs (if for instance you are using Press Permit to restrict the events that members of the public can see) then the solution I outlined isn’t going to work for you. On the other hand, it shouldn’t impact anything except ajax calendar operations.
I hope that clarifies things a little – but, honestly, I think at this point if you need further assistance integrating both plugins you will either need to use the services of a suitable developer who can go into this in more depth (or perhaps seek help from the Press Permit authors).
June 25, 2014 at 2:41 pm #251039websherpa
ParticipantI appreciate this. Yes, I do need Press Permit to filter and restrict events based on Role or Group Membership (which Press Permit facilitates).
I have a feeling I will be stalemated going via Press Permit, although I am trying, because they will say “It works correctly and filters correctly when first loading a page, so the fault may lie in the method that TEC Pro uses to link to a Prev/Next Month view.”
I have a temporary work-around, I am forcing a browser refresh each time the Prev / Next month links are pressed. Unfortunately this takes double the loading time.
-
AuthorPosts
- The topic ‘Press Permit Pro (and basic) conflict with The Events Calendar (Modern Tribe)’ is closed to new replies.
