This topic is locked
[SOLVED]

 Filter old posts

1/18/2017 7:21:26 PM
PHPRunner General questions
Tandy author

Hello all,

I was just wondering if it is possible to filter out old posts from the list page?

what I would like to to is not let members delete posts. but after the post has been on the board for two days it get filters out of the list page.
What I am building is a load board for truckers. I would like shippers to post there loads. Then the truckers can find the load and if interested they take the load. Now that load can be filtered off the board some how. But if the load does not get taken or the shipper forgets to filter it off the board. The board auto filters it after 48 hours max. Then if the load was not moved. The shipper can come back in and copy the post to re submit to the board for another 48 hours.

Hope that makes sense. Here is a code that worked with AppGini before I found PHPrunner:
function loads_init(&$options, $memberInfo, &$args){

if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1]){

addFilter(1, 'and', 3, 'greater-than-or-equal-to', date('m/d/Y'));

}
return TRUE;

}
in the addFilter part the 3 was the value field of date the post was made.
My PHP Runner is: Enterprise 9.6 (Build 27826 x64)
I can post the URL of the post explaining this to me but then it is a different software system so I do not know if it will work here.
Thank for anyone trying to help at this one.

James

Sergey Kornilov admin 1/18/2017
jadachDevClub member 1/18/2017

I use MS SQL Server and for cases like this, I schedule jobs to move data from one table to another based on some criteria. Example would be archiving old data that is 30 days old.
You can then allow users to re-post from the archive table back on to the list.
I use a stored procedure to do my work and schedule it to run each night.
Just a thought.

Tandy author 1/18/2017



I use MS SQL Server and for cases like this, I schedule jobs to move data from one table to another based on some criteria. Example would be archiving old data that is 30 days old.
You can then allow users to re-post from the archive table back on to the list.
I use a stored procedure to do my work and schedule it to run each night.
Just a thought.


That is a good plan. Where can I go to read on how to setting up an archived posts as well as how they re-posts.
So far with Thanks to admin and this post: http://xlinesoft.com..._on_the_fly.htm

I got the post to hide after 2 days.

Now I just got to figure out how to set up a button or something if the load gets moved before the 2 days are up.

Then on how to do what you said. and have it get moved to a archive table and be able to let them re-post it..

Tandy author 1/19/2017

I found out the Save old data record in another table.

But I must be doing something wrong.

I have copied the table in mysql so everything is the same. Then I changed the name to that table to trucks_archive and imported the new table into mysql.

I then when to the events page and added:
//** Save old data record in another table ****

// Insert record using Data Access Layer (DAL).

// Another table needs to be part of the project.

global $dal;
$tblEvents = $dal->Table("trucks_archive");

$tblEvents->Value["carrier_id"]=$oldvalues["carrier_id"];

$tblEvents->Value["account_id"]=$oldvalues["account_id"];

$tblEvents->Value["submit_date"]=$oldvalues["submit_date"];

$tblEvents->Value["carrier_name"]=$oldvalues["carrier_name"];

$tblEvents->Value["available_date"]=$oldvalues["available_date"];

$tblEvents->Value["origin_country"]=$oldvalues["origin_country"];

$tblEvents->Value["origin_state"]=$oldvalues["origin_state"];

$tblEvents->Value["origin_city"]=$oldvalues["origin_city"];

$tblEvents->Value["trailer_type"]=$oldvalues["trailer_type"];

$tblEvents->Value["full_partial"]=$oldvalues["full_partial"];

$tblEvents->Value["destination_country"]=$oldvalues["destination_country"];

$tblEvents->Value["destination_state"]=$oldvalues["destination_state"];

$tblEvents->Value["destination_city"]=$oldvalues["destination_city"];

$tblEvents->Add();
I then when off and made a test post and deleted it. It did not copy and insert to trucks_archive table? Is there something I am doing wrong? I have checked all spelling and made sure everything is the same. Is there something else I need to put in?
Thanks for your help..

James