Can only the wall be deleted automatically?

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

He also deleted everything in the groups. Fault.

Hungarian Tamás Varga Replied 3 years ago

July 29 has not been deleted now, all old ones have been deleted from the wall entries.

enter image description here

Hungarian Tamás Varga Replied 3 years ago

Thank you ~Z~Man, testing.

German Michael Zülsdorff Replied 3 years ago

Yes, because in line 18 of your code you used >= , but it has to be <=

(the dates you want to delete have to be SMALLER than the current date -14 days) and not greater)

Hungarian Tamás Varga Replied 3 years ago

Yes, delete the july 29-15 wall posts. Old posts not delete.

German Michael Zülsdorff Replied 3 years ago

Okay, but your code is deleting the only latest (14 days old) entries, and all older entries are not deleted?

Hungarian Tamás Varga Replied 3 years ago

~Z~Man: Yes.

German Michael Zülsdorff Replied 3 years ago

I'm not quite sure: Do you want to delete all wall entries which are older than 2 weeks?

Hungarian Tamás Varga Replied 3 years ago

So there is no syntax error:

function delete2weeksposts(){
$wall = new OssnWall;
$listUser = $wall->GetPosts(array(
'pagelimit' => false,
'wheres' => array(
"(FROM
UNIXTIME(o.timecreated) >= DATESUB(NOW(), INTERVAL 2 WEEK))"
)));
if($listUser){
foreach($listUser as $post){
$post->deleteObject($post->guid);
ossntriggercallback('post', 'delete', $post->guid);
}
}
}
delete2weeksposts();

Deleted everything on the wall until July 15, that's not good. It stays every July 29 to July 15 and everything else is canceled. I'd like this.

Hungarian Tamás Varga Replied 3 years ago

Arsalan Shah: Now I am trying to delete the wall entries, I copied the code to index.php, sintax error on this line-);

enter image description here

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