Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-mw committed Jul 12, 2022
1 parent d2ede02 commit b6d12c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/MicroweberPackages/User/UserManager.php
Expand Up @@ -460,13 +460,21 @@ public function name($user_id = false, $mode = 'full')
*
* @uses $this->get_by_id()
*/

public $nice_name_cache = array();

public function nice_name($id = false, $mode = 'full')
{


if (!$id) {
$id = $this->id();
}

if(isset($this->nice_name_cache[$mode.$id])){
return $this->nice_name_cache[$mode.$id];
}

$user = $this->get_by_id($id);


Expand Down Expand Up @@ -542,7 +550,7 @@ public function nice_name($id = false, $mode = 'full')
$name = $name_from_email[0];
}
}

$this->nice_name_cache[$mode.$id] = $name;
return $name;
}

Expand Down

0 comments on commit b6d12c8

Please sign in to comment.