« Virtual hosts and multisites | Main | Finding new content in Drupal 6 »

October 28, 2010

Code Snippets for Rules

Execute PHP Code
PHP code to execute: Block

$my_node = node_load(8223);
$my_role = $my_node->field_person_role;
dpm($my_node);
if ( !empty($my_role[0][value]) ) {
print "Hurray!";
}

#####################################


$my_user = user_load(1);
//dpm($my_user);

$diff = $my_user->login - $my_user->created;
if ($diff < 30) {

dpm($node->login);
print "created = ";
dpm($node->created);

// return TRUE;
}

else{
print "ELSE!";
//return FALSE;
}


#########################

dpm($user);
print "account = ";
$acc_uid = [account:uid];
dpm($acc_uid);


$my_user = user_load([account:uid]);
dpm($my_user);

$diff = $my_user->login - $my_user->created;
if ($diff < 30) {

dpm($node->login);
print "created = ";
dpm($node->created);

// return TRUE;
}

else{
print "ELSE!";
//return FALSE;
}

http://www.gcfyouthlive.com/v2/sites/all/themes/youthlive/images/login_button.png

http://www.assamjatriniwas.com/images/register.png

Posted by kkwaiser at October 28, 2010 07:26 PM

Comments

Login to leave a comment. Create a new account.