Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's Collapsing Forums Block
Author Message
wolfear
Hangin' Around



Joined: Apr 19, 2006
Posts: 37
Location: San Antonio,Texas

PostPosted: Wed Apr 26, 2006 8:19 am Reply with quote

I only did a quick forum search, so if someone else has done this, sorry for the duplicate.
I had to make these changes to enable the Collapsing Forums block to work with my shared users.

I would assume this is only necessary if:
1. Have different $prefix and $user_prefix values in your config.php
2. Share common database amongst all sites and utilizing a "common_users" table.
3. Each site has an independant forum

Around line #72 change:
Code:
global $user_prefix, $db, $sitename, $admin, $user, $bgcolor1, $bgcolor2, $textcolor1, $textcolor2;

to
Code:
global $prefix, $user_prefix, $db, $sitename, $admin, $user, $bgcolor1, $bgcolor2, $textcolor1, $textcolor2;


Around line #123 change
Code:
$sql  = "SELECT config_value FROM ".$user_prefix."_bbconfig WHERE config_name='board_timezone'";

to
Code:


   $sql  = "SELECT config_value FROM ".$prefix."_bbconfig WHERE config_name='board_timezone'";


Around line #132 change
Code:
$sql = "SELECT user_id, username, user_posts, user_avatar, user_level, rank_title, rank_id FROM ".$user_prefix."_users u LEFT JOIN ".$user_prefix."_bbranks r on u.user_rank=r.rank_id where username NOT IN ($skipTopPostersUserNames) ORDER BY user_posts DESC LIMIT 0,$showTopPostersNum";

to
Code:
$sql = "SELECT user_id, username, user_posts, user_avatar, user_level, rank_title, rank_id FROM ".$user_prefix."_users u LEFT JOIN ".$prefix."_bbranks r on u.user_rank=r.rank_id where username NOT IN ($skipTopPostersUserNames) ORDER BY user_posts DESC LIMIT 0,$showTopPostersNum";


Around line #177 change
Code:
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order

FROM " . $user_prefix . "_bbcategories c, " . $user_prefix . "_bbforums f
WHERE f.cat_id = c.cat_id
GROUP BY c.cat_id, c.cat_title, c.cat_order
ORDER BY c.cat_order";

to
Code:
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order

FROM " . $prefix . "_bbcategories c, " . $prefix . "_bbforums f
WHERE f.cat_id = c.cat_id
GROUP BY c.cat_id, c.cat_title, c.cat_order
ORDER BY c.cat_order";


Around line #195 change
Code:
$sql = "SELECT * FROM " . $user_prefix . "_bbforums ORDER BY cat_id, forum_order";

to
Code:
$sql = "SELECT * FROM " . $prefix . "_bbforums ORDER BY cat_id, forum_order";


Around line #270 change
Code:
$result = $db->sql_query( "SELECT t.topic_id, t.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id, t.topic_status, f.forum_name FROM ".$user_prefix."_bbtopics t,".$user_prefix."_bbforums f WHERE t.forum_id NOT IN($hideTheseForums) AND t.forum_id=f.forum_id ORDER BY t.topic_last_post_id DESC");

to
Code:
$result = $db->sql_query( "SELECT t.topic_id, t.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id, t.topic_status, f.forum_name FROM ".$prefix."_bbtopics t,".$prefix."_bbforums f WHERE t.forum_id NOT IN($hideTheseForums) AND t.forum_id=f.forum_id ORDER BY t.topic_last_post_id DESC");


Around line #278 change
Code:
   $result1 = $db->sql_query( "SELECT auth_view, auth_read, forum_name, cat_id FROM ".$user_prefix."_bbforums where forum_id = '$forum_id'");

to
Code:
   $result1 = $db->sql_query( "SELECT auth_view, auth_read, forum_name, cat_id FROM ".$prefix."_bbforums where forum_id = '$forum_id'");


Around line #295 change
Code:
$result5 = $db->sql_query("SELECT cat_title FROM ".$user_prefix."_bbcategories where cat_id='$cat_id'");

to
Code:
$result5 = $db->sql_query("SELECT cat_title FROM ".$prefix."_bbcategories where cat_id='$cat_id'");


Around line #301 change
Code:
$result4 = $db->sql_query("SELECT u.username, u.user_id, p.poster_id, FROM_UNIXTIME(p.post_time + $userTimeZone) as post_time FROM ".$user_prefix."_users u, ".$user_prefix."_bbposts p where u.user_id=p.poster_id AND p.post_id='$topic_last_post_id'");

to
Code:
$result4 = $db->sql_query("SELECT u.username, u.user_id, p.poster_id, FROM_UNIXTIME(p.post_time + $userTimeZone) as post_time FROM ".$user_prefix."_users u, ".$prefix."_bbposts p where u.user_id=p.poster_id AND p.post_id='$topic_last_post_id'");


Hope that helps someone

_________________
Good judgement comes from experience, most of which comes from bad judgement.

chown /usr/beer
unmount /dev/brain 
View user's profile Send private message Visit poster's website Yahoo Messenger
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Wed Apr 26, 2006 10:33 am Reply with quote

Yea, some of those are obvious bugs. In such cases where $user_prefix is different from $prefix, we need to make sure $prefix is used for all tables EXCEPT the users (and users_temp) table

Good catches!

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's Collapsing Forums Block

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©