Topic: Updating to version breaks Simpleviewer gallery on WP

Hi, I have tried to update version of the plugin (with a paid version of the svcore files to remove branding) on my sites but moving to version now breaks the gallery from being embedded on a PHP template using the following code:

<?php echo do_shortcode('[simpleviewer gallery_id="1"]'); ?>

Is there a fix for this issue or something obvious at my end that needs to be addressed?

I usually have to insert a Simpleviewer gallery into a page using the WP 'toolkit' button first, save and update the page (to make the database connection between images associated with the page's media library.

I then re-edit the page to delete the [simpleviewer gallery_id="1"] shortcode tag and allow the PHP call in the template file to do the work instead.

Is this method no longer supported in version

Thanks for your help

Re: Updating to version breaks Simpleviewer gallery on WP

WP-SimpleViewer v2.3.2.4 introduced a feature whereby the 'simpleviewer.js' file is loaded into the web page only if it is required (only if a shortcode is found on the page).
If the shortcode is not present in the page content when the check is made, then the 'simpleviewer.js' file will not be loaded and the gallery will fail to display.

This may be the cause of your problem.

To load the 'simpleviewer.js' file in all pages (regardless of whether or not a gallery is present), open the 'wp-simpleviewer.php' file in a plain text editor and replace the shortcode_check function (starting at line 162) with the following:

function shortcode_check($posts) {
    $this->required_core = true;
    add_action('wp_enqueue_scripts', array(&$this, 'add_scripts_wp_core'));
    return $posts;

This should hopefully solve your problem.
If not, then please let me know exactly what happens (or does not happen) when you say that it "breaks the gallery from being embedded"? Is anything output to the source of your web page (for example embedding code or an error message)?
Thank you.

Please note that the line number above refers to the current version of WP-SimpleViewer (v2.3.2.4).

Steven Speirs
SimpleViewer Support Team

3 (edited by monkeypuzzle 2015-02-03 00:52:56)

Re: Updating to version breaks Simpleviewer gallery on WP

Thanks for coming back to me Steven. Two issues:

-> 1. I have the Pro version of the plugin and it seems the svcore directory and files within (including simple viewer.js) do not get updated using the 'Update' function when using the WordPress system to pull down the new files and update the server.

I know you have discussed previously a code change which prevented overwriting of the Pro version files to avoid having to manually re-upload the score directory each time a WP pull was triggered.

-> 2. Looking at the simpleviewer.js file in a text editor (note the file is commented in the head as 'SimpleViewer-Pro v2.3.1') the script is obfuscated after line 8 and there are no further line numbers or text to edit to change the function call as you suggested.

I assume if I get access to a version set of plugin files with an up to date svcore folder that has the Pro functionality (all I need to is remove the text back link link in the gallery area) I can manually upload this to the server and cover off all issues and 'reset' the update path?

Are you able to link me to a downloadable package or email through the relevant files so I can sort this or can you suggest another solution?

I'm conscious if I pull down the plugin I still won't be able to edit the simpleviewer.js file.

Re: Updating to version breaks Simpleviewer gallery on WP

Sorry, my mistake. The file that should be edited is 'wp-simpleviewer.php'. I have corrected the error in my post above.
Hopefully making the edit as above will solve your problem.

Steven Speirs
SimpleViewer Support Team

Re: Updating to version breaks Simpleviewer gallery on WP

Perfect Steven, I have edited the php file and changed the function now. Updating via WordPress gets me version and the svcore directory remains as the Pro version and the WP template PHP call now works as expected.

Thanks again

Re: Updating to version breaks Simpleviewer gallery on WP

That's great!
Thank you for posting back to let me know.

Just to clarify (for others reading this thread), when WP-SimpleViewer is updated via the WordPress Dashboard Plugins page, if a Pro 'svcore' folder is detected, then it will not be overwritten with the Standard 'svcore' folder which comes bundled with the plugin and only the plugin-specific files will be updated.

Steven Speirs
SimpleViewer Support Team