Automattic / camptix

Moved to https://github.com/WordPress/wordcamp.org/
176 stars 94 forks source link

"An error has occurred." #8

Closed jelison closed 12 years ago

jelison commented 12 years ago

Hi there, kudos on what looks like a fantastic plugin... Sadly, I haven't been able to make use of it due to this error I'm receiving.

Everything looks peachy on the back end, credentials inputted fine and tickets created with ease. However, the [camptix] short code simply outputs this to the front end:

An error has occurred.

Using latest WP version (3.4.2), on a server running PHP 5.2.17. Tried multiple themes, killed any other plugins, and on a page and post, and multiple PayPal accounts with API creds – same result all around.

Any idea what could be triggering this error? I'm lost on what could be the culprit.

kovshenin commented 12 years ago

Hey there! Please make sure that you're entering the [camptix] shortcode on a Page (not a post or other post type) and as is, with no spaces, and no attributes: [camptix]. Disable all plugins and revert back to Twenty Ten, if you still get the error let me know.

A tech description of the above is the following. The shortcode doesn't operate by itself, it relies on a function hooked to template_redirect which executes before the shortcode content is shown. If it has not executed, the "An error has occurred." message is shown instead, meaning the $camptix->template_redirect() method is bailing, probably at the very beginning.

Let me know if you can provide me with more info. You can also reach me on Skype, I'm kovshenin.

Thanks!

jelison commented 12 years ago

Thanks for the super quick reply and info!

Looks like the culprit is the theme itself; switched back to Twenty Ten and things are working just fine... For the record, I'm using a premium theme. In particular, Viewpoint (http://themeforest.net/item/-viewpoint-responsive-single-page-portfolio/2793926) which converts things to a single page display. I guess things in the back end are creating the blocker to the necessary function.

I'm also guessing that there's no clear workaround for this that you'd know of without providing dedicated support for this theme's issue(s). And certainly, I'm not asking you to provide that. :)

If there's any general input/guesses on resolving a blocker like this related to the theme, I'm all ears. Otherwise, kudos again for the plugin (beautiful to setup and use [in Twenty Ten]), and a big thanks for the response.

jelison commented 12 years ago

Hey kovshenin, just wanted to follow up on this as I've uncovered a resolution.

I went back to the theme developer to discuss the possibility that his work was potentially creating a hurdle for the template_redirect function. After a test to ensure that it was not, which it appeared it in fact was not, he took a look at your plugin.

His advice to me was this:

Go to camptix.php and find: if ( ! is_page() || ! stristr( $post->post_content, ‘[camptix]’ ) ) return; remove it

This should’ve been done by the plugin developer as he developed it and he surely knew that it can only executed when in a page. Since this is a one-page theme, all the content was printed on the homepage.

I removed that from camptix.php and the plugin shortcode worked as expected – no more error code.

I'm not knowledgeable enough with php to understand what this correct, or what the actual issue was (or really, who the onus falls on), but I thought I'd pass it along in case it helps anyone else in the future.

Again, fantastic plugin. Thanks.

kovshenin commented 12 years ago

Hey @jelison, thanks for helping debug this! Removing that check will run the code on every page request during template_redirect, which is not the best solution. Also, I'm thinking to move away from shortcodes entirely, not sure how well this would work with single-page/ajax-powered themes. I do, however, think that the is_page check can be less strict, though I haven't tested the shortcode in posts or custom post types, which may also break things :)

Thanks again, and let me know if there's anything I can do to help you further!