You are here

function rules_events_argument_comment_author in Rules 6

Gets the author of the comment

Related topics

1 string reference to 'rules_events_argument_comment_author'
rules_events_hook_comment_arguments in rules/modules/comment.rules.inc
Returns some arguments suitable for hook comment

File

rules/modules/comment.rules.inc, line 79
rules integration for the comment module

Code

function rules_events_argument_comment_author($comment) {

  // if comment author is anonymous user get basic info from comment
  if (!$comment->uid) {
    $account = new stdClass();
    $account->uid = 0;
    $account->name = $comment->name;
    $account->mail = $comment->mail;
    $account->roles = array(
      DRUPAL_ANONYMOUS_RID => 'anonymous user',
    );
  }
  else {
    $account = user_load(array(
      'uid' => $comment->uid,
    ));
  }
  return $account;
}