4 * Description: Disable "Archives" widget on profile page
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
11 use Friendica\Core\PConfig;
13 function notimeline_install() {
15 register_hook('plugin_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
16 register_hook('plugin_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
21 function notimeline_uninstall() {
22 unregister_hook('plugin_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
23 unregister_hook('plugin_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
28 function notimeline_settings_post($a,$post) {
29 if(! local_user() || (! x($_POST,'notimeline-submit')))
32 PConfig::set(local_user(),'system','no_wall_archive_widget',intval($_POST['notimeline']));
33 info( t('No Timeline settings updated.') . EOL);
36 function notimeline_settings(&$a,&$s) {
41 /* Add our stylesheet to the page so we can make our settings look nice */
43 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/notimeline/notimeline.css' . '" media="all" />' . "\r\n";
45 /* Get the current state of our config variable */
47 $notimeline = PConfig::get(local_user(),'system','no_wall_archive_widget');
48 if($notimeline === false)
51 $notimeline_checked = (($notimeline) ? ' checked="checked" ' : '');
54 /* Add some HTML to the existing form */
56 $s .= '<div class="settings-block">';
57 $s .= '<h3>' . t('No Timeline Settings') . '</h3>';
58 $s .= '<div id="notimeline-wrapper">';
59 $s .= '<label id="notimeline-label" for="notimeline-checkbox">' . t('Disable Archive selector on profile wall') . '</label>';
60 $s .= '<input id="notimeline-checkbox" type="checkbox" name="notimeline" value="1" ' . $notimeline_checked . '/>';
61 $s .= '</div><div class="clear"></div>';
63 /* provide a submit button */
65 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="notimeline-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';