Hi,
i'd like to execute a pattern whenever my module is enabled. i have tried a couple of solutions but cant seem to get either of them to execute the pattern.
i have a hook_enable() in my module which has the following code -
$p_name = 'pattern_name;
patterns_load_components();
$patterns = patterns_get_patterns(true);
foreach($patterns as $id => $p){
if($p->name == $p_name){
$pattern = patterns_get_pattern($p->pid);
break;
}
}
if ($pattern == FALSE) {
drupal_set_message("Unable to execute $p_name because the pattern was not found.",'error');
}else{
$params = array(
'pid' => $pattern->pid,
'confirm' => 1,
'run-subpatterns' => 'first-update',
);
//execute the pattern
patterns_execute_pattern($pattern, $params);
}
this looks to me like it should work, but it doesnt? any ideas?