User Properties


Introduced in Version 2.0


Get or set email address for this user.

Echoing the current user's email address:

echo $user->email;

Changing the user's email address and saving that change:

setOutputFormatting(false) is required when editing data in a user's fields.

$email = $sanitizer->email("myname@processwire.com"); // Returns blank if address is invalid
if (!empty($email)) {
    $item = $users->get('myname');
    $item->email = $email;
} else {
    // Display an error because their email address was invalid


Post Comment