avatar options

This commit is contained in:
Shish 2010-04-21 17:56:01 +01:00
parent 0816e6bb67
commit 3eee6f313e
2 changed files with 27 additions and 5 deletions

View file

@ -145,8 +145,10 @@ class User {
if($config->get_string("avatar_host") == "gravatar") {
if(!empty($this->email)) {
$hash = md5(strtolower($this->email));
$args = $config->get_string("avatar_gravatar_options");
return "<img class=\"avatar gravatar\" src=\"http://www.gravatar.com/avatar/$hash.jpg?$args\">";
$s = $config->get_string("avatar_gravatar_size");
$d = $config->get_string("avatar_gravatar_default");
$r = $config->get_string("avatar_gravatar_rating");
return "<img class=\"avatar gravatar\" src=\"http://www.gravatar.com/avatar/$hash.jpg?s=$s&d=$d&r=$r\">";
}
}
return "";

View file

@ -47,8 +47,10 @@ class UserPage extends SimpleExtension {
global $config;
$config->set_default_bool("login_signup_enabled", true);
$config->set_default_int("login_memory", 365);
$config->set_default_string("avatar_host", "gravatar");
$config->set_default_string("avatar_gravatar_options", "");
$config->set_default_string("avatar_host", "none");
$config->set_default_int("avatar_gravatar_size", 80);
$config->set_default_string("avatar_gravatar_default", "");
$config->set_default_string("avatar_gravatar_rating", "g");
$config->set_default_bool("login_tac_bbcode", true);
}
@ -185,6 +187,8 @@ class UserPage extends SimpleExtension {
}
public function onSetupBuilding(Event $event) {
global $config;
$hosts = array(
"None" => "none",
"Gravatar" => "gravatar"
@ -193,7 +197,23 @@ class UserPage extends SimpleExtension {
$sb = new SetupBlock("User Options");
$sb->add_bool_option("login_signup_enabled", "Allow new signups: ");
$sb->add_longtext_option("login_tac", "<br>Terms &amp; Conditions:<br>");
#$sb->add_choice_option("avatar_host", $hosts, "<br>Avatars: ");
$sb->add_choice_option("avatar_host", $hosts, "<br>Avatars: ");
if($config->get_string("avatar_host") == "gravatar") {
$sb->add_label("<br>&nbsp;<br><b>Gravatar Options</b>");
$sb->add_choice_option("avatar_gravatar_type",
array(
'Default'=>'default',
'Wavatar'=>'wavatar',
'Monster ID'=>'monsterid',
'Identicon'=>'identicon'
),
"<br>Type: ");
$sb->add_choice_option("avatar_gravatar_rating",
array('G'=>'g', 'PG'=>'pg', 'R'=>'r', 'X'=>'x'),
"<br>Rating: ");
}
$event->panel->add_block($sb);
}