From: Klaus Weidenbach Date: Sat, 14 Jul 2012 19:11:43 +0000 (+0200) Subject: Add check if libravatar addon is enabled, too. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1aaecea8dbb5a58262c82215e94c2794976496da;p=friendica-addons.git Add check if libravatar addon is enabled, too. Added a check to gravatar if the libravatar addon is also enabled. Only one of these two addons should be anabled and libravatar will fall back to gravatar if it found nothing at libravatar. --- diff --git a/gravatar.tgz b/gravatar.tgz index 38e942f8..25106f26 100644 Binary files a/gravatar.tgz and b/gravatar.tgz differ diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index b9435a31..fc5358eb 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -2,7 +2,7 @@ /** * Name: Gravatar Support * Description: If there is no avatar image for a new user or contact this plugin will look for one at Gravatar. - * Version: 1.0 + * Version: 1.1 * Author: Klaus Weidenbach */ @@ -12,7 +12,7 @@ function gravatar_install() { register_hook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - logger("installed gravatar"); + logger("registered gravatar in avatar_lookup hook"); } /** @@ -21,7 +21,7 @@ function gravatar_install() { function gravatar_uninstall() { unregister_hook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - logger("uninstalled gravatar"); + logger("unregistered gravatar in avatar_lookup hook"); } /** @@ -81,7 +81,16 @@ function gravatar_plugin_admin (&$a, &$o) { 'x' => 'x' ); - $o = ''; + // Check if Libravatar is enabled and show warning + $r = q("SELECT * FROM `addon` WHERE `name` = '%s' and `installed` = 1", + dbesc('libravatar') + ); + if (count($r)) { + $o = '
' .t('Information') .'

' .t('Libravatar addon is installed, too. Please disable Libravatar addon or this Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'



'; + } + + // output Gravatar settings + $o .= ''; $o .= replace_macros( $t, array( '$submit' => t('Submit'), '$default_avatar' => array('avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars),