UBB.Dev
Posted By: coloradok5 Turn search off for unregistered users - 05/16/2003 4:53 PM
I was wanting to turn off the search feature by group but I think just turning it off for unregistered users as a small motivation to register sounds like a plan. I thought someone did this before but if not anyone know the best way to turn off the search feature for unregistered users?
This is untested, but should work:

[6.3b4]

search.php

Code
// -----------------<br />// Get the user info<br />   $userob = new user;<br />   $user = $userob -> authenticate("U_Groups");                       <br />   if (!$user['U_Groups']) {<br />      $user['U_Groups'] = "-4-";<br />   }<br /><br />[:"red"]// Limit access to logged-in users.<br />   if (!$user['U_Username']) {<br />      $html = new html;<br />      $html -> not_right('You must be registered and logged in to perform this function.',$Cat);<br />   }[/]

Posted By: Lisa_P Re: Turn search off for unregistered users - 05/16/2003 6:07 PM
Dave's code should work fine - ours is almost the same and it works.

Code
// --------------------------------------------------------------------<br />   $html = new html;<br />   if (!$user['U_Username']) {<br />      $html -> not_right($ubbt_lang['LOGIN_OR_REG'],$Cat);<br />   }


and in language/generic.php we have:

Code
$ubbt_lang['LOGIN_OR_REG']  = 	"Please <a href='login.php'>login</a> or  <a href='newuser.php'>register</a> to use this function.";


(Because if we don't provide the link to login or register, I inevitably get people emailing me asking how. )


Just a note though - it doesn't disable the search at the bottom of the postlist page. They can still search each forum individually. We don't disable that because hopefully some people use it to prevent duplicate posts.
Posted By: coloradok5 Re: Turn search off for unregistered users - 05/16/2003 6:56 PM
Thanks guys, Josh sent me some code to, maybe this will help with site performance as well.
© UBB.Developers