Python Forum

Full Version: Unanswered Posts link
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
That plugin author has never once responded to any of my support questions or github issues. 
https://github.com/lukasamd/MyBB-View_Unanswered_Posts

Since this plugin just automates the search function with a link to it, and the search allows to select a start date, there must be a way. If someone wants to scan the php files to try some things, let me know. This plugin is fairly safe to "test" different things as its just reading from the database, and not writing it it.

Ive been looking through that plugin php files, and i cant find where i would put a condition to check only from a certain date
I am assuming it would be in this method
https://github.com/lukasamd/MyBB-View_Un...s.php#L187
It would be in the query. Here:


$sql = "SELECT tid
            FROM " . TABLE_PREFIX . "threads 
            WHERE {$this->where} >>> May be here. I barely know sql
            ORDER BY dateline DESC
            LIMIT 500";
Ok, so between the where and order lines, we could add: (to only show threads from the past 60 days)
and dateline >= dateadd(now(), interval -60 day)
...assuming we're using mysql.
(Oct-08-2016, 07:13 PM)nilamo Wrote: [ -> ]Ok, so between the where and order lines, we could add: (to only show threads from the past 60 days)
and dateline >= dateadd(now(), interval -60 day)
...assuming we're using mysql.

Yes it is mysql.

This did not work. But create a mysql error when searching.
Shouldn't that be date_add? And is dateline the correct type?
and t.date >= ( CURDATE() - INTERVAL 3 DAY )
I am just copy and pasting
I can only read sql.
I have no idea. I dont do anything with mysql. If another mod was to tinker with the code that is better at mysql...have at it.

Quote:Shouldn't that be date_add?
I can try it


Just to confirm, you mean this

        // Make a query to search unanswered topics
        $sql = "SELECT tid
            FROM " . TABLE_PREFIX . "threads 
            WHERE {$this->where}
            ORDER BY dateline DESC
            LIMIT 500";
        $result = $db->query($sql);
to this
        // Make a query to search unanswered topics
        $sql = "SELECT tid
            FROM " . TABLE_PREFIX . "threads 
            WHERE {$this->where}
            and dateline >= date_add(now(), interval -1 day)
            ORDER BY dateline DESC
            LIMIT 500";
        $result = $db->query($sql);
EDIT:
Currently this last is what it is, and i still see an old post (more than 1 day) with 0 posts on the search query.
I use a lot of sql, but I don't use sql functions much, and I don't remember php. Assuming {$this->where} resolves to an expression, that should work.
Exactly. I've read it from Stack Overflow. But this is far from me.
But may be here there is more adequate answers. Ot the same question.
I dont think that worked. Currently it shows (3), but none when you select it. 

And there are at least 1 thread without any responses older than 1 day (much older), 1 thread without any response just recently, and then 1 more, etc.

So i am going to comment that out for now.
Pages: 1 2 3