Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   [TBDEV][08] v1 News Feed (http://www.bvlist.com/showthread.php?t=10363)

BamBam0077 9th May 2015 15:30

[TBDEV][08] v1 News Feed
 
Quote:


The MIT License (MIT)
Copyright © 2015 UniqueScene
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Edit index.php or if you have created your own block for news then edit that.
Here We Go!

Replace:


Code:

print("

");
if ($CURUSER) {
print("

  News  ");
if (get_user_class() >= UC_ADMINISTRATOR)
print("[News page]");
print("

\n");
$res = mysql_query("SELECT * FROM news WHERE ADDDATE(added, INTERVAL 45 DAY) > NOW() ORDER BY added DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
print("
\n
\n");

}

with:
Code:

    $adminbutton = ''; 
   
    if (get_user_class() >= UC_ADMINISTRATOR)
          $adminbutton = " News  page\n";
         
    echo "

         

         
Recent News{$adminbutton}

         

          ";
     
    $res = mysql_query("SELECT * FROM news WHERE ADDDATE(added, INTERVAL 45 DAY) > ".time()." ORDER BY added DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
   
    if (mysql_num_rows($res) > 0)
    {
    // require_once "include/bbcode_functions.php";

      $button = "";
     
      while($array = mysql_fetch_assoc($res))
      {
        if (get_user_class() >= UC_ADMINISTRATOR)
        {
          $button = "
 
";
        }
       
        echo "

             
Posted ". gmdate("d-M-y",strtotime($array['added'])) . "    {$array['title']}{$button}

             
\n";
       
        echo "

             
\n";
       
        echo "
".format_comment($array['body'])."

             

             
";
       
     
      }
   
    }

    echo "
\n";
Quote:

You may have to tweak this to suit your site I just got it to work a few minutes ago tbh and if any bugs please do report :ok:


Demon-Cod3rs 9th May 2015 17:07

cool


All times are GMT +2. The time now is 05:54.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.