FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » FUDApi - fetch categories (fud_fetch_cat_forums behavior)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
FUDApi - fetch categories [message #161924] Sun, 21 February 2010 03:56 Go to previous message
jlundan is currently offline  jlundan
Messages: 4
Registered: February 2010
Location: Finland
Karma:
Junior Member
Hi,

If assume correctly, the fud_fetch_cat_forums should return all forums inside given categories.

However, the function uses another FUDApi function called _fud_simple_fetch_query. This function is defined as:
function _fud_simple_fetch_query($arg, $query)
{
        if ($arg) {    
		$arg = is_numeric($arg) ? array($arg) : $arg;
	} else {
		$arg = array();
	}
	$result = array();
	$r = uq(str_replace('{ARG}', implode(',', $arg), $query));
	while ($row = db_rowobj($r)) {
		$result[] = $row;
	}
	unset($r);
	if ($arg && count($result) != count($arg)) {
		return FALSE;
	} else {
		if (count($result) == 1) {
			return array_pop($result);
		} else {
			return $result;
		}
	}
}


after unset($r); statement the code compares count of arguments into count of results. If the count of arguments does not match count of results the function returns false. This, as far as I understand, means that if I pass single category id into the function, I will get proper result if the category has only one forum inside of it. If the category has two forums or more, I get false.

I think this is a bug, or have I misunderstood something?
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Problem with FUDforum API global variables
Next Topic: Prefix on answers
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 16:14:32 GMT 2024

Total time taken to generate the page: 0.04482 seconds