Skip Navigation

[Resolved] Serious bug with All in one events calendar

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 10 replies, has 2 voices.

Last updated by Thorworx 6 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#515107

I am trying to:

I visited this URL: hidden link

I expected to see:

Instead, I got:

I’ve used AI1EC on many sites like this with no issues, but on a site I’m currently working on, AI1EC is injecting code into any/all Views loops – ONLY on a single event page:
hidden link
The headline is a view with post loop, and the sidebar is a view with a post loop.

Looking at the Views debugger, it shows the AI1EC code *within* the loops. I don't know how it's getting there

Any ideas on how to fix this?

I've posted to their support forum, but was wondering if any Types folk have seen this before.

#515205

Dear Thorworx,

I assume we are talking about this plugin download from:
https://wordpress.org/plugins/all-in-one-event-calendar/
It seems to be a compatibility problem between Views plugin and All in one events calendar, please describe detail steps to duplicate same problem, how do you setup the view, where and how I can see the AI1EC code?
I need to test and debug it in my localhost, thanks

#515258
wpv-ai1ec.png

Greetings Luo,

Steps to duplicate:

1) Install All in one events calendar plugin: https://wordpress.org/plugins/all-in-one-event-calendar/
2) Create an event in the calendar - event options don't matter, calendar plugin settings don't matter.
3) Create a post loop view. Choose ANY post type as the content for the query (posts, media, page, etc). Filters, limits and offset, and output options don't matter.
3a) Add created View to page with WP Views widget (any sidebar widget area).
4) View the event page in browser.

Result: Event html raw data is output within the wpv-loop. If you have more than one wpv-loop (View) on the page, it will output in ALL of them.

NOTE: Views debugger DOES NOT show the event in the query results section, or the returned post _objects but it shows the html data injection under Output (RAW)

AI1EC seems to be detecting ALL loops on the page for the event post type and outputting it's data inside any/all the loops on the page. It should ONLY be outputting inside the actual post content.

This ONLY occurs on single post (type=event) pages. It does not occur on the calendar page itself or any other page or post.

This definitely appears to be an AI1EC bug, and not a Types/Views bug.

#515641
event.JPG

Thanks for the details, I tried the steps you mentioned above in a fresh wordpress installation:
Views 2.3.1 + all-in-one-event-calendar 2.5.18 + Twenty Seventeen Theme, please correct me if there is anything missing:
For the step 3a) Add created View to page with WP Views widget (any sidebar widget area).
I assume you are talking about this:
Dashboard-> Appearance-> Widgets, add a "WP Views" widget into sidebar,

and test it in a single "Event" post, but I can not see same problem, see screenshot: event.JPG

And I suggest you check these in your website:
1) deactivate other plugins and switch to wordpress default theme, and test again
2) Enable PHP debug mode, copy and paste the debug logs here
PHP Debugging
In case you think that Types or Views are doing something wrong (what we call a bug), you should enable PHP error logging. Again, edit your wp-config.php file and add the following:

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
This will produce a file called ‘error_log.txt’ in your WordPress root directory. Make sure that the web server can create and write this file. If it cannot, use an FTP program to create the file and make it writable to Apache (normally, user www-data).
https://toolset.com/documentation/user-guides/debugging-types-and-views/

If the problem still persists, please provide a database dump file of your website, I need to duplicate same problem and debug it in my localhost. thanks

#515908
Screen Shot 2017-04-21 at 2.36.49 PM.png

I deactivated all plugins and switched to 2017 theme.

Still have the problem.
I always have php error logging enabled in all of my sites.
This issue is not writing any errors to the log.

#516388

If the problem still persists, please provide a database dump file of your website in below "private detail box", I need to duplicate same problem and debug it in my localhost. thanks

#518126

Thanks for the details, I am downloading the file, will feedback if there is anything found

#518162

Thanks for the details, I can duplicate same problem, it is all-in-one-event-calendar add the calendar into the Views content template, you can edit the problem view "Recent Posts Sidebar- View", and try this:
in section "Loop Output Editor", modify the content template shortcode from:

[wpv-post-body view_template="view-grid"]

To:

[wpv-post-body view_template="view-grid" suppress_filters="true"]

And test again, more help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-body
suppress_filters (opt):
'true' | 'false' (default)
If suppress_filters=’true’, all third party (non WordPress) filters hooked into the_content filter will be removed, when retrieving the post body. In certain circumstances, plugins using this filter can add duplicated content to the post body – removing the filters can resolve this problem.

#518228

Thank you Luo, that does fix the problem.

So for any/all my sites where a View displays on a calendar event page, I need to add suppress filters to the content template output. I don't think I should have to do this.

According to the codex, it seems that whatever AI1EC is doing for their filter, they should lower the priority of the filter so it runs later (AFTER WP Views).

My preliminary additional testing shows that modifying AI1EC all-in-one-event-calendar/lib/http/response/render/strategy/html.php (lines 53 and 57) fixes the issue:
From this:

		if ( isset( $params['is_event'] ) ) {
			// Filter event post content, in single- and multi-post views
			add_filter( 'the_content', array( $this, 'event_content' ), PHP_INT_MAX - 1 );
			return;
		}
		// Replace page content - make sure it happens at (almost) the very end of
		add_filter( 'the_content', array( $this, 'append_content' ), PHP_INT_MAX - 1 );
	}

to this:

		if ( isset( $params['is_event'] ) ) {
			// Filter event post content, in single- and multi-post views
			add_filter( 'the_content', array( $this, 'event_content' ), PHP_INT_MAX + 1 );
			return;
		}
		// Replace page content - make sure it happens at (almost) the very end of
		add_filter( 'the_content', array( $this, 'append_content' ), PHP_INT_MAX + 1 );
	}

DEcreasing the priority of AI1EC the_content filter by INcreasing PHP_INT_MAX (HIGHER runs later, right?) fixes the problem without having to edit my WP-Views shortcode on every site/project. I suspect that AI1EC current code may cause issues with other plugins that may output loops on the event pages.

I have notified the developers of the fix to their code.. perhaps they will update their plugin.

#518234

Thanks for sharing the solution, but it is out the range of Toolset plugin, if you hacked the source codes of all-in-one-event-calendar plugin, it will be a problem when you upgrade all-in-one-event-calendar plugin in future. I suggest you ask help from the plugin author of all-in-one-event-calendar for it.

#518410

Luo,

Yes I am aware that modifying the plugin code might be a problem for plugin updates, but I've shared the fix with the developers of the calendar, and encouraged them to include it in an update.

I would rather NOT have to edit all my Views shortcodes because of a calendar plugin issue.

I'm closing this issue. Thanks for your help!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.