diff --git a/serendipity_plugin_adduser/ChangeLog b/serendipity_plugin_adduser/ChangeLog index b83231ac..13019b56 100644 --- a/serendipity_plugin_adduser/ChangeLog +++ b/serendipity_plugin_adduser/ChangeLog @@ -1,3 +1,8 @@ +2.38: +----- + +Add ability to specify more defaults for new authors + 2.37: ---- diff --git a/serendipity_plugin_adduser/UTF-8/lang_de.inc.php b/serendipity_plugin_adduser/UTF-8/lang_de.inc.php index 28a57aa4..d8f2f067 100644 --- a/serendipity_plugin_adduser/UTF-8/lang_de.inc.php +++ b/serendipity_plugin_adduser/UTF-8/lang_de.inc.php @@ -38,3 +38,5 @@ @define('PLUGIN_ADDUSER_SENTMAIL_APPROVE_ADMIN', 'Der Account wurde akzeptiert, der entsprechende Redakteur wird nun seine E-Mail mit Zugangsdaten erhalten.'); @define('PLUGIN_ADDUSER_MAIL_SUBJECT_APPROVE', '[Bewilligung notwendig] Ein neuer Autor hat sich registriert'); @define('PLUGIN_ADDUSER_MAIL_BODY_APPROVE', "Für den Autoren %s wurde für das Blog %s ein Account eingerichtet. Um dem Redakteur den Login zu erlauben, bitte auf diesen Link klicken:\n\n%s\n\nErst nach diesem Vorgang wird der Redakteur seine Zugangsdaten per E-Mail erhalten."); + + @define('PLUGIN_ADDUSER_DEFAULTSETTINGS', 'Hier können Standard-Einstellungen für den neuen Autoren festgelegt werden.'); diff --git a/serendipity_plugin_adduser/common.inc.php b/serendipity_plugin_adduser/common.inc.php index 484d5c66..7e532835 100644 --- a/serendipity_plugin_adduser/common.inc.php +++ b/serendipity_plugin_adduser/common.inc.php @@ -14,7 +14,7 @@ if (file_exists($probelang)) { include dirname(__FILE__) . '/lang_en.inc.php'; class serendipity_common_adduser { - function sendMail(&$username, &$hash, &$email, $approve_only = false, $admin_cc = true) { + static function sendMail(&$username, &$hash, &$email, $approve_only = false, $admin_cc = true) { global $serendipity; if ($approve_only) { @@ -54,7 +54,7 @@ class serendipity_common_adduser { return $mail; } - function checkuser($usergroups = array()) { + static function checkuser($usergroups = array()) { global $serendipity; static $debug = false; @@ -108,6 +108,28 @@ class serendipity_common_adduser { serendipity_set_config_var('no_create', $author['no_create'], $newID); serendipity_set_config_var('lang', $serendipity['lang'], $newID); + // Fetch default properties for new authors as configured. + // Only set values for the keys that are supported (all booleans currently!) + $config = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}config WHERE name LIKE 'serendipity_plugin_adduser:%'"); + $pair_config = array( + 'wysiwyg' => '', + 'simpleFilters' => '', + 'enableBackendPopup' => '', + 'moderateCommentsDefault' => '', + 'allowCommentsDefault' => '', + 'showMediaToolbar' => '', + 'use_autosave' => '' + ); + if (is_array($config)) { + foreach($config AS $conf) { + $names = explode('/', $conf['name']); + if (isset($pair_config[$names[1]])) { + $pair_config[$names[1]] = serendipity_get_bool($conf['value']); + serendipity_set_config_var($names[1], $pair_config['wysiwyg'], $newID); + } + } + } + if (is_array($usergroups) && function_exists('serendipity_updateGroups')) { if ($debug) echo "[debug] update groups: " . print_r($usergroups, true) . "
\n"; serendipity_updateGroups($usergroups, $newID, false); @@ -143,7 +165,7 @@ class serendipity_common_adduser { return false; } - function addAuthor($username, $password, $email, $userlevel, $right_publish, $no_create) { + static function addAuthor($username, $password, $email, $userlevel, $right_publish, $no_create) { global $serendipity; if (!is_array(serendipity_db_query("SELECT username FROM {$serendipity['dbPrefix']}pending_authors LIMIT 1", true, 'both', false, false, false, true))) { @@ -178,7 +200,7 @@ class serendipity_common_adduser { return $hash; } - function adduser(&$username, &$password, &$email, $userlevel, $usergroups = array(), $no_create = false, $right_publish = true, $straight_insert = false, $approve = false, $use_captcha = false) { + static function adduser(&$username, &$password, &$email, $userlevel, $usergroups = array(), $no_create = false, $right_publish = true, $straight_insert = false, $approve = false, $use_captcha = false) { global $serendipity; if (serendipity_common_adduser::checkuser($usergroups)) { @@ -246,7 +268,7 @@ class serendipity_common_adduser { return false; } - function loginform($url, $hidden = array(), $instructions = '', $username = '', $password = '', $email = '', $use_captcha = false) { + static function loginform($url, $hidden = array(), $instructions = '', $username = '', $password = '', $email = '', $use_captcha = false) { global $serendipity; if (!is_object($serendpity['smarty'])) { diff --git a/serendipity_plugin_adduser/lang_de.inc.php b/serendipity_plugin_adduser/lang_de.inc.php index 84b2d9c7..37b49192 100644 --- a/serendipity_plugin_adduser/lang_de.inc.php +++ b/serendipity_plugin_adduser/lang_de.inc.php @@ -38,3 +38,5 @@ @define('PLUGIN_ADDUSER_SENTMAIL_APPROVE_ADMIN', 'Der Account wurde akzeptiert, der entsprechende Redakteur wird nun seine E-Mail mit Zugangsdaten erhalten.'); @define('PLUGIN_ADDUSER_MAIL_SUBJECT_APPROVE', '[Bewilligung notwendig] Ein neuer Autor hat sich registriert'); @define('PLUGIN_ADDUSER_MAIL_BODY_APPROVE', "Für den Autoren %s wurde für das Blog %s ein Account eingerichtet. Um dem Redakteur den Login zu erlauben, bitte auf diesen Link klicken:\n\n%s\n\nErst nach diesem Vorgang wird der Redakteur seine Zugangsdaten per E-Mail erhalten."); + + @define('PLUGIN_ADDUSER_DEFAULTSETTINGS', 'Hier können Standard-Einstellungen für den neuen Autoren festgelegt werden.'); diff --git a/serendipity_plugin_adduser/lang_en.inc.php b/serendipity_plugin_adduser/lang_en.inc.php index dc4215ca..50407841 100644 --- a/serendipity_plugin_adduser/lang_en.inc.php +++ b/serendipity_plugin_adduser/lang_en.inc.php @@ -56,3 +56,5 @@ @define('PLUGIN_ADDUSER_REGISTERED_ONLY_GROUP', 'Additionally: Only registered users in these authorgroups may post comments?'); @define('PLUGIN_ADDUSER_REGISTERED_ONLY_GROUP_DESC', 'You also need to enable the option "Only registered users may post comments" to use this. If enabled, only registered users of specific authorgroups may post comments to your entries and need to be logged in to do so.'); + +@define('PLUGIN_ADDUSER_DEFAULTSETTINGS', 'Here you can specify settings that will be applied to created users.'); diff --git a/serendipity_plugin_adduser/serendipity_event_adduser.php b/serendipity_plugin_adduser/serendipity_event_adduser.php index 7f0c8fdc..50aec568 100644 --- a/serendipity_plugin_adduser/serendipity_event_adduser.php +++ b/serendipity_plugin_adduser/serendipity_event_adduser.php @@ -12,7 +12,7 @@ class serendipity_event_adduser extends serendipity_event $propbag->add('description', PLUGIN_ADDUSER_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking'); - $propbag->add('version', '2.37.1'); + $propbag->add('version', '2.38'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', diff --git a/serendipity_plugin_adduser/serendipity_plugin_adduser.php b/serendipity_plugin_adduser/serendipity_plugin_adduser.php index 2ffc3c24..a317b609 100644 --- a/serendipity_plugin_adduser/serendipity_plugin_adduser.php +++ b/serendipity_plugin_adduser/serendipity_plugin_adduser.php @@ -12,7 +12,7 @@ class serendipity_plugin_adduser extends serendipity_plugin { $propbag->add('description', PLUGIN_ADDUSER_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking'); - $propbag->add('version', '2.34.1'); + $propbag->add('version', '2.38'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -24,12 +24,23 @@ class serendipity_plugin_adduser extends serendipity_plugin { 'instructions', 'userlevel', 'usergroups', - 'no_create', - 'right_publish', 'sidebar_login', 'straight_insert', 'approve', - 'use_captcha') + 'use_captcha', + + # Default settings. + 'default_label', + 'no_create', + 'right_publish', + 'wysiwyg', + 'simpleFilters', + 'enableBackendPopup', + 'moderateCommentsDefault', + 'allowCommentsDefault', + 'showMediaToolbar', + 'use_autosave' + ) ); $this->dependencies = array('serendipity_event_adduser' => 'keep'); } @@ -112,6 +123,61 @@ class serendipity_plugin_adduser extends serendipity_plugin { $propbag->add('default', false); break; + + case 'default_label': + $propbag->add('type', 'content'); + $propbag->add('default', PLUGIN_ADDUSER_DEFAULTSETTINGS); + break; + + case 'wysiwyg': + $propbag->add('type', 'boolean'); + $propbag->add('name', INSTALL_WYSIWYG); + $propbag->add('description', INSTALL_WYSIWYG_DESC); + $propbag->add('default', false); + break; + + case 'simpleFilters': + $propbag->add('type', 'boolean'); + $propbag->add('name', SIMPLE_FILTERS); + $propbag->add('description', SIMPLE_FILTERS_DESC); + $propbag->add('default', true); + break; + + case 'enableBackendPopup': + $propbag->add('type', 'boolean'); + $propbag->add('name', INSTALL_BACKENDPOPUP); + $propbag->add('description', INSTALL_BACKENDPOPUP_DESC); + $propbag->add('default', false); + break; + + case 'moderateCommentsDefault': + $propbag->add('type', 'boolean'); + $propbag->add('name', COMMENTS_MODERATE); + $propbag->add('description', ''); + $propbag->add('default', false); + break; + + case 'allowCommentsDefault': + $propbag->add('type', 'boolean'); + $propbag->add('name', COMMENTS_ENABLE); + $propbag->add('description', ''); + $propbag->add('default', true); + break; + + case 'showMediaToolbar': + $propbag->add('type', 'boolean'); + $propbag->add('name', SHOW_MEDIA_TOOLBAR); + $propbag->add('description', ''); + $propbag->add('default', false); + break; + + case 'use_autosave': + $propbag->add('type', 'boolean'); + $propbag->add('name', CONF_USE_AUTOSAVE); + $propbag->add('description', CONF_USE_AUTOSAVE_DESC); + $propbag->add('default', true); + break; + default: return false; }