summaryrefslogtreecommitdiff
path: root/plugins/Gravatar/GravatarPlugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Gravatar/GravatarPlugin.php')
-rw-r--r--plugins/Gravatar/GravatarPlugin.php21
1 files changed, 10 insertions, 11 deletions
diff --git a/plugins/Gravatar/GravatarPlugin.php b/plugins/Gravatar/GravatarPlugin.php
index 8a9721ea9..dd8ff7217 100644
--- a/plugins/Gravatar/GravatarPlugin.php
+++ b/plugins/Gravatar/GravatarPlugin.php
@@ -34,17 +34,17 @@ class GravatarPlugin extends Plugin
{
return true;
}
-
+
function onStartAvatarFormData($action)
{
$user = common_current_user();
$hasGravatar = $this->hasGravatar($user->id);
-
+
if($hasGravatar) {
return false;
}
}
-
+
function onEndAvatarFormData($action)
{
$user = common_current_user();
@@ -91,7 +91,7 @@ class GravatarPlugin extends Plugin
_m('To use a Gravatar first enter in an email address.'));
}
}
-
+
function onStartAvatarSaveForm($action)
{
if ($action->arg('add')) {
@@ -131,19 +131,18 @@ class GravatarPlugin extends Plugin
}
return false;
}
-
function gravatar_save()
{
$cur = common_current_user();
-
+
if(empty($cur->email)) {
- return array('message' => _m('You do not have a email set in your profile.'),
+ return array('message' => _m('You do not have an email address set in your profile.'),
'success' => false);
}
//Get rid of previous Avatar
$this->gravatar_remove();
-
+
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
$gravatar = new Avatar();
$gravatar->profile_id = $cur->id;
@@ -156,7 +155,7 @@ class GravatarPlugin extends Plugin
$gravatar->created = DB_DataObject_Cast::dateTime(); # current time
if (!$gravatar->insert()) {
- return array('message' => _m('Failed to save Gravatar to the DB.'),
+ return array('message' => _m('Failed to save Gravatar to the database.'),
'success' => false);
}
}
@@ -181,7 +180,7 @@ class GravatarPlugin extends Plugin
return array('message' => _m('Gravatar removed.'),
'success' => true);
}
-
+
function gravatar_url($email, $size)
{
$url = "http://www.gravatar.com/avatar.php?gravatar_id=".
@@ -202,4 +201,4 @@ class GravatarPlugin extends Plugin
return true;
}
-} \ No newline at end of file
+}