Can only the wall be deleted automatically?

Tamás Varga Posted in Technical Support 2 weeks ago

Can it be solved that only the wall entries will be deleted automatically by the admin after 2 weeks?

Replies
Hungarian Tamás Varga Replied 1 week ago

Arsalan: Thank you!

German Arsalan Shah Replied 1 week ago

Yes it requires to have a corn job to be written.

<?php
define('OSSN_ALLOW_SYSTEM_START', TRUE);
require_once('system/start.php'); //change to full path to system/start.php file

function delete_2weeks_posts(){
    $wall = new OssnWall;
    $listUser = $wall->GetPosts(array(
            'page_limit' => false,
            'wheres' => array(
                    "(FROM_UNIXTIME(o.time_created) >= DATE_SUB(NOW(), INTERVAL 2 WEEK))"               
            );
    ));
    if($listUser){
        foreach($listUser as $post){
            $post->deleteObject($post->guid);
            ossn_trigger_callback('post', 'delete', $post->guid);   
        }
    }
}
delete_2weeks_posts();