1

I hame some input fields on my comment form, that I show for non-registered members. They are: ‘name’, ‘email’ and ‘comment text’.

And my task was to add string “Guest” to text user typed in the field ‘name’. So I created extension where I use ‘insert_comment_insert_array’ hook:

public function concat_username($data)
{
    if($data['author_id'] != 0)
        return $data;

    $data['name'] = "Guest ".$data['name'];

    return $data;
}  

And it works. But new comment email notifications that I receive after new comment was posted contain user name without my string “Guest”.

May be anyone knows what’s wrong?

1 Answer 1

2

This is likely because the comment notification uses not the database entry for the comment, but the POSTed comment data. The insert_comment_insert_array hook only affects what gets inserted into the database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.