Tidying up getUser calls to profiles and some events
getUser calls are much more strict, and one place where this was found was in the (un)subscribe start/end event handlers, which resulted in making the Subscription class a bit stricter, regarding ::start and ::cancel at least. Several minor fixes in many files were made due to this. This does NOT touch the Foreign_link function, which should also have a more strict getUser call. That is a future project.
This commit is contained in:
@@ -33,13 +33,17 @@ class GravatarPlugin extends Plugin
|
||||
function onEndProfileGetAvatar($profile, $size, &$avatar)
|
||||
{
|
||||
if (empty($avatar)) {
|
||||
$user = $profile->getUser();
|
||||
if (!empty($user) && !empty($user->email)) {
|
||||
// Fake one!
|
||||
$avatar = new Avatar();
|
||||
$avatar->width = $avatar->height = $size;
|
||||
$avatar->url = $this->gravatar_url($user->email, $size);
|
||||
return false;
|
||||
try {
|
||||
$user = $profile->getUser();
|
||||
if (!empty($user->email)) {
|
||||
// Fake one!
|
||||
$avatar = new Avatar();
|
||||
$avatar->width = $avatar->height = $size;
|
||||
$avatar->url = $this->gravatar_url($user->email, $size);
|
||||
return false;
|
||||
}
|
||||
} catch (NoSuchUserException $e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user