Icy Phoenix

     
 


Post new topic  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post Exclude Forums From Recent Topics Block 
 
Hello there....once again,,,,

Can anyboty help me mod imp_recent_topics_wide.php to exclude some forums from beeing shown on recet topics block wide in portal?

Thanks in advance!
 



 
borboSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: Exclude Forums From Recent Topics Block 
 
After i've spent about an hour i found  how to do it and i posting the code i used if you want to check it or make a mod for this request...


file:blocks_imp_recent_topics_wide.php
Code: [Download] [Hide]
  1. <?php  
  2.  
  3. if ( !defined('IN_PHPBB') )  
  4. {  
  5.     die("Hacking attempt");  
  6. }  
  7.  
  8. if(!function_exists(imp_recent_topics_wide_block_func))  
  9. {  
  10.     function imp_recent_topics_wide_block_func()  
  11.     {  
  12.         global $template, $portal_config, $block_id, $userdata, $board_config, $db, $phpEx,$var_cache, $lang, $bbcode;  
  13.         global $html_on, $bbcode_on, $smilies_on;  
  14.  
  15.         $template->_tpldata['recent_topic_row.'] = array();  
  16.         //reset($template->_tpldata['recent_topic_row.']);  
  17.  
  18.         $bbcode->allow_html = $html_on;  
  19.         $bbcode->allow_bbcode = $bbcode_on;  
  20.         $bbcode->allow_smilies = $smilies_on;    
  21.           
  22.         $forum_data = array();  
  23.         if($portal_config['cache_enabled'])  
  24.         {  
  25.             $forum_data = $var_cache->get('forum', 90000, 'forum');  
  26.         }  
  27.         if(!$forum_data)  
  28.         {  
  29.           
  30.             $sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";  
  31.         if (!$result1 = $db->sql_query($sql))  
  32.         {  
  33.             message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);  
  34.         }  
  35.         $forum_data = array();  
  36.         while( $row1 = $db->sql_fetchrow($result1) )  
  37.         {  
  38.             $forum_data[] = $row1;  
  39.         }  
  40.         if($portal_config['cache_enabled'])  
  41.             {  
  42.                 $var_cache->save($forum_data, 'forum', 'forum');  
  43.             }  
  44.         }  
  45.         $is_auth_ary = array();  
  46.         $is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);  
  47.  
  48.         if( $portal_config['md_except_forum_id'] == '' )  
  49.         {  
  50.             $except_forum_id = ''start'';  
  51.         }  
  52.         else  
  53.         {  
  54.             $except_forum_id = $portal_config['md_except_forum_id'][$block_id];  
  55.         }  
  56.  
  57.         for ($i = 0; $i < count($forum_data); $i++)  
  58.         {  
  59.             //if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) || (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))  
  60.             if ( !$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read'] )  
  61.             {  
  62.                 if ($except_forum_id == ''start'')  
  63.                 {  
  64.                     $except_forum_id = $forum_data[$i]['forum_id'];  
  65.                 }  
  66.                 else  
  67.                 {  
  68.                     $except_forum_id .= ',' . $forum_data[$i]['forum_id'];  
  69.                 }  
  70.             }  
  71.         }  
  72.  
  73.         $extra = '';  
  74.  
  75.         if ($portal_config['md_show_not_forums']){  
  76.             $sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, f.forum_name  
  77.                 FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u, " . FORUMS_TABLE . " AS f  
  78.                 WHERE t.forum_id NOT IN (" . $except_forum_id . ")  
  79.                     AND t.topic_status <> 2  
  80.                     AND p.post_id = t.topic_last_post_id  
  81.                     AND p.poster_id = u.user_id  
  82.                     AND f.forum_id = t.forum_id  
  83.                     $extra  
  84.                 ORDER BY p.post_id DESC  
  85.                 LIMIT " . $portal_config['md_num_recent_topics_wide'][$block_id];  
  86.         }else{  
  87.             $sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username  
  88.                 FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u  
  89.                 WHERE t.forum_id IN (" . $except_forum_id . ")  
  90.                     AND t.topic_status <> 2  
  91.                     AND p.post_id = t.topic_last_post_id  
  92.                     AND p.poster_id = u.user_id  
  93.                     AND f.forum_id = t.forum_id  
  94.                     $extra  
  95.                 ORDER BY p.post_id DESC  
  96.                 LIMIT " . $portal_config['md_num_recent_topics_wide'][$block_id];  
  97.         }  
  98.  
  99.         if (!$result1 = $db->sql_query($sql))  
  100.         {  
  101.             message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);  
  102.         }  
  103.         $number_recent_topics = $db->sql_numrows($result1);  
  104.         $recent_topic_row = array();  
  105.         while ($row1 = $db->sql_fetchrow($result1))  
  106.         {  
  107.             $recent_topic_row[] = $row1;  
  108.         }  
  109.  
  110.         if($portal_config['md_recent_topics_wide_style'][$block_id] == 1 )  
  111.         {  
  112.             $style_row = 'scroll';  
  113.         }else  
  114.         {  
  115.             $style_row = 'static';  
  116.         }  
  117.  
  118.         $template->assign_block_vars($style_row,"");  
  119.  
  120.         for ($i = 0; $i < $number_recent_topics; $i++)  
  121.         {  
  122.             $orig_word = array();  
  123.             $replacement_word = array();  
  124.             obtain_word_list($orig_word, $replacement_word);  
  125.  
  126.             if ( !empty($orig_word) )  
  127.             {  
  128.                 $recent_topic_row[$i]['topic_title'] = ( !empty($recent_topic_row[$i]['topic_title']) ) ? preg_replace($orig_word, $replacement_word, $recent_topic_row[$i]['topic_title']) : '';  
  129.             }  
  130.             $recent_topic_row[$i]['username'] = color_group_colorize_name($recent_topic_row[$i]['user_id']);  
  131.  
  132.             $template->assign_block_vars($style_row . '.recent_topic_row', array(  
  133.                 'U_FORUM' => append_sid(VIEWFORUM_MG . '?' . POST_FORUM_URL . '=' . $recent_topic_row[$i]['forum_id']),  
  134.                 'L_FORUM' => $recent_topic_row[$i]['forum_name'],  
  135.                 'U_TITLE' => append_sid(VIEWTOPIC_MG . '?' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' .$recent_topic_row[$i]['post_id'],  
  136.                 'L_TITLE' => $bbcode->parse($recent_topic_row[$i]['topic_title'], $bbcode_uid, true),  
  137.                 'L_BY' => $lang['By'],  
  138.                 'L_ON' => $lang['On'],  
  139.                 'S_POSTER' => $recent_topic_row[$i]['username'],  
  140.                 'S_POSTTIME' => create_date2($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])  
  141.                 )  
  142.             );  
  143.         }  
  144.         $template->assign_vars(array(  
  145.             'BY' => $lang['by'],  
  146.             'ON' => $lang['on']  
  147.             ));  
  148.     }  
  149. }  
  150.  
  151. imp_recent_topics_wide_block_func();  
  152. ?> 



file:blocks_imp_recent_topics_wide.cfg
Code: [Download] [Hide]
  1. <?php  
  2.  
  3. if ( !defined('IN_PHPBB') )  
  4. {  
  5.     die("Hacking attempt");  
  6. }  
  7.  
  8. $block_count_variables = 4;  
  9.  
  10. // array( <Field label>, <Field Info>, <Config Name>, <Options>, <Field Values>, <Control Type>, <Block>, <Default Value>);  
  11.  
  12. $block_variables = array(  
  13.     array('Number of recent topics', 'number of topics displayed', 'md_num_recent_topics_wide', '', '', '1', 'recent_topics_wide', '10'),  
  14.     array('Recent Topics Style', 'choose static display or scrolling display', 'md_recent_topics_wide_style', 'Static,Scroll', '0,1', '3', 'recent_topics_wide', '1'),  
  15.     array('Recent Topic Forums', 'comma delimited', 'md_except_forum_id', '', '', '1', 'recent_topics', '1'),  
  16.     array('Show not', 'tick, if listed forums is not to be shown', 'md_show_not_forums', '', '', '4', 'recent_topics', '0')  
  17.     );  
  18. ?> 



I'll feel very happy and helpful if you find it usefull and add it to the customizatios....he he

Regards
 



 
borboSend private message  
Back to topPage bottom
Post new topic  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events