allow set default attribute in the getAttribute

This commit is contained in:
Ibnu Maksum 2024-08-19 15:01:25 +07:00
parent df5e03a827
commit d11cd83089
No known key found for this signature in database
GPG key ID: 7FC82848810579E5

View file

@ -123,7 +123,7 @@ class User
return 0;
}
public static function getAttribute($name, $id = 0)
public static function getAttribute($name, $id = 0, $default = '')
{
if (!$id) {
$id = User::getID();
@ -135,7 +135,7 @@ class User
if ($f) {
return $f['field_value'];
}
return '';
return $default;
}
public static function getAttributes($endWith, $id = 0)