/**
*
- * Then we'll attach into the settings page, on both the
- * form and post hooks so that we can create and update
+ * Then we'll attach into the plugin settings page, and also the
+ * settings post hooks so that we can create and update
* user preferences.
*
*/
- register_hook('settings_form', 'addon/randplace/randplace.php', 'randplace_settings');
+ register_hook('plugin_settings', 'addon/randplace/randplace.php', 'randplace_settings');
register_hook('settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post');
logger("installed randplace");
*/
unregister_hook('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook');
- unregister_hook('settings_form', 'addon/randplace/randplace.php', 'randplace_settings');
+ unregister_hook('plugin_settings', 'addon/randplace/randplace.php', 'randplace_settings');
unregister_hook('settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post');
if(! local_user())
return;
- /* Add our stylesheet so we can match the page layout */
+ /* Add our stylesheet so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/randplace/randplace.css' . '" media="all" />' . "\r\n";
$checked = (($enabled) ? ' checked="checked" ' : '');
- /* Add some HTML to the form */
+ /* Add some HTML to the existing form */
$s .= '<h3>' . t('Randplace Settings') . '</h3>';
$s .= '<div id="randplace-enable-wrapper">';
$s .= '<input id="randplace-checkbox" type="checkbox" name="randplace" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
- /* provide another submit button */
+ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
if(! function_exists('register_hook')) {
function register_hook($hook,$file,$function) {
- $r = q("SELECT FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
dbesc($hook),
dbesc($file),
dbesc($function)
call_hooks('settings_post', $_POST);
+ if(($a->argc > 1) && ($a->argv[1] == 'addon'))
+ return;
+
if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
notice( t('Permission denied.') . EOL);
return;
return;
}
+ if(($a->argc > 1) && ($a->argv[1] === 'addon')) {
+ $o .= '<h1>' . t('Plugin Settings') . '</h1>';
+ $o .= '<div id="account-settings-link"><a href="settings">' . t('Account Settings') . '</a></div>';
+
+ $o .= '<form action="settings/addon" method="post" >';
+
+ $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
+ if(! count($r))
+ notice('No Plugin settings configured');
+
+ call_hooks('plugin_settings', $o);
+ $o .= '</form>';
+ return $o;
+ }
+
require_once('include/acl_selectors.php');
$p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
$a->strings[' Name too short.'] = ' Name too short.';
$a->strings[' Not valid email.'] = ' Not valid email.';
$a->strings['Settings updated.'] = 'Settings updated.';
+$a->strings['Plugin Settings'] = 'Plugin Settings';
+$a->strings['Account Settings'] = 'Account Settings';
$a->strings['OpenID: '] = 'OpenID: ';
$a->strings[" \x28Optional\x29 Allow this OpenID to login to this account."] = " \x28Optional\x29 Allow this OpenID to login to this account.";
$a->strings['Profile is <strong>not published</strong>.'] = 'Profile is <strong>not published</strong>.';
<h1>Account Settings</h1>
+<div id="plugin-settings-link"><a href="settings/addon">Plugin Settings</a></div>
+
$nickname_block
<h1>Impostazioni account</h1>
+<div id="plugin-settings-link"><a href="settings/addon">Impostazioni Plugin</a></div>
+
+
$nickname_block
$a->strings[' Name too short.'] = ' Nome troppo corto.';
$a->strings[' Not valid email.'] = ' Email non valida.';
$a->strings['Settings updated.'] = 'Impostazioni aggiornate.';
+$a->strings['Plugin Settings'] = 'Impostazioni Plugin';
+$a->strings['Account Settings'= = 'Impostazioni Account';
$a->strings['OpenID: '] = 'OpenID: ';
$a->strings[" \x28Optional\x29 Allow this OpenID to login to this account."] = " \x28Opzionale\x29 Permetti a questo OpenID di accedere a questo account.";
$a->strings['Profile is <strong>not published</strong>.'] = 'Il profilo <strong>non è pubblicato</strong>.';
margin-top: 50px;
font-size: 70%;
}
+
+
+#plugin-settings-link, #account-settings-link {
+ margin-bottom: 25px;
+}