Support

Home Forums Event Espresso Premium Message template pack issues

Message template pack issues

Posted: November 13, 2018 at 11:08 am


ARAGATO

November 13, 2018 at 11:08 am

I have registered a new messages templates pack.
It is shown in relevant registered message types, e.h. payment declined.
http://uploads.aragato-server.net/screenshots/20181113c699a8a120.png

However, when I switch to the newley registered pack, in this case ACMS Template, it switches, but throws an error, too.
http://uploads.aragato-server.net/screenshots/20181113356fa081d0.png

After the error is thrown, I will get redirected to /wp-admin/undefined
which shows me 404, a not defined page.

Interestingly though, the templates seem to have been pulled, because when I go back into the message type the new template pack is selected and the template contents are from the new pack. However, the error still persistent everytime I switch between default and the new pack.

What is the problem?


Josh

  • Support Staff

November 13, 2018 at 11:13 am

Hi,

Some code in your custom message template is quite likely the problem. Can you upload the code to a gist and link here so we can take a look?


ARAGATO

November 13, 2018 at 11:20 am

Thanks for the quick reply.
Here the link to the gist:
https://gist.github.com/ARAGATO/25a942c69bc824b68919e3aa846341b2


ARAGATO

November 13, 2018 at 11:23 am

For development purposed I copied the default “new message pack” template files, so they should be ok.


ARAGATO

November 13, 2018 at 11:43 am

I found that the error resolves in Messages_Admin_Page.core.php in the public function switch_template_pack() which somewhere in there does the following:

            $query_args = $this->_reset_to_default_template();
            if (empty($query_args['id'])) {
                EE_Error::add_error(
                    esc_html__(
                        'Something went wrong with switching the template pack. Please try again or contact EE support',
                        'event_espresso'
                    ),
                    __FILE__,
                    __FUNCTION__,
                    __LINE__
                );
                $this->_template_args['error'] = true;

Question now is why is $query_args[‘id’] empty?


Josh

  • Support Staff

November 13, 2018 at 11:51 am

I have a few questions about your code, and maybe you’ve got other code for this, maybe not:

is EE_NEW_TP_PATH defined somewhere?


ARAGATO

November 13, 2018 at 11:52 am

Yes, they are all globally defined

define( ‘EE_NEW_TP_TEST_VERSION’, ‘1.0’ );
define( ‘EE_NEW_TP_TEST_FILE’, __FILE__ );
define( ‘EE_NEW_TP_PATH’, plugin_dir_path( __FILE__ ) . ‘/’ );
define( ‘EE_NEW_TP_URL’, plugin_dir_url( __FILE__ ) . ‘/’ );


Josh

  • Support Staff

November 13, 2018 at 11:52 am

is this:

$this->loader->add_action

really a custom method, or are you trying to call add_action()?


Josh

  • Support Staff

November 13, 2018 at 11:53 am

Yes, they are all globally defined

Where?


ARAGATO

November 13, 2018 at 11:54 am

This is really a custom method, which does add_action().


Josh

  • Support Staff

November 13, 2018 at 11:56 am

If that’s the case, your code you’ve posted so far really lacks enough context to see what’s going on.


ARAGATO

November 13, 2018 at 12:02 pm

The plugin is based on the “Boilerplate Framework” for WordPress Plugins.
https://github.com/devinvinson/WordPress-Plugin-Boilerplate/

The constants are defined in the main plugin file (https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/blob/master/plugin-name/plugin-name.php), which are global for the whole plugin.
I have put the constants there:
define( ‘EE_NEW_TP_TEST_VERSION’, ‘1.0’ );
define( ‘EE_NEW_TP_TEST_FILE’, __FILE__ );
define( ‘EE_NEW_TP_PATH’, plugin_dir_path( __FILE__ ) . ‘/’ );
define( ‘EE_NEW_TP_URL’, plugin_dir_url( __FILE__ ) . ‘/’ );

The $this->loader->add_action method is a standard construct of that “Boilerplate Framework”, too.


Josh

  • Support Staff

November 13, 2018 at 1:36 pm

OK thanks for the clarification.

I loaded up the little example template pack plugin that can be copied from the /tests/mocks/addons and got the same errors. So one of the developers made a fix, which is currently up for review in this pull request:

https://github.com/eventespresso/event-espresso-core/pull/782

You’re welcome to try the branch out to see if it fixes things for you.


ARAGATO

November 13, 2018 at 2:17 pm

Oh, yeah! Just tried the bugfix by @nerrad and it works.
No error message, strange redirect and double dropdown entry anymore.

Thanks for that quick resolution. That’s what I call a great support team.
Resolved.

The support post ‘Message template pack issues’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso