Who knows what’s next?

Shopp loading incorrect WordPress installation

February 10th, 2010 by Matt McInvale

When trying to use their TinyMCE button, the resulting window displays a different WordPress installation (normally the login window). This was quite annoying since I didn’t have all of my category and product IDs committed to memory. ;)

This bug is caused by the way Shopp is including content into shopp/core/ui/behaviors/tinymce/dialog.php, specifically with the function find_filepath. Shopp is searching your entire document root for a core WordPress file, wp-load.php. Once it finds this file it is loaded into the window that is displayed for you. The problem presents itself because Shopp doesn’t check to see if it’s the correct WordPress installation that wp-load.php came from.

Quick Fix

Open up the file shopp/core/ui/behaviours/tinymce/dialog.php and comment out lines 2-27. Then add the following snippet:

$includefile = str_replace('/wp-content/plugins/shopp/core/ui/behaviors/tinymce/dialog.php','',$_SERVER['SCRIPT_FILENAME']) . '/wp-load.php';
require_once($includefile);

It’s possible this will break other things, so don’t do this on a production installation. Let me know if this works for you in the comments.

3 Comments so far

  1. Looks like this did the trick for me. In my case, I don’t have multiple installs, but rather, I have a complete WordPress site that I copied from another server. As soon as I copied the site over, the add a product/category button on the TinyMCE editor ceased to work.

    I did a search and replace on the entire database to remove every mention of the old URL, but obviously there is still something going on that’s throwing Shopp off.

    So far, I don’t see anything else broken, but I’ll let you know if I do.

    Also, it would be great if there was a way to get email notification on this thread. Not sure if you want to install that plugin, but I know that I’d be a lot more apt to throw in whatever insights I can if I didn’t have to make a note of this URL and remember to keep checking back.

    That said, THANK YOU for the fix, you rule!

  2. I am having the same problem, but when I comment out lines 2-27 and add your snipped I get error messages. Could you clarify where to include the snippet, or show what the finished PHP file should look like? Thanks!

Leave a comment

  • You said,
  • right now:

Trackbacks on this post

From the Blog

For the second year in a row, the BinaryM team is putting San Diego in our rear view mirror and heading north for WordCamp LA.
read more

From our clients...

I’ve been working with BinaryM for almost 5 years now. I’ve worked with a number of other developers and none of them are as consistently on top of the ball like BinaryM. Their programming is clean, estimates are accurate and partnership is indispensable.

Thanks!
Adam Pascu

Contact Us...

Email:
info@binarym.com
Phone:
619-928-2221
Fax:
619-462-4883