/** * Determines if a user has completed setting up their account. * * The lax mode (with $strict = false) has been introduced for special cases * only where we want to skip certain checks intentionally. This is valid in * certain mnet or ajax scenarios when the user cannot / should not be * redirected to edit their profile. In most cases, you should perform the * strict check. * * @param stdClass $user A {@link $USER} object to test for the existence of a valid name and email * @param bool $strict Be more strict and assert id and custom profile fields set, too * @return bool */ function user_not_fully_set_up($user, $strict = true) { global $CFG; require_once $CFG->dirroot . '/user/profile/lib.php'; if (isguestuser($user)) { return false; } if (empty($user->firstname) or empty($user->lastname) or empty($user->email) or over_bounce_threshold($user)) { return true; } if ($strict) { if (empty($user->id)) { // Strict mode can be used with existing accounts only. return true; } if (!profile_has_required_custom_fields_set($user->id)) { return true; } } return false; }
/** * Determines if a user has completed setting up their account. * * The lax mode (with $strict = false) has been introduced for special cases * only where we want to skip certain checks intentionally. This is valid in * certain mnet or ajax scenarios when the user cannot / should not be * redirected to edit their profile. In most cases, you should perform the * strict check. * * @param stdClass $user A {@link $USER} object to test for the existence of a valid name and email * @param bool $strict Be more strict and assert id and custom profile fields set, too * @return bool */ function user_not_fully_set_up($user, $strict = true) { global $CFG; require_once $CFG->dirroot . '/user/profile/lib.php'; if (isguestuser($user)) { return false; } // custom profile fields added by dhempy and updated/continued by austin and brian //Start KET modification if (empty($user->firstname) or empty($user->lastname) or empty($user->email) or over_bounce_threshold($user) or (empty($user->profile['ss']) or empty($user->profile['birthday']) or empty($user->profile['Phone']) or empty($user->profile['statecode'])) and !has_capability('report/courseoverview:view', context_system::instance())) { return true; } // End KET modification if ($strict) { if (empty($user->id)) { // Strict mode can be used with existing accounts only. return true; } if (!profile_has_required_custom_fields_set($user->id)) { return true; } } return false; }