● Forum News Module

Fri Apr 01, 2016 1:30 pm
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Description: Display news from a selected forum on your homepage.

This was suppost to just get Thomas started on the idea, but I got carried away.

Features:
  • Displays almost all BBcodes.
  • Truncate the post to a number of characters any html tags that are cut off will be automatically added so its always 100% valid code.
  • Displays posted by and the time posted on.
  • Comment count is the number of replys.
  • Title and comments link to the forum thread.
  • Has its own pagination.
  • Set number of articles to show per page.
  • Social buttons uses thread titles and links to the thread. Can turn on and off.
  • Each article is in its own nuke table so it will match the theme. Cant see them very well in my screen grap becuase my nuke tables are just black boxes that are 80% transparent.
  • Displays the thread icon next to title if you use the module with this added. Evo only


Demo:
Please login to see this link
Get registered or Log in


Everyone is welcome to use/modify do what they like with it. the code is very well commented.

Read the config at the top of index.php to set it up. Set the module as the home module to replace your default news.

If you use this on your site please post a link so i can check out how it looks on different themes. I will help with any bugs you may encounter but because its free your be at the bottom of the list.

Version 2 (single forum)
Please login to see this link
Get registered or Log in


Version 3 (allows any topic from any forum)
Please login to see this link
Get registered or Log in


Mods:
(note: if you are using v2 youtube.be, usernamecolor, topic icon and evo image resize have already been added to the module.)
  • lytebox bbcode mod (Noto)
  • youtube.be mod (DreAdeDcoRpSE)
  • Replace HTML Newsletter News with News from the Forum_News module (Noto)
  • UsernameColor (OBTeo) or UsernameColor (Noto)
  • Resize images for Forum news module (Noto)
  • Stickynote / Float Left/Right bbcode (DreAdeDcoRpSE)
  • Large gap under 1st item fix. (Noto)




below are a list of all the mods from ClanThemes.
Mods will also be added to our downloads section soon, if you want the mods, you can PM me and I will send it to you.


Expand
Fri Apr 01, 2016 1:33 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Mod #1 - Lytebox

#########################################################
He is the bbcode for lytebox.

Open evo_bbcode.php find:

Code: [ Select all ]

$bbcode_tpl['img'] = "<img src=\"$1\" border=\"0\" alt=\"\" />";


After on a new line add:

Code: [ Select all ]

$bbcode_tpl['lytebox'] = "<a href=\"$3\" rel=\"lytebox\"><img style=\"border:2px dotted;\" src=\"$3\" width=\"$1\" height=\"$2\" border=\"0\" alt=\"\" /></a>";


Find:

Code: [ Select all ]

$replacements[] = $bbcode_tpl['img'];


After on a new line add:

Code: [ Select all ]

$patterns[] = "#\[lytebox width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9]):$bbcode_uid\](.*?)\[/lytebox:$bbcode_uid\]#si";
$replacements[] = $bbcode_tpl['lytebox'];


Save file and upload.


 
Fri Apr 01, 2016 1:38 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Mod #2 - youtube.be

For those that use this module and have Evo, and implemented the Youtube update from here -
Please login to see this link
Get registered or Log in


that allows the new youtube.be link to show, then you will want to do the following. Thanks to SgtLegend for the update for the forums, but to update this module, you will do the same fix.

Open up the Root/modules/Forums_News/bbcode.php

Find:

Code: [ Select all ]

      $patterns[] = "#\[youtube\]http://[A-Za-z0-9.]{2,5}.youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#si";
      $replacements[] = $bbcode_tpl['youtube'];


Replace with:

Code: [ Select all ]

      $patterns[] = "#\[youtube\]http://[A-Za-z0-9.]{2,5}.youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is";
        $replacements[] = $bbcode_tpl['youtube'];
       $patterns[] = "#\[youtube\]http://youtu.be/([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is";
        $replacements[] = $bbcode_tpl['youtube'];


Save & Upload

Now with this, it will play both youtube.com and youtube.be links.


 
Fri Apr 01, 2016 1:41 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Mod 3: HTML NewsLetter

##########################################################
Mod: Replace HTML Newsletter News with News from the Forum_News module.

This will replace the default News on the News letter with your forum news. So in the HTML Newsletter admin Latest News Items: will only show your news from your forum news not the default news module. The control for how many news items to show will still work.

Take backup of all files you edit.

Open modules\HTML_Newsletter\admin\admin_make_nls.php

Find:

Code: [ Select all ]

/************************************************************************
* Build the Latest X News Items - to replace the {NEWS} tag
************************************************************************/

And:

Code: [ Select all ]

} //End IF for Latest X News Items


Replace all the code inbetween, including what you searched for with:

Code: [ Select all ]

/************************************************************************
* Build the Latest X News Items - to replace the {NEWS} tag
************************************************************************/
 
if ( $_POST['msnl_news'] > 0 && $msnl_sTemplateNm != "notemplate" ) {

   $forum_id = 4;  // set to your news forum id, you can get your id by looking at its url modules.php?name=Forums&file=viewforum&f=4   ------ f=4 so 4 is the forum i am using.
   $i               = 0;
   $msnl_sRows   = "";

   $sql            = "SELECT "
                        ."t.`topic_id` AS topic_id, "
                        ."t.`forum_id` AS forum_id, "
                        ."`topic_last_post_id`, "
                        ."`topic_title`, "
                        ."`topic_views`, "
                        ."`topic_replies`, "
                        ."`post_time`, "
                        ."ut.`username` AS ut_username, "
                        ."ut.`user_id` AS ut_user_id, "
                        ."up.`username` AS up_username, "
                        ."up.`user_id` AS up_user_id "
                     ."FROM `"
                        .$prefix."_bbtopics` t, `"
                        .$prefix."_bbforums` f, `"
                        .$prefix."_bbposts` p, `"
                        .$prefix."_users` ut, `"
                        .$prefix."_users` up "
                     ."WHERE "
                        ."f.`forum_id` = t.`forum_id` "
                     ."AND "
                        ."`post_id` = `topic_last_post_id` "
                     ."AND "
                        ."ut.`user_id` = `topic_poster` "
                     ."AND "
                        ."up.`user_id` = `poster_id` ";

   if ( $msnl_iHideReadOnly == 1 ) {  //Exclude posts which should be hidden

      $sql .= "AND `auth_view` = '0' AND `auth_read` = '0' ";

   }

   $sql .= "AND `topic_moved_id` = '0' "
            . "AND f.`forum_id`=$forum_id ORDER BY `topic_id` DESC LIMIT 0, ". $_POST['msnl_news'];

   $result11   = msnl_fSQLCall( $sql );

   if ( !$result11 ) { //Bad SQL call

      msnl_fRaiseAppError( _MSNL_ADM_MAKE_ERR_DBGETPOSTS );   

   } else { //Successful SQL call

      while ( $row = $db->sql_fetchrow( $result11 ) ) {

         $msnl_iTopicID                     = intval( $row['topic_id'] );
         $msnl_iForumID                     = intval( $row['forum_id'] );
         $msnl_iPostID                        = intval( $row['topic_last_post_id'] );
         $msnl_sTopicTitle                  = stripslashes( $row['topic_title'] );
         $msnl_iTopicViews                  = intval( $row['topic_views'] );
         $msnl_iTopicReplies               = intval( $row['topic_replies'] );
         $msnl_sPostTime                     = msnl_fFormatDate( $msnl_asPHPBBCfg['default_dateformat'],
                                                         $row['post_time'], $msnl_asPHPBBCfg['board_timezone'] );
         $msnl_sTopicPosterNm            = stripslashes( $row['ut_username'] );
         $msnl_sTopicPosterID            = intval( $row['ut_user_id'] );
         $msnl_sLastPosterNm               = stripslashes( $row['up_username'] );
         $msnl_iLastPosterID               = intval( $row['up_user_id'] );

         $i         = ++$i; //Keep track of row number

         $msnl_sRowTmp = $latestnewsrow;

         $msnl_sRowTmp = str_replace( "{ROWNUMBER}",               $i,                            $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FTOPICLASTPOSTID}",   $msnl_iPostID,             $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FTOPICID}",               $msnl_iTopicID,          $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FTOPICREPLIES}",         $msnl_iTopicReplies,   $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FTOPICTITLE}",            $msnl_sTopicTitle,       $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FTPUSERID}",               $msnl_iTopicPosterID,   $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FTPUSERNAME}",            $msnl_sTopicPosterNm,   $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FVIEWS}",                  $msnl_iTopicViews,      $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FTIME}",                     $msnl_sPostTime,         $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FUSERID}",                  $msnl_iLastPosterID,   $msnl_sRowTmp );
         $msnl_sRowTmp = str_replace( "{FUSERNAME}",               $msnl_sLastPosterNm,   $msnl_sRowTmp );

         $msnl_sRows .= $msnl_sRowTmp;

      } //End While
      
      $msnl_sLatestNews = $latestnewstop . $msnl_sRows . $latestnewsend;
      
      $msnl_sLatestNews = str_replace( "{AMOUNT}",   $_POST['msnl_news'],   $msnl_sLatestNews );

   }  //End IF DB call successful

} else { //Will not be including Latest Forum Posts

   $msnl_sLatestNews = "";

} //End IF for Latest X News Items


Find:

Code: [ Select all ]

$forum_id = 4;  // set to your news forum id, you can get your id by looking at its url modules.php?name=Forums&file=viewforum&f=4   ------ f=4 so 4 is the forum i am using.


Replace: Just like you did in the Forum_News module.

Code: [ Select all ]

$forum_id = 4;
With your news forum id.

Open modules\HTML_Newsletter\templates\Plain_Jane\template.php

Find:

Code: [ Select all ]

$latestnewstop = "
<div class=\"content\">
<div class=\"title\"><a href=\"{SITEURL}/modules.php?name=News\">Our {AMOUNT} latest news items.</a></div>
<table width=\"100%\" align=\"center\">
   <tr class=\"subtitle\">
      <td width=\"5%\">
      </td>
      <td>
         Title
      </td>
      <td width=\"15%\">
         Topic
      </td>
      <td width=\"15%\">
         Author
      </td>
   </tr>";

$latestnewsrow =
   "<tr class=\"row\">
      <td>
         <a href=\"{SITEURL}/modules.php?name=News&file=article&sid={NEWSID}&mode=&order=0&thold=0\">
            {ROWNUMBER}
         </a>
      </td>
      <td>
         <a href=\"{SITEURL}/modules.php?name=News&file=article&sid={NEWSID}&mode=&order=0&thold=0\">
            {TITLE} ({HITS} hits)
         </a>
      </td>
      <td>
         <a href=\"{SITEURL}/modules.php?name=News&new_topic={TOPICID}\">
            {TOPIC}
         </a>
      </td>
      <td>
         {AUTHOR}
      </td>
   </tr>";

$latestnewsend =
"</table>
</div>";


Replace with:

Code: [ Select all ]

$latestnewstop .= "
<div class=\"content\">
<div class=\"title\"><a href=\"{SITEURL}\" title=\"Our latest news items\">Our {AMOUNT} latest news items.</a></div>
<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" align=\"center\">
   <tr class=\"subtitle\">
      <td width=\"5%\">
      </td>
      <td>
         Topic
      </td>
      <td width=\"7%\">
         Comments
      </td>
      <td width=\"10%\">
         Author
      </td>
      <td width=\"7%\">
         Viewed
      </td>
      <td width=\"23%\">
         Latest Comment
      </td>
   </tr>";

$latestnewsrow =
"   <tr class=\"row\">
      <td>
         {ROWNUMBER}
      </td>
      <td>
         <a href=\"{SITEURL}/modules.php?name=Forums&file=viewtopic&t={FTOPICID}\">
            {FTOPICTITLE}
         </a>
      </td>
      <td>
         {FTOPICREPLIES}
      </td>
      <td>
         <a href=\"{SITEURL}/modules.php?name=Forums&file=profile&mode=viewprofile&u={FTPUSERID}\">
            {FTPUSERNAME}
         </a>
      </td>
      <td>
         {FVIEWS}
      </td>
      <td>
         {FTIME}
         <br>
         <a href=\"{SITEURL}/modules.php?name=Forums&file=profile&mode=viewprofile&u={FUSERID}\">
            {FUSERNAME}
         </a>
      </td>
   </tr>";

$latestnewsend =
"</table>
</div>";


Other templates will probably vary, styles ect.. Its up to you to modify other templates.

Mod Finished: Save and upload. I hope thats what your after Dread.


 
Fri Apr 01, 2016 1:42 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Mod 4: UserName Color

#####################################################################

Yea he uses this module. Here you go was simple.

--------------------------------------------------------------------------------------------------------------
AUC (Advanced username colour) Extreme only mod.

Open: modules/Forum_News/index.php

Find:

Code: [ Select all ]

<a href=\"modules.php?name=Your_Account&op=userinfo&username=".mysql_result($result2, 0, 'username')."\">".mysql_result($result2, 0, 'username')."</a>

Replace with:

Code: [ Select all ]

<a href=\"modules.php?name=Your_Account&op=userinfo&username=".mysql_result($result2, 0, 'username')."\">".UsernameColor(mysql_result($result2, 0, 'username'))."</a>


Save upload done!
--------------------------------------------------------------------------------------------------------------
 
EDIT: i was adding the mods to the 1st post and noticed that OBTeo had already posted this. Vivi you tit, waste my time.  LMAO

Ive put all the mods in the 1st post so they are easy to find.


 
Fri Apr 01, 2016 1:43 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Mod 5: Resize images

#######################################################################
Resize images for Forum news module. (Extreme only, Raven dont have this)

Open: includes/javascript.php
Find:

Code: [ Select all ]

$name == 'News'

After add:

Code: [ Select all ]

 || $name == 'Forum_News'

Full line will look something like this once edited.

Code: [ Select all ]

    if((empty($name) || $name == 'News' || $name == 'Forum_News' || $name == 'Reviews' || $name == 'Stories Archive' || $name == 'Downloads' || $name == 'Web Links' || $name == 'Content') && !defined('IN_PHPBB')) {

Save and upload.

Open: modules/Forum_News/bbcode.php
Find: at the end of function parse_bbcode

Code: [ Select all ]

                $hometext = str_replace("
", '<br>', $hometext);
                return $hometext;

Replace with:

Code: [ Select all ]

                $hometext = str_replace("
", '<br>', $hometext);
                $hometext = evo_img_tag_to_resize($hometext);
                return $hometext;

Save and upload.

Done!


 
Fri Apr 01, 2016 1:44 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Mod 6: Sticky Note

#######################################################################
 
While I am here on the site, I might as well post how to input the

Stickynote bbcode mod:
Please login to see this link
Get registered or Log in

&
Float Left/Right bbcode mod:
Please login to see this link
Get registered or Log in



Open modules/Forum_News/bbcode.php :

Find:

Code: [ Select all ]

$bbcode_tpl['size_close'] = "</span>";


On new line, Add After:

Code: [ Select all ]

//Float Left/Right edits
      $bbcode_tpl['fr_open'] = "<div class=\"floatr\">";
      $bbcode_tpl['fr_close'] = "</div>";
      $bbcode_tpl['fl_open'] = "<div class=\"floatl\">";
      $bbcode_tpl['fl_close'] = "</div>";
      //StickyNote edits
      $bbcode_tpl['sn_open'] = '<div class="rotate-1"><div class="postit"><font color="#000000">';
      $bbcode_tpl['sn_close'] = "</font></div></div>";




Find:

Code: [ Select all ]

$hometext = str_replace("[/size:$bbcode_uid]", $bbcode_tpl['size_close'], $hometext);


On new line, Add After:

Code: [ Select all ]

//Float Left/Right Edits      
         $hometext = str_replace("[fr:$bbcode_uid]", $bbcode_tpl['fr_open'], $hometext);
      $hometext = str_replace("[fl:$bbcode_uid]", $bbcode_tpl['fl_open'], $hometext);
      $hometext = str_replace("[/fr:$bbcode_uid]", $bbcode_tpl['fr_close'], $hometext);
      $hometext = str_replace("[/fl:$bbcode_uid]", $bbcode_tpl['fl_close'], $hometext);
      //StickyNote Edit
      $hometext = str_replace("[sn:$bbcode_uid]", $bbcode_tpl['sn_open'], $hometext);
      $hometext = str_replace("[/sn:$bbcode_uid]", $bbcode_tpl['sn_close'], $hometext);




If you not running one but running the other, just cancel out the 2 or 4 lines that fall after the line saying what edits, for example, I will use the first set of edits. If I am running the float mod but not the sticky note mod, my edits would look like this:

Code: [ Select all ]

//Float Left/Right edits
      $bbcode_tpl['fr_open'] = "<div class=\"floatr\">";
      $bbcode_tpl['fr_close'] = "</div>";
      $bbcode_tpl['fl_open'] = "<div class=\"floatl\">";
      $bbcode_tpl['fl_close'] = "</div>";
      //StickyNote edits
      //$bbcode_tpl['sn_open'] = '<div class="rotate-1"><div class="postit"><font color="#000000">';
      //$bbcode_tpl['sn_close'] = "</font></div></div>";


All I did was add in a // before the lines I wanted to cancel out.

You will have to cancel out the edits in both sections of the file that you edit. Use a little thought, its not hard to understand or follow.

Enjoy...


 
Fri Apr 01, 2016 1:45 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3015 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 77.7hrs.
Total Played: 195hrs.


  
There is life outside of the game.
Reputation: 7317.9
votes: 7
Mod 7: Large gap under 1st item

#######################################################################
You have a css conflict.

Add this to your themes style.css

Code: [ Select all ]

.addthis_toolbox {
   height: 5px;
}


 
Forums ©