Page 1 of 1

Recent topisc block

Posted: 23. May 2009 09:17
by JirkaX
Your Portal Version: 1.0.3
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge
Boardlink: http://www.belariepark.cz

What have you done before the problem was there?


What have you already tryed to solve the problem?


Description and Message
Hi, I have question related to the Recent block. I set number of topics which should be displayed there to 8. But due to the fact that there is hidden part in my forum (some forums are visible for defined users only), number of showed topic is not 8, but it is lower. Only if the user can see all forums and topics he has all 8 recent topics shown.
Do you have any idea how to solve it?

Re: Recent topisc block

Posted: 27. May 2009 13:06
by JirkaX
No any idea?

Re: Recent topisc block

Posted: 27. May 2009 17:29
by Marc
Hm,
I think that might be a bug.

You could try the following:

Open portal/block/recent.php (not the template folder)
Find:

Code: Select all

if (sizeof($forum_ary))
{
$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
} 
Replace with:

Code: Select all

$forum_sql = '';
if (sizeof($forum_ary))
{
$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
$forum_sql = ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
} 
You have to do the following 3 times:
Find:

Code: Select all

' . $sql_where . ' 
Replace with:

Code: Select all

' . $sql_where . '' .  $forum_sql . ' 

That should fix it.

Re: Recent topisc block

Posted: 27. May 2009 21:59
by JirkaX
For registered users it seems to be ok, but for visitors error below is displayed.

SQL ERROR [ mysql4 ]

Column 'forum_id' in where clause is ambiguous [1052]

Re: Recent topisc block

Posted: 27. May 2009 22:09
by Marc
Ok, try this in addition to the other changes:

Open portal/block/recent.php

Find:

Code: Select all

$forum_sql = ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true); 
Replace with:

Code: Select all

$forum_sql = ' AND ' . $db->sql_in_set('t.forum_id', $forum_ary, true); 
Do this 3 times:
Find:

Code: Select all

FROM ' . TOPICS_TABLE . ' 
Replace with:

Code: Select all

FROM ' . TOPICS_TABLE . ' t

Re: Recent topisc block

Posted: 27. May 2009 22:16
by JirkaX
Ok, now it works, thanks a lot. But I did only 1st change, 2nd one (3 changes with t) I did not, because it doesn't make any sense to have two t one next to the other ... and it generates another sql error.

Re: Recent topisc block

Posted: 27. May 2009 22:48
by Marc
That's not what I meant. The code "FROM ' . TOPICS_TABLE . ' " appears 3 times in that file. ;)

Re: Recent topisc block

Posted: 28. May 2009 09:08
by JirkaX
Yes, I understand this, but there already was FROM ' . TOPICS_TABLE . ' t
If I follow your instructions properly, I will have FROM ' . TOPICS_TABLE . ' t t