From 45cffbfe90d79f3c405b4cc98f7f318ae372bb10 Mon Sep 17 00:00:00 2001 From: Christopher Stebe <cstebe@iserv4u.com> Date: Wed, 7 Oct 2015 23:31:26 +0200 Subject: [PATCH] updated Gravatar widget E-Mail usage by default in combination with `dektrium/yii2-user` the `profile->gravatar_email` is `NULL` by default. So now it is ensured that a E-Mail will be set even if the `profile->gravatar_email` is not given. --- example-views/phundament/app/layouts/main.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example-views/phundament/app/layouts/main.php b/example-views/phundament/app/layouts/main.php index 68ed6cd..7aa21d0 100644 --- a/example-views/phundament/app/layouts/main.php +++ b/example-views/phundament/app/layouts/main.php @@ -97,7 +97,9 @@ <li class="user-header bg-light-blue"> <?php echo \cebe\gravatar\Gravatar::widget( [ - 'email' => \Yii::$app->user->identity->email, + 'email' => (\Yii::$app->user->identity->profile->gravatar_email === null) + ? \Yii::$app->user->identity->email + : \Yii::$app->user->identity->profile->gravatar_email, 'options' => [ 'alt' => \Yii::$app->user->identity->username ],