Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Zetaboards Modifications
  • Remove Search for Guests
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
Remove Search for Guests
Tweet Topic Started: May 12 2010, 03:39 PM (701 Views)
Codes Rock May 12 2010, 03:39 PM Post #1
Member Avatar
Keeper of all the knowledge!

Posts:
30
Group:
Staff In Training
Member
#3,768
Joined:
Apr 5, 2010
Coding language
PHP
Here is an easy way to remove the Search from guests.

What it does is remove the search link from the menu bar at the top of the page for guests. If by chance they go to the search page by a direct link, the search table will be removed.


Go to your Admin Control Panel

Scroll down and on the left, under Themes, click on Board Template

At the very top of the section:
Above the Board
Content that goes before the main content of the board.

copy/paste the following:
Code:
 
<script type="text/javascript">
//<![CDATA[
/* remove search from guest view */
/* Created by Codes Rock */
if ($("#top_info small a:contains('[Log In]')").length > 0) {
$("#submenu a:contains('Search')").remove()
$("table#search_form").remove()
}
//]]>
</script>

or you put this instead:

Code: HTML
 
<script type="text/javascript" src="http://z3.ifrm.com/312/4/0/f572015/removesearch.js"></script>
Posted Image
Offline Profile Goto Top
 
viperver1 May 13 2010, 05:31 AM Post #2
Member Avatar


Posts:
100
Group:
Member
Member
#1,984
Joined:
Jan 9, 2009
Coding language
Everything
Nice. I would consider using this code for my site.

Thanks for a very useful code.
Offline Profile Goto Top
 
Codes Rock May 13 2010, 06:51 AM Post #3
Member Avatar
Keeper of all the knowledge!

Posts:
30
Group:
Staff In Training
Member
#3,768
Joined:
Apr 5, 2010
Coding language
PHP
Thanks, viperver1! This was a request that I figured I'd put out there for everyone/anyone to use :)
Posted Image
Offline Profile Goto Top
 
Swordslam46 May 15 2010, 07:06 PM Post #4
Member Avatar


Posts:
934
Group:
Dedicated
Member
#2,773
Joined:
Apr 9, 2009
People can still get to the search funtion :O

you should edit it to this:

Code:
 

<script type="text/javascript">
//<![CDATA[
/* remove search from guest view */
/* Created by Codes Rock */
if ($("#top_info small a:contains('[Log In]')").length > 0) {
$("#submenu a:contains('Search')").remove()
$("table#search_form").remove()
if(location.href.match(/search/)){
window.location = main_url+"/index/";
}
}
//]]>
</script>


Otherwise, nice code, simple but useful :P
Offline Profile Goto Top
 
Codes Rock May 16 2010, 06:39 AM Post #5
Member Avatar
Keeper of all the knowledge!

Posts:
30
Group:
Staff In Training
Member
#3,768
Joined:
Apr 5, 2010
Coding language
PHP
yes, that would remove the page completely! Good addition.
Posted Image
Offline Profile Goto Top
 
Gorgor May 16 2010, 11:32 AM Post #6
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
A quick optimization tip is to never add a tag name when selecting and id with jQuery because it will loop through all of the elements with that tag name instead of going straight to the id.

You can also combine the two removes, and then make it a one-liner:
Code:
 
if ($("#top_info small a:contains('[Log In]')").length > 0) $("#search_form, #submenu a:contains('Search')").remove()
Offline Profile Goto Top
 
Codes Rock May 16 2010, 02:17 PM Post #7
Member Avatar
Keeper of all the knowledge!

Posts:
30
Group:
Staff In Training
Member
#3,768
Joined:
Apr 5, 2010
Coding language
PHP
. . . and that's why Gorgor is everyone's hero!
Posted Image
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Zetaboards Modifications · Next Topic »
Locked Topic

Track Topic · E-mail Topic Time: 7:50 PM Jul 10
Hosted for free by ZetaBoards · Privacy Policy