Log in

View Full Version : Finding the forumid from a getnew search string


Mark.B
12-23-2009, 03:24 PM
I need to pull the forumid variable from the getnew search string:

eg

search.php?do=getnew&f=139

I always thought this would be $_GET["f"] but it's not.

How can I use this variable? Basically I need to do a check to see if it exists. What I want to do is show something extra on the results page if the string is just search.php?do=getnew compared to where a forum is specified eg search.php?do=getnew&f=139

Lynne
12-23-2009, 03:43 PM
Did you try $vbulletin->GPC['f'] or $vbulletin->GPC['forumid'] ? And don't forget to run the variable through the cleaner first.

Mark.B
12-23-2009, 03:59 PM
Did you try $vbulletin->GPC['f'] or $vbulletin->GPC['forumid'] ? And don't forget to run the variable through the cleaner first.
Not tried that...will do so now.

--------------- Added 1261592583 at 1261592583 ---------------

Hmm...neither of those return any value.

Lynne
12-23-2009, 04:30 PM
Sounds like something else is wrong with your code. You can see this right in the search page:
$vbulletin->input->clean_array_gpc('r', array(
'f' => TYPE_UINT,
'days' => TYPE_UINT,
'exclude' => TYPE_NOHTML,
'include' => TYPE_NOHTML,
'showposts' => TYPE_BOOL,
'oldmethod' => TYPE_BOOL,
'sortby' => TYPE_NOHTML,
'noannounce' => TYPE_BOOL,
'contenttype' => TYPE_NOHTML,
'type' => TYPE_STR
));
So, 'f' is what you want.

Mark.B
12-23-2009, 04:48 PM
That's really odd....

Mine is like this:

$vbulletin->input->clean_array_gpc('r', array(
'days' => TYPE_UINT,
'exclude' => TYPE_NOHTML,
'include' => TYPE_NOHTML,
'showposts' => TYPE_BOOL,
'oldmethod' => TYPE_BOOL,
'sortby' => TYPE_NOHTML,
'noannounce' => TYPE_BOOL,
));

But even if I add the line in, I still get nothing.

I am not sure I am hooking this into the right area of the file. As a test I have tried simply setting a simple variable, eg $test= 3; by hacking it into that area of the file, and it does not spit out if you put $test in the template. So that might be my problem, am I looking in the wrong area? I am right after if ($_REQUEST['do'] == 'getnew' OR $_REQUEST['do'] == 'getdaily')
and I'm thinking, if setting a simple variable THERE will not echo out on a getnew search, then is this something to do with the URL string changing to a search ID when the search is displayed?

Am I making any sense?

Lynne
12-23-2009, 05:12 PM
Whoops, I was looking at the vb4 file.

It doesn't look like that variable gets passed for getnew. So, you would have to add it yourself.

Mark.B
12-23-2009, 05:59 PM
Thanks Lynne....would that just be a matter of adding that line?

Lynne
12-23-2009, 09:53 PM
Well, you would have to at least add a line to clean the variable for use.