After upgrading to WPMU 2.9.1.1 and DCG 3.1, whenever I open the functional screen for the Enable Media Replace plugin I'm met with:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'dfcg_add_page' was given in /home/websaum/public_html/wp-includes/plugin.php on line 339
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'dfcg_options_init' was given in /home/websaum/public_html/wp-includes/plugin.php on line 339
Any thoughts on why it would generate these errors?
8:21 pm January 26, 2010
Ade
Admin
posts 1140
2
Hi,
Just to confirm, if you disable Enable Media Replace plugin, the error messages disappear and all works fine?
I haven't tried it, since it appearts to only happen on the Enable Media Replace popup screen.
8:54 pm January 26, 2010
Ade
Admin
posts 1140
4
I'm trying to recreate the error.
WPMU 2.9.1.1
DCG 3.1
Enable Media Replace 1.3
I go to Media>Library, then Edit an existing image. Then select Replace Media>Upload a New File. A popup opens, I then get this in the popup:
Warning: require_once(C:\wamp2\www\wpmu\wp-content\plugins\enable-media-replace\popup.phpwp-load.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp2\www\wpmu\wp-content\plugins\enable-media-replace\popup.php on line 5
Fatal error: require_once() [function.require]: Failed opening required 'C:\wamp2\www\wpmu\wp-content\plugins\enable-media-replace\popup.phpwp-load.php' (include_path='.;C:\php5\pear') in C:\wamp2\www\wpmu\wp-content\plugins\enable-media-replace\popup.php on line 5
I hate to say it, but I think there are coding issues with this other plugin…:-/ I'm not even convinced it is designed to be used on MU.
Ack. It was working perfectly before I did the upgrade (both 2.9.1.1 and DCG), who knows where the source of the issue really lies. Thank you for your help!
9:36 pm January 26, 2010
Ade
Admin
posts 1140
6
Can you post a screenshot (or link to one on photobucket etc) so that I can see what you see?
Yikes, it's a long list. I'm running an MU site as CMS for an entire university…currently 45 blogs and 400 registered users (all fac/staff, mostly just to allow campus directory editing). I've got quite a few plugins, and several that I'm phasing out due to the new video/imaging options in 2.9.1.1.
I'm trying to get you a screenshot, but Fireshot is giving me a bit of trouble.
10:19 pm January 26, 2010
Ade
Admin
posts 1140
10
I guessed that might be the case.
Don't worry about it, I'll do some more experimenting at my end. If you can, great. If not, don't worry.
Ok, I've worked out what's going on and I blame the other guy, or WP, or both!
It's a bit tricky to explain, and I'm simplifying greatly…
In the DCG, the plugin's files are included based on a check of !is_admin() or is_admin() (depending on the files). This means a lighter weight plugin for users (as opposed to logged in admins), because only stuff needed to view the gallery is loaded when not in admin (ie Settings page stuff is only loaded if is_admin() is true).
The Enable Media Replace loads the popup screen unconventionally using a direct call to wp-load.php, rather than via the normal route. Effectively, WP is loaded but thinks (as far as the popup is concerned) that it is not in admin. It tries to load the 2 DCG functions (which are only available if is_admin() is true) and therefore throws the errors.
If I had time (or inclination) I would work out a fix for the other plugin to prevent this happening.
I know this doesn't help you directly, but thought you'd be interested to know.
Ok, well the good news is (so far) I'm only using DCG on the default blog so this really only causes problems for me, and I'm admin and root, so I'm pretty sure I can get around the file replace capability without the other plugin. I really need the media replace capability for the rest of my users though, it's ridiculous that WP makes it impossible to simply SAVE OVER an old file.
Thank you so much for going above and beyond on this. I very much appreciate it.
10:01 pm February 4, 2010
Ade
Admin
posts 1140
14
Hi,
As mentioned before, I'm not entirely sure that Enable Media Replace is loading WP correctly. However, here's a patch to the DCG to get around this.
Open up dynamic-gallery-plugin.php and replace this:
/* Admin – Register Settings as per new API */ // Function defined in dfcg-admin-core.php add_action('admin_init', 'dfcg_options_init' );
/* Admin – Adds Settings page */ // Function defined in dfcg-admin-core.php add_action('admin_menu', 'dfcg_add_to_options_menu');
/* Admin – Adds Metaboxes to Post/Page Editor */ // Function defined in dfcg-admin-metaboxes.php add_action('admin_menu', 'dfcg_add_metabox');
with this:
if( is_admin() ) { /* Admin – Register Settings as per new API */ // Function defined in dfcg-admin-core.php add_action('admin_init', 'dfcg_options_init' );
/* Admin – Adds Settings page */ // Function defined in dfcg-admin-core.php add_action('admin_menu', 'dfcg_add_to_options_menu');
/* Admin – Adds Metaboxes to Post/Page Editor */ // Function defined in dfcg-admin-metaboxes.php add_action('admin_menu', 'dfcg_add_metabox'); }
Test that the DCG options page continues to work properly and let me know how you get on. Thanks.
I agree that the method for loading WP in my plugin is far from elegant. I will try to change the method EMR uses to replace media in the next version of the plugin to eliminate this and other errors that have occurred with this plugin.
Thanks,
/Måns
4:37 pm February 20, 2010
Ade
Admin
posts 1140
16
Hi,
Thanks for posting! Actually, my plugin wasn't handling this situation quite right either, hence the recent upgrade.
You may be interested to see this post from Otto (wp-hackers) which explains how to avoid using direct calls to wp-load.php. Not sure whether it gives you a complete fix, but should be useful nonetheless.
Developing plugins for the community represents a considerable investment of my time and energy. If you have found these plugins useful, please consider making a donation to help support future development. Your support will be much appreciated. Thank you!