WordPress.org

Support

Support » Plugins and Hacks » Simple Side Tab » [Resolved] Show Simple Side Tab Only if Not Logged In – SOLUTION

[Resolved] Show Simple Side Tab Only if Not Logged In – SOLUTION

  • Saw a previous post about this when I was looking for a way to hide the Simple Side Tab after a user logs in, but it’s closed for further replies. Just wanted to post how I got this to work for anyone else looking to do the same.

    I changed:

    // set side of page for tab
    	if ($rum_sst_left_right == 'right') {
    		$rum_sst_left_right_location = 'rum_sst_right';
    	}else {
    		$rum_sst_left_right_location = 'rum_sst_left';
    	}
    
    	if(preg_match('/(?i)msie [7-8]/',$_SERVER['HTTP_USER_AGENT']))
    	{
    	    // if IE 7 or 8
    	    // Write HTML to render tab
    		echo '<a href="' . esc_url( $rum_sst_tab_url ) . '"' . $rum_sst_target_blank . '><div id="rum_sst_tab" class="rum_sst_contents less-ie-9 ' . $rum_sst_left_right_location . '">' . esc_html( $rum_sst_text_for_tab ) . '</div></a>';
    	}
    	else
    	{
    	   // if IE>8
    	   // Write HTML to render tab
    	   echo '<a href="' . esc_url( $rum_sst_tab_url ) . '"' . $rum_sst_target_blank . ' id="rum_sst_tab" class="rum_sst_contents ' . $rum_sst_left_right_location . '">' . esc_html( $rum_sst_text_for_tab ) . '</a>';
    	}
    }

    to:

    // set side of page for tab
    	if ($rum_sst_left_right == 'right') {
    		$rum_sst_left_right_location = 'rum_sst_right';
    	}else {
    		$rum_sst_left_right_location = 'rum_sst_left';
    	}
    	if ( is_user_logged_in() ) {
    
    } else {
    	if(preg_match('/(?i)msie [7-8]/',$_SERVER['HTTP_USER_AGENT']))
    	{
    	    // if IE 7 or 8
    	    // Write HTML to render tab
    		echo '<a href="' . esc_url( $rum_sst_tab_url ) . '"' . $rum_sst_target_blank . '><div id="rum_sst_tab" class="rum_sst_contents less-ie-9 ' . $rum_sst_left_right_location . '">' . esc_html( $rum_sst_text_for_tab ) . '</div></a>';
    	}
    	else
    	{
    	   // if IE>8
    	   // Write HTML to render tab
    	   echo '<a href="' . esc_url( $rum_sst_tab_url ) . '"' . $rum_sst_target_blank . ' id="rum_sst_tab" class="rum_sst_contents ' . $rum_sst_left_right_location . '">' . esc_html( $rum_sst_text_for_tab ) . '</a>';
    	}
    	}
    
    }

    https://wordpress.org/plugins/simple-side-tab/

Viewing 1 replies (of 1 total)
  • Plugin Author srumery

    @srumery

    Thank you for sharing your solution, spearsonit. I didn’t test your code above but I wanted to offer a solution that will remove the tab for logged in users just by using CSS.

    .logged-in #rum_sst_tab {display:none;}

    This will turn off the display of the tab for users that are signed in. Unless your site is removing the logged-in class from the body tag, this should work just fine.

    This way, your custom code change in the plugin won’t be overwritten by future updates.

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Show Simple Side Tab Only if Not Logged In – SOLUTION’ is closed to new replies.
Skip to toolbar