Can only the wall be deleted automatically?

Tamás Varga Posted in Technical Support 5 years 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 5 years ago

Arsalan: Thank you!

Indonesian Arsalan Shah Replied 5 years ago

Yes it requires to have a cron 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();
Premium Version

Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.

$199 (Life Time)
Learn More

Other Questions