Events Made Easy › Forums › Bug fixed or feature request implemented › Plugin not properly initialising
- This topic has 7 replies, 2 voices, and was last updated 4 years, 8 months ago by Franky.
-
AuthorPosts
-
Sun 24 May 2020 at 23:25 #61238AnonymousInactive
I am using the Multiple Domains plugin on my dev site and EME is not displaying some of the js or the maps properly when on the second domain alias. I am seeing cross domain warnings on the browser console. Multiple Domains works by re-writing plugins_url() with the domain name of the caller. In my case I have mydomain.nz and 192.168.1.74 and when calling with the ip address eme was returning links with the default wordpress domain name.
Taking a wee peek at the code has revealed that the plugin is initialising when it is enqueued rather than in response to the plugin loaded event (as per the current wordpress recommendations)
I tweaked events-manager.php so that the two URL defines are plugin url (lines 36/37) are called by an action hook from ‘plugins_loaded’. This and all works quite well now. We have the correct domain name consistently and no more console warnings. Yous spam filter blocks me pasting my code.
I will leave it over to you Frankie to decide what the scope of initialisation should be. I could not see anything else that should wait and I do not know what other magic like your cron does and what triggers it.
Mon 25 May 2020 at 00:28 #61239FrankyKeymasterYou can always mail me the improvements (or copy/paste your code here using the “code” block, I’m not blocking anything specific on the forum. The reason behind the initialisation is (probably) because EME – while mostly ready – is not class-rewritten, so some things are harder to do. I’m open to suggestions here though, if someone wants to help with that rewrite I’m all ears.
Mon 25 May 2020 at 01:05 #61240AnonymousInactive// GH Added Code Needs to run after Multiple Domains is loaded.... function eme_events_manager_init() { define('EME_PLUGIN_URL', plugins_url('',plugin_basename(__FILE__)).'/'); //PLUGIN URL define('EME_PLUGIN_DIR', ABSPATH.PLUGINDIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/'); //PLUGIN DIRECTORY } add_action( 'plugins_loaded', 'eme_events_manager_init', 20 ); // End GH Added Code
Mon 25 May 2020 at 18:39 #61245FrankyKeymasterWould you mind testing out the dev version of EME?
You can download it at the bottom of this page:
https://wordpress.org/plugins/events-made-easy/advanced/Wed 27 May 2020 at 03:22 #61249AnonymousInactiveHi Franky
That Dev version looks like it has done the trick.
Gary.Wed 27 May 2020 at 08:06 #61250FrankyKeymasterThanks for testing. Would you mind telling me when (date and time) you downloaded the dev version? Since I made other changes as well it would be nice if you downloaded the version from just before your reply 🙂
Wed 27 May 2020 at 08:15 #61251AnonymousInactiveHi Franky
It took me about an hour to download unpack and test. The most recent timestamp (on eme-events.php) is 25-05-2020 10:27pm. Happy to retest. Also as a head up, I am working on locations and maps and I have a growing number of questions. These are important but low priority as the core works well enough for what I want to do at present.
Gary.
Wed 27 May 2020 at 08:44 #61252FrankyKeymasterOk, the latest committed change was 32 hours ago, so I think you tested all other changes in there (don’t worry, nothing major changed and I tested also).
-
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.