Anyway to incorportate Top likes into Top Stats?

Download and support for PhpBB3 Top Stats Mod
Locked
corleoner
BBCoder II
BBCoder II
Posts: 19
Joined: 08 Feb 2014, 09:35
BBCodes: 3

Anyway to incorportate Top likes into Top Stats?

Post by corleoner »

OK, I realize there's the top 5 mod and I read this topic

https://www.phpbb.com/customise/db/mod/ ... 67#p182767

But I like the way Stoker's top stats mod looks on my index, I like the scrolling active topics and really didn't like the way the top 5 looked on my forum compared to the top stats which has a very nice look on my index.

Besides the active topics, I use top 5 replied topics (adjusted for the week, since I have a sports forum which needs fresh topics). The other stat I use is 5 most active users.

I'd love to be able to replace 5 most active users with "5 most liked users this month"

I like to create a bit of competition to increase quality and encourage positive contribution. Is there any way at all to incorportate this into the top stats mod?
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Anyway to incorportate Top likes into Top Stats?

Post by Stoker »

Sure its possible. But I dont have that MOD installed on any board, so Im not going to do it.
Board rules! No PM support
corleoner
BBCoder II
BBCoder II
Posts: 19
Joined: 08 Feb 2014, 09:35
BBCodes: 3

Anyway to incorportate Top likes into Top Stats?

Post by corleoner »

Ok. Thanks
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Anyway to incorportate Top likes into Top Stats?

Post by Stoker »

Maybe the thanks for posts author will do it.
Board rules! No PM support
corleoner
BBCoder II
BBCoder II
Posts: 19
Joined: 08 Feb 2014, 09:35
BBCodes: 3

Anyway to incorportate Top likes into Top Stats?

Post by corleoner »

That would be nice but I think he's lost interest in responding, I believe it's been a long while since he's responded to questions.

I appreciate the response and maybe as I learn more about the codes, I can learn how to make it work like they have been able to for the top five mod.

If I am able to make it work one day, I will definitely share the coding. Thanks Stoker

Nick
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Anyway to incorportate Top likes into Top Stats?

Post by Stoker »

Does Rich code work on his Top 5 mod?
If so we can do some testing this weekend. Should be easy to adapt his code to My mod.
But it will be without ACP control.
Board rules! No PM support
corleoner
BBCoder II
BBCoder II
Posts: 19
Joined: 08 Feb 2014, 09:35
BBCodes: 3

Anyway to incorportate Top likes into Top Stats?

Post by corleoner »

Yes, according to the users, it does work.

Rich included his code in this thread
https://www.phpbb.com/customise/db/mod/ ... 67#p182767

I am not concerned with any administration control, I would not be changing any settings on it once it's on the index. I can easily change the language to adjust the title of the Stat, and from there I would be set.

My goal would be to create a competition like atmosphere where the users would compete each month to try and be on the index for most liked for that month.

I know it probably sounds cheesy, but I think members on my forum enjoy the challenge to make it on the index, and in addition, having a like button is not as meaningful if there is not a reward for the good content. I think it's a fun way to encourage them to post good quality.

Just my thought. I'm willing to do whatever you need from me in regards to testing and tinkering with it. My knowledge is limited, but my effort is not.

I realize I may be a new guy around here, but my forum is new (launched Dec 1, 2013 and growing pretty quickly). I've never done a project like this, but I enjoy it very much, and you will be seeing much more of me, I will be a regular.

Raider-forums.com Please stop by and take a look if you like.

Nick
corleoner
BBCoder II
BBCoder II
Posts: 19
Joined: 08 Feb 2014, 09:35
BBCodes: 3

Anyway to incorportate Top likes into Top Stats?

Post by corleoner »

:twidle:








:P
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Anyway to incorportate Top likes into Top Stats?

Post by Stoker »

open includes/functions_top_stats.php
Find:

Code: Select all

}

?>
Before add:

Code: Select all

// top five thanked users
   if (($user_thanked = $cache->get('_top_five_thanked')) === false)
   {
       $user_thanked = array();

      $sql = 'SELECT COUNT(t.post_id) AS tally, u.user_id, u.username, u.user_colour
         FROM ' . THANKS_TABLE . ' t
         LEFT JOIN ' . USERS_TABLE . ' u ON t.poster_id = u.user_id         
         GROUP BY t.poster_id
         ORDER BY tally DESC';
      $result = $db->sql_query_limit($sql, 5);
      while ($row = $db->sql_fetchrow($result))
      {
         $user_thanked[$row['user_id']] = array(
            'user_id'      => $row['user_id'],
                'username'      => $row['username'],
                'user_colour'   => $row['user_colour'],
            'user_thanks'    => $row['tally'],
         );
      }
      $db->sql_freeresult($result);         

      // cache this data for 5 minutes, this improves performance
      $cache->put('_top_five_thanked', $user_thanked, 300);
    }

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

      $template->assign_block_vars('top_five_thanked',array(
         'THANKS'          => $row['user_thanks'] > 1 ? sprintf($user->lang['THANKEDS'], $row['user_thanks']) : sprintf($user->lang['THANKED'], $row['user_thanks']),
         'USERNAME_FULL'      => $username_string)
      );
    }
Open: language\en\mods\info_acp_topstats.php
Find:

Code: Select all

));

?>
Before add:

Code: Select all

'TOP_THANKED'      => 'Top Thanked Users',
   'THANKED'         => 'Thanked %d time',
   'THANKEDS'         => 'Thanked %d times',
Above is a direct copy of Rich code. I havent looked at the "last month" option. The code will just display top 5 thanked users.

Open \styles\prosilver\template\top_stats_body.html
Find:

Code: Select all

{L_MOST_ACTIVE_USERS}
Replace with:

Code: Select all

{L_TOP_THANKED}
Find:

Code: Select all

<!-- BEGIN most_active_users -->
			<li class="row">
			<dl>
				<dt style="width:70%;"><a style="font-size:1.1em; font-weight:bold; color: #{most_active_users.USER_COLOUR};" href="{most_active_users.USER_ID}" title="{L_JOINED_US} {most_active_users.USER_REG}">{most_active_users.USERNAME}</a></dt>
				<dd class="lastpost" style="width:auto;"><span style="font-size:1.1em;"><a href="{most_active_users.USER_POST_SEARCH}">{most_active_users.USER_POSTS}</a> ({most_active_users.USER_POST_PERCENT}%)</span></dd>
			</dl>
			</li>
			<!-- END most_active_users -->
Replace with:

Code: Select all

<!-- BEGIN top_five_thanked -->
			<li class="row">
			<dl>
				<dt style="width:70%;">{top_five_thanked.USERNAME_FULL}</dt>
				<dd class="lastpost" style="width:auto;">{top_five_thanked.THANKS}</dd>
			</dl>
			</li>
			<!-- END top_five_thanked -->
Board rules! No PM support
corleoner
BBCoder II
BBCoder II
Posts: 19
Joined: 08 Feb 2014, 09:35
BBCodes: 3

Anyway to incorportate Top likes into Top Stats?

Post by corleoner »

Thank you for the help Stoker. This is the error message I get when I do all of that:

Fatal error: Call to a member function get() on a non-object in. . .public_html/includes/functions_thanks_forum.php on line 72
Locked