• Resolved edmonds_bob

    (@edmonds_bob)


    Hello,

    We have found an incompatibility with your plugin and Events Manager Pro. The problem stems from your code in wp_user_stylesheet_switcher.php:

    if(!isset($_SESSION)){

    session_start();

    }

    This somehow interferes with the shopping cart function Events Manager Pro. Commenting out the above code fixes the problem and seems to have no adverse effect on using WP User Stylesheet Switcher

    Can you tell me why this code is needed?

    https://www.ads-software.com/plugins/wp-user-stylesheet-switcher/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author vgstef

    (@vgstef)

    How did you find the incompatibility? Was there an error message? Could you give me the message?

    session_start is required to keep user’s stylesheet choice. Otherwise, the choice won’t be remembered.

    But it Events Manager Pro already started a session before WP Stylesheet Switcher, maybe it could be the problem.

    So if you could give me more information, I’d have a look.

    Hi, I am working with edmonds_bob on this project and I am the one who found the problem. I did not see any error messages. the behaviour was that bookings were not being preserved. When you booked a ticket you got the “Your booking was added to your shopping cart.” message. But if you then looked at the shopping cart the message was “You have not booked any events yet. Your cart is empty.”

    I deactivated all the other plugins and added them back in until the problem recurred, and that happened when i reactivated WP Stylesheet Switcher.

    i searched the support forum and found another user who had the same problem with
    yet another plugin, called Paid Memberships Pro. That user made the problem go away by commenting out the session_start test. So I tried the same fix in WP Stylesheet Switcher and it worked.

    I have also contacted the Events Manager Pro developers about this. Please note the response below from their chief developer, Marcus Sykes ([email protected])

    My opinion is that the plugin is doing something wrong there…. I’m not sure what because those lines I don’t think are the root cause of the problem, my guess is that somewhere else in their code, they’re wiping or manipulating session variables before we get a chance to execute our code. The logic behind my assumption is if you remove the session_start() lines in their plugin, they’re trying to modify non-existent session variables which are then created properly when we run session_start and our data remains intact.

    Furthermore, see the PHP docs – https://php.net/manual/en/function.session-start.php – calling session_start() twice should not cause loss of session data which is also why I’m guessing it’s something else.

    You need to contact the plugin developer about it and feel free to paste this to them. I’m not saying I’m 100% right here but there’s various other plugins that work fine with EM and use sessions, so it must be something else…. If they disagree with me I’m happy to liaise with them directly and determine who’s truly at fault.

    Hope that helps, sorry I couldn’t give a better solution here!

    Plugin Author vgstef

    (@vgstef)

    Thanks for the details, I’ll have a look.

    Plugin Author vgstef

    (@vgstef)

    I updated the plugin and change the session_start condition. Could you check if the problem still occurs. It’s hard to test since I don’t have Events Manager Pro.

    thanks for working on this. unfortunately the problem still persists. i updated the site to wp user stylesheet switcher version 1.6.1 and the problem i described above recurred. i commented out the lines

    if (!session_id()) {
         session_start();
     }

    in wp_user_stylesheet_switcher.php and the events manager pro shopping cart now properly maintains the information about the booking.

    Plugin Author vgstef

    (@vgstef)

    Hi pmonger,
    Finally, I updated my plugin. Many important changes were made. One of them is the use of cookies with javascript instead of using “sessions”. So there shouldn’t be problem with Events Manager Pro anymore.
    Could you test the new version to see if it the case?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Stylesheet Switcher incompatibility with Events Manager Pro’ is closed to new replies.