4 * Description: Disable "Archives" widget on profile page
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
12 function notimeline_install() {
14 register_hook('plugin_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
15 register_hook('plugin_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
20 function notimeline_uninstall() {
21 unregister_hook('plugin_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
22 unregister_hook('plugin_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
27 function notimeline_settings_post($a,$post) {
28 if(! local_user() || (! x($_POST,'notimeline-submit')))
31 set_pconfig(local_user(),'system','no_wall_archive_widget',intval($_POST['notimeline']));
32 info( t('No Timeline settings updated.') . EOL);
35 function notimeline_settings(&$a,&$s) {
40 /* Add our stylesheet to the page so we can make our settings look nice */
42 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/notimeline/notimeline.css' . '" media="all" />' . "\r\n";
44 /* Get the current state of our config variable */
46 $notimeline = get_pconfig(local_user(),'system','no_wall_archive_widget');
47 if($notimeline === false)
50 $notimeline_checked = (($notimeline) ? ' checked="checked" ' : '');
53 /* Add some HTML to the existing form */
55 $s .= '<div class="settings-block">';
56 $s .= '<h3>' . t('No Timeline Settings') . '</h3>';
57 $s .= '<div id="notimeline-wrapper">';
58 $s .= '<label id="notimeline-label" for="notimeline-checkbox">' . t('Disable Archive selector on profile wall') . '</label>';
59 $s .= '<input id="notimeline-checkbox" type="checkbox" name="notimeline" value="1" ' . $notimeline_checked . '/>';
60 $s .= '</div><div class="clear"></div>';
62 /* provide a submit button */
64 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="notimeline-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';