• I am using YouTube SimpleGallery and love it. Its interface is perfect.

    I installed the plugin WP Ultra simple Paypal Cart, which uses $_SESSION to store shopping cart information.

    The shopping cart for that plugin doesn’t work when I have YouTube SimpleGallery enabled. When I disable YouTube SimpleGallery, the cart works.

    I’m guessing the issue has something to do with PHP Sessions, but it could be anything. Does anyone know what this problem could be, and if there’s anything I can do to fix it? I really love this plugin and would hate to have to disable it. It’s exactly what I’m looking for.

    http://wordpress.org/plugins/youtube-simplegallery/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter JoshuaD84

    (@joshuad84)

    The problem line is line 149 in youtube_simplegallery.php:

    session_destroy();

    This is destroying all sesssion variables across all plugins, not just the ones we need for this plugin. I think another foreach loop, using unset() on the specific session variables we want to destroy, rather than destroying the entire session.

    If I knew the list of potential variables, I’d write the code myself, but I’m not quite sure where to look, and just commenting out “session_destroy()” does the trick for my purposes.

    Thread Starter JoshuaD84

    (@joshuad84)

    Nix that, here is the corrected code. All we do is unset the variable after we’ve read it. This way we only destroy our session variables, but play nice with other plugins which are using persistent sessions.

    // SESSION FOR DYNAMIC STYLES, OUTPUT IN FOOTER
    function youtube_gallery_shortcode_styles() {
    	echo '<style type="text/css">'."\r\n";
    	foreach($_SESSION as $key => $val):
    		if(strstr($key, 'youtube_gallery_')) {
    			echo $val."\r\n";
    			unset($_SESSION[$key]);
    		}
    	endforeach;
    	echo '</style>'."\r\n";
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Breaking PHP Sessions?’ is closed to new replies.