4 * Description: Disable images in group edit menu
6 * Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
12 function group_text_install() {
14 register_hook('plugin_settings', 'addon/group_text/group_text.php', 'group_text_settings');
15 register_hook('plugin_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
17 logger("installed group_text");
21 function group_text_uninstall() {
23 unregister_hook('plugin_settings', 'addon/group_text/group_text.php', 'group_text_settings');
24 unregister_hook('plugin_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
27 logger("removed group_text");
34 * Callback from the settings post function.
35 * $post contains the $_POST array.
36 * We will make sure we've got a valid user account
37 * and if so set our configuration setting for this person.
41 function group_text_settings_post($a,$post) {
42 if(! local_user() || (! x($_POST,'group_text-submit')))
44 set_pconfig(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
46 info( t('Group Text settings updated.') . EOL);
52 * Called from the Plugin Setting form.
53 * Add our own settings info to the page.
59 function group_text_settings(&$a,&$s) {
64 /* Add our stylesheet to the page so we can make our settings look nice */
66 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/group_text/group_text.css' . '" media="all" />' . "\r\n";
68 /* Get the current state of our config variable */
70 $enabled = get_pconfig(local_user(),'system','groupedit_image_limit');
71 $checked = (($enabled) ? ' checked="checked" ' : '');
73 /* Add some HTML to the existing form */
75 $s .= '<div class="settings-block">';
76 $s .= '<h3>' . t('Group Text') . '</h3>';
77 $s .= '<div id="group_text-enable-wrapper">';
78 $s .= '<label id="group_text-enable-label" for="group_text-checkbox">' . t('Use a text only (non-image) group selector in the "group edit" menu') . '</label>';
79 $s .= '<input id="group_text-checkbox" type="checkbox" name="group_text" value="1" ' . $checked . '/>';
80 $s .= '</div><div class="clear"></div>';
82 /* provide a submit button */
84 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="group_text-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';