View Full Version : How to hide FB Connect button on certain pages?
Superorb
09-25-2012, 03:37 AM
I hide the FB Connect button to non-members and only display it to logged in members. But, when I log out it shows up on the page that displays the cleared cookies. How can I hide the FB Connect button from this page only? Specifically, all iterations of login.php? Can I run CSS code only when the page was loaded and I'll just do "display:none" and be done with it? Or do I have to do a conditional statement like I had to do to hide the button from non-members? It breaks my style and looks wrong too.
Lynne
09-25-2012, 02:47 PM
You can add to your condition something like THIS_SCRIPT == 'login'
Superorb
09-25-2012, 04:26 PM
Would this work? I'm still new to PHP conditionals. <vb:if "THIS_SCRIPT == 'login'">Content here</vb:if>
Lynne
09-25-2012, 11:26 PM
That should work. Just try it on your test site and you will see.
Superorb
09-26-2012, 12:11 AM
Tried it and it threw out an error. I used exactly what I wrote in the post above yours.
The following error occurred when attempting to evaluate this template:
An empty or invalid 'if' condition was found.
EDIT: Tried <vb:if condition="THIS_SCRIPT == 'album'">Content here</vb:if> and it worked, but I've run into another problem. Apparently you can't nest if/else conditionals or I did it incorrectly. Is there another way to accomplish this? I only want the FB connect button to show up to logged in users, but for some reason when you log out it still thinks you're a logged in user and shows the Connect button anyways. This is what I tried:
<!-- If Template=Login then hide FB Connect Button -->
<vb:if condition="THIS_SCRIPT == 'login'"> <vb:else>
<!-- Only show the FB Connect button to logged in users -->
<vb:if condition="$bbuserinfo['userid'] == 0">
<span style="display:none"> </span>
<vb:else />
<li id="fb_headerbox" class="hidden">
<vb:if condition="$show['facebookuser']">
<a id="fb_link" href="{vb:raw profileurl}">
<img id="fb_squarepic" width="16" height="16" alt="{vb:rawphrase facebook_connect}" src="{vb:raw squarepicurl}" />
<img id="fb_icon" width="14" height="14" alt="{vb:rawphrase facebook_connect}" src="{vb:stylevar imgdir_misc}/facebook.gif" />
</a>
<vb:else />
<a id="fb_loginbtn" href="#"><img src="{vb:stylevar imgdir_misc}/facebook_login.gif" alt="{vb:rawphrase facebook_connect}" /></a>
</vb:if>
</li>
<!-- Closing IF from FB Connect above for logged in users -->
</vb:if>
<!-- Closing IF from FB Connect Template Hide -->
</vb:if>
EDIT@: Can I dd an AND or an OR to this conditional to exclude this template?
<vb:if condition="$bbuserinfo['userid'] == 0">
EDIT3: I tried <vb:if condition="$show['member']"> instead of <vb:if condition="$bbuserinfo['userid'] == 0">
and it's working now :) Thanks Lynne for working me through it.
Could you please take a look at another problem I'm having (https://www.vbulletin.com/forum/showthread.php/408129-Custome-Human-Verification-Questions-Broken?p=2343032#post2343032) in regards to none of the human verification questions working? Also please mark this thread Solved :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.