i have a RULES event on "Cron maintenance tasks are performed" and a action is attached to it "execute custom php code"
<?php
$old = '1 day';
$old = strtotime("now - $old");
$query=db_select('profile','pf')
->condition('pf.created',$old, '<')
->fields('pf',array('uid','pid','created'));
$result=$query->execute();
foreach($result as $record){
$profile=profile2_load_by_user($record->uid);
profile2_save($profile);
}
?>
Error :
Recoverable fatal error: Argument 1 passed to profile2_save() must be an instance of Profile, array given, called in /home/test/public_html/drupal_sedco_2/sites/all/modules/rules/modules/php.eval.inc(146) : eval()'d code on line 9 and defined in profile2_save() (line 292 of /home/test/public_html/drupal_sedco_2/sites/all/modules/profile2/profile2.module).
Any clues . Thanks