• Hi all,

    I’m using the Sliding Panel plugin on a site in development and I’ve had this plugin customized to force the sliding panel to open once after a successful login. That is working great. A usability issue has arisen when a user doesn’t enter their login credentials correctly and they get the following message:

    ERROR: Invalid username. Lost your password?

    That is great, but the message is hidden behind a closed panel. The cookie code is not set to keep the panel open upon an error, only when user is logged in. I would like the panel to stay open both when a user logs in AND when a login error occurs.

    I have done some research and it looks like there is a function for this case in WP named is_wp_error so logic would suggest that I can check for that in the custom cookie handling code, but I’m not quite sure how to write that correctly. I wonder if anyone here can assist?

    The custom cookie code is…

    /* Cookie Handling */
    
    			// Check if logged in
    			if ($j('body').is('.loggedin')) {
    				// Logged in - set cookie if not set already, and display panel
    				var show_panel = $j.cookie('show_panel');
    				if (show_panel=='no') {} else {
    					$j ( '#sliding-panel .panel' ).show();
    					$j ( '#sliding-panel .tab' ).addClass( 'current' );
    					$j ( '#sliding-panel .toggle a.open' ).hide();
    					$j ( '#sliding-panel .toggle a.close' ).show();
    					$j.cookie('show_panel', 'no', { domain: '.test.net' });
    				}
    			} else {
    				// Not logged in
    				$j.cookie('show_panel', null, { domain: '.test.net' });
    			}
    
    		/* End Cookie Handling */

    I thought I could do something like this, but it breaks the cookie handling and I’m assuming it’s my syntax that is the problem.

    } else if {
    if ( is_wp_error() ) {
    var show_panel = $j.cookie('show_panel');
    				if (show_panel=='no') {} else {
    					$j ( '#sliding-panel .panel' ).show();
    					$j ( '#sliding-panel .tab' ).addClass( 'current' );
    					$j ( '#sliding-panel .toggle a.open' ).hide();
    					$j ( '#sliding-panel .toggle a.close' ).show();
    					$j.cookie('show_panel', 'no', { domain: '.test.net' });
    				}

    Any assistance would be greatly appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Cookie Handling for Sliding Panel Plugin – Working Except…’ is closed to new replies.