Ok, I've spend all day looking into other plugins about how they use checkboxes (unfortunately they all have different methods) to understand them and get mine working. But no luck. I know you write plugins and have a better understanding about this, so I'll try my luck here
Ok this is what I have:
Function A
Function B
add_filter('bb_current_user_can','Function A');
I want these 2 functions to be used ONLY if a checkbox is checked in the admin page and saved. Else this should be ignored.
In the admin page I have a form with a checkbox:
-A normal text box here-
<td><input type="checkbox" name="test" id="test" />
For the submit (this submit works no change needed here):
<p class="submit alignleft"><input name="submitIt" type="submit" value="<?php _e('Submit'); ?>" /></p>
And of course:
function update_blog_settings() {
if (isset($_POST['submitBlog'])) {
bb_update_option( 'blog_forum_id', $_POST['forum_id'] );
}
}
add_action('bb_admin-header.php','update_blog_settings');
So when this checkbox is checked and I press submit, it should save this (and remember the chosen option) and when I enter the forum it should use function A and B. When the checkbox is unchecked, it should ignore these 2 functions.
These checkboxes seems to work a bit different then normal textboxes. Also how can I keep the checkbox checked like I do with value="<?php echo bb_get_option( 'blog_number_of_topics' ); ?> in the normal textboxes?
Hope you can help me!