Page Updation/Expiration Notice

Permalink
I am trying to create something like cron job

I have made two custom page attributes
1) Page Expiration Notice (Date field) , value----> 07/25/16
2) Page Expiration Description (Text Field) , value -----> "This page needs to be updated"

I want to send an email to the Page Owner on 07/25/16 that email should contain something like
Page Updation notice
This page needs to be updated .
Any ideas how this can be done ??

 
hutman replied on at Permalink Reply
hutman
You could do something like this

use PageList;
$today = date('Y-m-d');
$pl = new PageList();
$pl->filterByAttribute('expiration_notice', $today, '=');
$expiringPages = $pl->get(9999);
if(count($expiringPages) > 0){
    foreach($expiringPages as $page){
        $pageOwnerID = $page->getCollectionUserID();
        $ui = UserInfo::getByID($pageOwnerID);
        $pageOwnerEmail = $ui->getUserEmail();
        $pageID = $page->getCollectionID();
        $pageName = $page->getCollectionName();
        $expirationDescription = $page->getAttribute('expiration_description');
        $bodyHTML = '<p>PageID: '.$pageID.'<br />Page Name: '.$pageName.'</br />Message:'.$expirationDescription.'</p>';
        $mh = $this->app->make('mail');
mohamedkhalid replied on at Permalink Reply
it works perfectly , but the only problem i am facing now is ,I just want the mail to be sent once in a day not whenever the user reaches to the page .

Is there a way to do it , something like a cron job .
Gondwana replied on at Permalink Reply
Gondwana
http://documentation.concrete5.org/developers/jobs/overview
mohamedkhalid replied on at Permalink Reply
@Gondwana i followed the steps in the documentation and created the custom cron but unfortunately the custom cron which i made is not being displayed with the cron's .

Am i going wrong here .
hutman replied on at Permalink Reply
hutman
Did you see the part about "Installing the Job"? If it doesn't show up at the bottom of the Jobs list it might have an incorrect namespace.