The feed deleted for 2 weeks does not work in the cpanel, this error message:
/home/elittagh/public_html/cron/cron.php: line 1: ?php: No such file
or directory
/home/elittagh/public_html/cron/cron.php: line 2: syntax error near
unexpected token `'OSSN_ALLOW_SYSTEM_START','
/home/elittagh/public_html/cron/cron.php: line 2:
`define('OSSN_ALLOW_SYSTEM_START', TRUE);'
cron.php:
<?php
define('OSSN_ALLOW_SYSTEM_START', true);
require_once ('system/start.php');
function delete_2weeks_posts() {
$wall = new OssnWall;
$listUser = $wall->GetPosts(array(
'type' => 'user',
'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();
I know I’m very stupid for programming. Please write the absolutely good code because I don't understand how it will be good.
Ok,
so you need to change the $groups_query
of that GroupPostsNewsfeed component to fetch only those group records
which are NEWER than 14 days.
So this time, Arsalan's original condition will do the trick. ;)
Absolute correct.
Oh ... I think I start to understand your issue:
On one hand you want to keep ALL Group postings to make them appear within the group.
That's why we can't delete them.
But now since you are using Arsalan's Show Group Posts in Newsfeed
all these group postings appear in the Newsfeed . And of course the old ones, too.
But on the other hand you don't want to see OLDER group posts in the Newsfeed.
Is this correct?
Thank you very much ~ Z ~ Man. Is it possible to make everything disappear from the feed so that the posts remain in the groups? Entries older than 2 weeks, of course.
This was Arsalan's original query:
$listUser = $wall->GetPosts(array(
'page_limit' => false,
'wheres' => array(
"(FROM_UNIXTIME(o.time_created) >= DATE_SUB(NOW(), INTERVAL 2 WEEK))"
);
));
It was fetching ALL wall postings (group wall and main/user wall) NEWER than 14 days.
The >=
was a mistake, so we changed it to <=
to make the query fetch records OLDER than 14 days.
Additionally you requested to NOT delete the Group postings, so we changed the query to fetch records of type 'user' only like
$listUser = $wall->GetPosts(array(
'type' => 'user',
'page_limit' => false,
'wheres' => array(
"(FROM_UNIXTIME(o.time_created) <= DATE_SUB(NOW(), INTERVAL 2 WEEK))"
)
));
Yesterday we tried that query, it found 1 record to delete, and you said: No there are. more!
And yes, there are more indeed. But these are GROUP records, and you did NOT want to delete GROUP records.
That was your request.
So I can't see anything wrong with the result from yesterday.
Arsalan’s first code erased everything, including the feed and messages, but within 2 weeks of that date. Came a fix and deleted the new code from the old entries in the feed, but this so that the index.php file had the new code. then there was nothing in the feed, after that nothing was deleted anymore because i tried from cron. What was wrong?
Tamas,
one month ago on https://www.opensource-socialnetwork.org/discussion/view/5139/can-only-the-wall-be-deleted-automatically?offset=4
you complained:
He also deleted everything in the groups. Fault.
So we changed Arsalan's original code NOT to delete group posts,
and on https://www.opensource-socialnetwork.org/discussion/view/5139/can-only-the-wall-be-deleted-automatically?offset=1
you confirmed
Super :)
that's the way you wanted it.
And now you're complaining that these older group are not deleted?!?
Let's investigate:
Click onto the date of that post
This will open a new page which will show the guid of that post (in my example it is 260)
Memorize your post guid
Then use phpmyadmin and open the ossn_object table
Click on the column header 'guid' to sort that column (ascending or descending order)
Then find the guid you just memorized and make a screenshot of the complete line please
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)