Posted in thread in the past 24hrs

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Get Involved
Locked
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Posted in thread in the past 24hrs

Post by janine »

Hi, I know this is an odd request, but I'm an odd girl ;)

Is there anyway to change the 'posted in the thread' icon to show up per 24 hrs instead of ever posted? Also, I need to be able to do this on a per forum basis.

I have one forum that threads will be replied to daily and it will be easier for the users to keep track of what threads that they posted in.


Thanks for any help :D

User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: Posted in thread in the past 24hrs

Post by janine »

Just bumping to see if anyone can help :)

User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: Posted in thread in the past 24hrs

Post by janine »

OK, I assume nobody knows how I can go about doing this? I guess I'll look for some other way.

User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: Posted in thread in the past 24hrs

Post by janine »

One last bump... 8-)

User avatar
3Di
Former Team Member
Posts: 15432
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Posted in thread in the past 24hrs

Post by 3Di »

janine wrote:Hi, I know this is an odd request, but I'm an odd girl ;)

Is there anyway to change the 'posted in the thread' icon to show up per 24 hrs instead of ever posted? Also, I need to be able to do this on a per forum basis.

I have one forum that threads will be replied to daily and it will be easier for the users to keep track of what threads that they posted in.


Thanks for any help :D

allright you are an odd girl.. with compliments though :) .. but what does that means: 'posted in the thread' ??



looking forward for an accurate explain.. regards.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
:studio_microphone: Premium extensions @ The Studio

User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: Posted in thread in the past 24hrs

Post by janine »

Well, you know how the icon changes when you reply to a topic? How it has the little star over it? I need this to change every 24 hours after a thread has been posted in.

Right now that little star will always be there when you replied to a topic. I need it to go back to normal once 24 hours is up.

It would be even better if I can pick which forums I can do this to as well.

I hope you understand what I mean! :D

User avatar
imkingdavid
Former Team Member
Posts: 2672
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: Posted in thread in the past 24hrs

Post by imkingdavid »

This works; I tested on my localhost.

However, it creates a new query for each topic in the list, which can be a memory hog on larger forums. Generally a query inside a loop is a bad idea, but I don't have the time to decipher the more complicated parent query to see how to implement this otherwise.

In the end, if it does cause too much of a slowdown, you can always just remove the changes.

Anyway, there are two edits you need to do in the same file.

Open: includes/functions_display.php

Find:

Code: Select all

function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$folder_alt, &$topic_type)
{
    global $user, $config; 
Inline Find:

Code: Select all

    global $user, $config
Inline After, Add:

Code: Select all

, $db
(The inline after add is basically just adding the , $db between the $config and the ;.)
The third line of the first find will look like this in the end:     global $user, $config, $db; 

Find:

Code: Select all

        // Posted image?
        if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted'])
        {
            $folder_img .= '_mine';
        } 
Replace with:

Code: Select all

        // Posted image?
        if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted'])
        {
            //---- imkingdavid - see if user has posted in topic in the last 24 hours \\
            // see when
            $sql = 'SELECT COUNT(post_id) AS test
                FROM ' . POSTS_TABLE . '
                WHERE topic_id = ' . $topic_row['topic_id'] . '
                    AND poster_id = ' . $user->data['user_id'] . '
                    AND post_time > ' . (int) (time() - 86400);
            $res = $db->sql_query($sql);
            $test = $db->sql_fetchfield('test');
            $db->sql_freeresult($res);
            if($test)
            {
                $folder_img .= '_mine';
            }
            //---- end imkingdavid MOD \\
        } 
Let me know how it works for you!
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.

User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: Posted in thread in the past 24hrs

Post by janine »

Thanks so much imkingdavid! I will give it a try now and will let you know how it goes. Is there a way to specify a forum id for this to happen in or is my only option to make this happen for the whole board? Thanks again! :D

Locked

Return to “[3.0.x] MOD Requests”