Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How can Photo Dropper work for WP3 Multisite? WordPress

  • SOLVED

So I want Photo Dropper ([[LINK href="http://www.photodropper.com/wordpress-plugin/"]]http://www.photodropper.com/wordpress-plugin/[[/LINK]]) to work with a WP3.0.1 multisite installation.

I installed the plugin, network-activated and tried to use it on one of the sub-blogs, but it doesn't work. There was just the "loading" circle, and then nothing.

Then, I tried it on the main, "mother" blog, and it worked. So, this lead me to believe it's a multisite issue.

I am a PHP novice. Can someone tell me if it is possible to tweak the plugin to work with multisite, and how?

I contacted the original developer, but not answer yet.

Answers (3)

2010-10-26

Denzel Chia answers:

Hi,

Because it is multi site the database table prefix is different, it has to be depending on the multi site blog id.

Open up flickr-post-plugin.php go to line 28 and change accordingly,
find the following flickr_post_table global variable.

$flickr_post_table = $wpdb->prefix . "flickr_post";


change to

$flickr_post_table = $wpdb->get_blog_prefix($blog_id) . "flickr_post";


deactivate and reactivate the plugin to run the activation hook and create database tables for this plugin according to multi site blog ids.

Thanks.


icg.t2h comments:

OK, let me try this...


icg.t2h comments:

Hi Denzel,

I am helping out the original poster make the changes suggested. We're still not successful. Here's what I've tried...

I made the db prefix change on line 28 of the flickr-post-plugin.php file and here are the results.

If I Mass Activate using Plugin Commander, the tables don't get created properly. If I activate the plugin from each blog's backend individually, then the tables are created, properly, but when using the Photo Dropper plugin (clicking the icon above the Visual editor)...the search returns no results unless it's activated on one site within the install.

I did find something else that probably needs to be changed eventually and that was another reference to the table prefix. That was in the flickr-ajax.php file on line 8. Because of the "ajax" in the file name I though it had something to do with the ability to pull the images up, but I made the change there and it still didn't work.

Unfortunately that's about the extent of the troubleshooting I can do.

Do you have any other thoughts on what we might try? It seems that the issue is localized to the actual Flickr search now, but I'm not sure how a Multisite setup could affect that. Maybe the search carries the blogID or something?

Adam


Denzel Chia comments:

Hi,

Sorry for late reply, I was not tied up in some other matter.
<blockquote>
If I activate the plugin from each blog's backend individually, then the tables are created, properly,</blockquote>

This is because the function that creates the table is fired only by the plugin activation hook, I do not know if network activate fires this activation hook, apparently it does not do so in this case. Therefore, only individual activation will trigger the creation of tables of this plugin.

Secondly,
This time I personally read through every line of the plugin codes, changed all references to database table with a blog id prefix.

I found that the original plugin developer use a not so correct reference to its flicker-js.php
The developer show use the constant WP_PLUGIN_URL
This constant will return the url to plugins folder, hope that WordPress core developers had made this constant dynamic as multi site will have different url to plugins folder.

I had made all the necessary changes I found, hope this time round will solve your problem.
As it is a whole plugin, I cannot paste all the codes here. And I assume that my explanation here is enough to fulfill my obligations to the rules of wp questions.

<strong>Please send me an email, so that I can reply with the whole modified plugin intact for you to test. You need only install it for testing.

You can find my email address from my website through my profile here.</strong>

Thanks.

Denzel


Denzel Chia comments:

Sorry for typo errors!


Denzel Chia comments:

Ok. I had uploaded to test in my multi site installation.

Ha Ha its working!

Attached a screenshot of my database table, you can see the number 4 which is the blog id being created for the flicker post table.