Log in

View Full Version : vbulletin search times for different user groups


Rastus
08-29-2009, 06:16 PM
I need to change the search options for different user groups and I can't seem to do it. for example for registered users I want them to be able to perform a search like every 5 minutes or so and paid members to be able to search every 30 seconds or so.

Seems I read a thread either on here or vb.org and now I can't locate it. any help is appreciated.

Lynne
08-29-2009, 07:05 PM
Just write a plugin. Something like:
if (in_array($vbulletin->userinfo['usergroupid'], array(x,y)))
{
$vbulletin->options['optionname'] = 'a';
}


(Find the option name in the page source for the vboptions page.)

Rastus
08-29-2009, 07:55 PM
so something like this should work?

if (in_array($vbulletin->userinfo['10'], array(x,y)))
{
$vbulletin->options['optionsform'] = '30';
}

Lynne
08-29-2009, 09:32 PM
No, that wouldn't work (you need to leave the variable name alone).

Actually better (I don't know why I didn't use this):
if (is_member_of($vbulletin->userinfo, x,y))
Where x,y are usergroupids (or even just one usergroupid)

Rastus
08-29-2009, 11:54 PM
Ok, I used this and with the hook location "search_start" and it does not seem to work. 2 is the usergroup id I want restricted to 480 seconds (4 minutes between searchs)

if (is_member_of($vbulletin->userinfo, 2))
{
$vbulletin->options['optionsform'] = '480';
}

Rastus
09-14-2009, 06:48 PM
Just write a plugin. Something like:
if (in_array($vbulletin->userinfo['usergroupid'], array(x,y)))
{
$vbulletin->options['optionname'] = 'a';
}


(Find the option name in the page source for the vboptions page.)

I'm still fighting this... where do I find the option name. ????

Lynne
09-14-2009, 06:54 PM
I'm still fighting this... where do I find the option name. ????
Find the option in vboptions - it's in Message Search Options > Minimum Time Between Searches. View the page source around it and the option name is right there several time (I highlighted a couple of them in red):

<tbody id="tbody_error_enablesearches" style="display:none"><tr><td class="alt1 smallfont" colspan="2"><div style="padding:4px; border:solid 1px red; background-color:white; color:black"><strong>Error</strong>:<div id="span_error_enablesearches">1</div></div></td></tr></tbody><tbody><tr valign="top">
<td class="optiontitle" title="$vbulletin->options['searchfloodtime']" colspan="2"><div class="smallfont" style="float:right"> <a href="options.php?do=editsetting&amp;varname=searchfloodtime">[Edit]</a> <a href="options.php?do=removesetting&amp;varname=searchfloodti me">[Delete]</a> </div><div>Minimum Time Between Searches<a name="searchfloodtime"></a></div></td>
</tr>
</tbody><tbody id="tbody_searchfloodtime">
<tr valign="top">
<td class="alt1"><div class="smallfont"title="$vbulletin->options['searchfloodtime']">The minimum time (in seconds) that must expire before the user can perform a new search.<br />
<br />
Set this to 0 to allow users to search as frequently as they want.</div></td>
<td class="alt1"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr valign="top"><td><div id="ctrl_setting[searchfloodtime]"><input type="text" class="bginput" name="setting[searchfloodtime]" id="it_setting[searchfloodtime]_275" value="20" size="40" dir="ltr" tabindex="1" title="name=&quot;setting[searchfloodtime]&quot;" /></div></td><td align="right" style="padding-left:4px"><a class="helplink" href="# (https://vborg.vbsupport.ru/view-source:http://test.thetradersden.org/forums/panadmin/options.php?do=options&dogroup=%5Ball%5D#)" onclick="js_open_help('options', 'options', 'searchfloodtime'); return false;"><img src="../cpstyles/vbtech/cp_help.gif" alt="" border="0" title="Click for help on this option" /></a> </td></tr></table></td>
</tr>
</tbody>

Rastus
09-14-2009, 09:26 PM
thanks Lynne. :up: Life is all good now

ludachris
01-10-2012, 07:00 PM
Just wanted to clarify - to make this work in 3.8, would the hook location be search_start for the plugin?

Lynne
01-10-2012, 07:19 PM
You can try that and see.

ludachris
01-10-2012, 10:38 PM
Doesn't look like it's working with that hook location. Here's the code I'm using:

if (is_member_of($vbulletin->userinfo, 5, 7, 10, 11, 106, 108, 107, 109))
{
$vbulletin->options['searchfloodtime'] = '1';
}
Should I try a different search hook location?

ludachris
01-12-2012, 03:01 PM
Lynne, does my code look right? Any suggestions on hook locations?

Lynne
01-12-2012, 05:24 PM
It looks correct. Look up the hook location and see if it is the best one for you to use. If you are in debug mode, you can see the list of hooks on the bottom of the page and perhaps pick a better one.