Warning: The author of this contribution does not provide support for it anymore.

Top Five

Only the Last Active Topic in the Footer - Top Five

Only the Last Active Topic in the Footer

by digiman123 » Mon Jan 13, 2014 8:48 pm

Hello Top Fivers!

I wonder if this MOD can be modified so it only shows a clickable 'last active topic' in the footer of the board. I don't want it to show the rest of the information like (the five most active users and the top five latest registered users). I'm using a RTL language board in prosilver and I'm a beginner.

any help would be appreciated,

Ali
digiman123
Registered User
Posts: 14
Joined: Mon Jan 13, 2014 9:25 am

Re: Only the Last Active Topic in the Footer

by 5hocK » Mon Jan 13, 2014 11:26 pm

Are you sure you want it in the footer? http://s30.postimg.org/fi6r25o9t/prosilver_footer.png
Or do you mean above that? Which is the index - just to be clear :)
With or without the border?
5hocK
Registered User
Posts: 3147
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK

Re: Only the Last Active Topic in the Footer

by digiman123 » Tue Jan 14, 2014 6:18 am

I want it to appear above "Who is Online" section and under Login area of the prosilver template.

Clickable, without border and perhaps with a customizable font size/color.

I'm sorry I'm a non-programmer so I thought the whole lower area is the footer :)

This is my forum: http://forum.noorpod.com/

Thanks for clarification.
Ali
digiman123
Registered User
Posts: 14
Joined: Mon Jan 13, 2014 9:25 am

Re: Only the Last Active Topic in the Footer

by 5hocK » Tue Jan 14, 2014 7:33 am

The easiest way is to install the Mod and then alter it a little to how you want it; and the simplest way to install a Mod is to use Automod.
Here's the basics of Automod.
  • Download Automod, unzip it and connect with ftp to your board
  • On the left, find the unzipped folder - you need to be inside the folder called root
  • Upload the contents of the root folder
  • Go to your forum to install - eg example.com/forum/install
  • Support
http://s20.postimg.org/yo2ts0459/ftp.png

In depth:
Installing Automod
Installing MODs with AutoMOD
[kb=tools-needed-to-set-up-and-customise-phpbb]Tools needed to set up and customise phpBB[/kb]
5hocK
Registered User
Posts: 3147
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK

Re: Only the Last Active Topic in the Footer

by digiman123 » Tue Jan 14, 2014 11:12 am

Shock,

Thanks a lot for teaching me all this. I did right according to that. And the Top Five Mod is now installed :)

I now need to remove Newest users column, Top active users column and change the English 'Newest Posts' text into its equivalent Persian. Are these too much or could be done by few changes?
digiman123
Registered User
Posts: 14
Joined: Mon Jan 13, 2014 9:25 am

Re: Only the Last Active Topic in the Footer

by 5hocK » Tue Jan 14, 2014 12:37 pm

Unzip the Mod you downloaded and look in root/language/en/mods you'll see a file called top_five.php
Open that file and you'll see this line

Code: Select all

    'NEWEST_TOPICS'      => 'Newest Posts',

Edit Newest Posts to Persian and then upload the file to language/fa/mods

Make sure to use a good editor like notepad++ (never notepad or wordpad) - Look under "Text editor programs" in the Tools needed link (above) for why :)
I now need to remove Newest users column, Top active users column

The file containing all this is in styles/prosilver/template/top_five_body.html (take a look, it's only basic html)
I'll get back to you on what to edit, need to have a look myself :geek:
5hocK
Registered User
Posts: 3147
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK

Re: Only the Last Active Topic in the Footer

by digiman123 » Tue Jan 14, 2014 2:34 pm

That's great! Thank you Shock! It worked! I also went to top_five_body.html and removed some lines by heart! :lol: The Top Five box of my forum has now only one column! Have I erased the correct lines?

Code: Select all

<div class="forabg">
   <div class="inner"><span class="corners-top"><span></span></span>
      <table class="table1" cellspacing="1" id="top_five">
      <thead>
      <tr>
         <th style="width: 50%;">{L_NEWEST_TOPICS}</th>
         
      </tr>
      </thead>
      <tbody>
         <tr class="bg2">
               <td valign="top"><!-- BEGIN top_five_topic --><!-- IF top_five_topic.NO_TOPIC_TITLE-->{top_five_topic.NO_TOPIC_TITLE}<!-- ELSE --><a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a><br />&nbsp;&nbsp;{top_five_topic.USERNAME_FULL}&nbsp;&nbsp;{top_five_topic.LAST_TOPIC_TIME}<br /><!-- ENDIF --><!-- END top_five_topic --></td>
            
            </tr>
      </tbody>
      </table>

   <span class="corners-bottom"><span></span></span></div>
</div>


So how to increase the font size of both the title and the content of the Top Five box?

And the final step: can I turn it to 1 or 2 recent posts instead of 5?

cheers,
Ali
digiman123
Registered User
Posts: 14
Joined: Mon Jan 13, 2014 9:25 am

Re: Only the Last Active Topic in the Footer

by 5hocK » Tue Jan 14, 2014 3:04 pm

The amount of topics is in the file includes/top_five.php
Find

Code: Select all

   $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 5);

Change the 5 to.....well you get the idea ;)

You still have a border right? And is it where you want it?
If you open template/index_body.html you will see <!-- INCLUDE top_five_body.html -->
The line can be moved up or down in the file, refresh templates after moving.

For font size try <font size="4">{top_five_topic.NO_TOPIC_TITLE}</font> for example back in the top_five_body.html file
5hocK
Registered User
Posts: 3147
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK

Re: Only the Last Active Topic in the Footer

by digiman123 » Tue Jan 14, 2014 4:25 pm

Worked great Sir!

I just can't figure out where to put the font size code, in the top_five_body.html, in order to see its effect.
digiman123
Registered User
Posts: 14
Joined: Mon Jan 13, 2014 9:25 am

Re: Only the Last Active Topic in the Footer

by 5hocK » Tue Jan 14, 2014 7:17 pm

This would change the title

Code: Select all

<font size="3">{top_five_topic.TOPIC_TITLE}</font>

Remember to refresh templates afterwards. You may have to delete your browser cache too.
5hocK
Registered User
Posts: 3147
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK

Re: Only the Last Active Topic in the Footer

by RMcGirr83 » Tue Jan 14, 2014 7:52 pm

Queries will still be run that don't need to be if not using top posters and newest posters.

<font size="3">{top_five_topic.TOPIC_TITLE}</font>


deprecated, use instead

Code: Select all

<span style="font-size:20px;">{top_five_topic.TOPIC_TITLE}</span>
change the 20

http://www.w3schools.com/html/html_css.asp
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Only the Last Active Topic in the Footer

by 5hocK » Tue Jan 14, 2014 8:00 pm

Could this be removed to stop the extra queries?

Code: Select all

      // grab users with most posts
       $sql = 'SELECT user_id, username, user_colour, user_posts
             FROM ' . USERS_TABLE . '
         WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
            AND user_posts <> 0
          ORDER BY user_posts DESC';
      $result = $db->sql_query_limit($sql, 5);

      while ($row = $db->sql_fetchrow($result))
      {
         $user_posts[$row['user_id']] = array(
            'user_id'      => $row['user_id'],
                'username'      => $row['username'],
                'user_colour'   => $row['user_colour'],
            'user_posts'    => $row['user_posts'],
         );
      }
        $db->sql_freeresult($result);

      // cache this data for five minutes, this improves performance
      $cache->put('_top_five_posters', $user_posts, 300);
   }

   foreach ($user_posts as $row)
   {
      $username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      $template->assign_block_vars('top_five_active',array(
         'S_SEARCH_ACTION'   => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&amp;sr=posts'),
         'POSTS'          => $row['user_posts'],
         'USERNAME_FULL'      => $username_string)
      );
    }

    // newest registered users
   if (($newest_users = $cache->get('_top_five_newest_users')) === false)
   {
       $newest_users = array();

       // grab most recent registered users
      $sql = 'SELECT user_id, username, user_colour, user_regdate
         FROM ' . USERS_TABLE . '
         WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
            AND user_inactive_reason = 0
         ORDER BY user_regdate DESC';
      $result = $db->sql_query_limit($sql, 5);

      while ($row = $db->sql_fetchrow($result))
      {
         $newest_users[$row['user_id']] = array(
            'user_id'            => $row['user_id'],
            'username'            => $row['username'],
              'user_colour'         => $row['user_colour'],
                'user_regdate'         => $row['user_regdate'],
         );
      }
       $db->sql_freeresult($result);

      // cache this data for ever, cache is purged when adding or deleting users
      $cache->put('_top_five_newest_users', $newest_users);
   }

   foreach ($newest_users as $row)
   {
      $username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      $template->assign_block_vars('top_five_newest',array(
         'REG_DATE'         => $user->format_date($row['user_regdate']),
         'USERNAME_FULL'      => $username_string)
      );
   }
}
5hocK
Registered User
Posts: 3147
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK

Re: Only the Last Active Topic in the Footer

by digiman123 » Tue Jan 14, 2014 9:06 pm

Thanks again Shock and Rich for your comments. You guys are really helpful.

I followed your comments and the Mod is accomplished! (at least from my viewpoint).

So if there was anything technical that I should edit or etc, I'll be more than glad to.
digiman123
Registered User
Posts: 14
Joined: Mon Jan 13, 2014 9:25 am