Beispiel #1
0
 public function reset_theme_options()
 {
     reset_all_notification_options();
 }
Beispiel #2
0
function set_all_notification_options()
{
    $error = array();
    //if plugin is enabled then atlest one option has to be enabled
    if (options_selected()) {
        qa_opt('qw_email_notf_debug_mode', !!qa_post_text('qw_email_notf_debug_mode_field'));
        qa_opt('qw_notify_cat_followers', !!qa_post_text('qw_notify_cat_followers_field'));
        qa_opt('qw_notify_tag_followers', !!qa_post_text('qw_notify_tag_followers_field'));
        qa_opt('qw_notify_user_followers', !!qa_post_text('qw_notify_user_followers_field'));
        $minimum_user_point_option = !!qa_post_text('qw_notify_min_points_opt_field');
        if ($minimum_user_point_option) {
            //if minimum point option is checked
            $minimum_user_point_value = qa_post_text('qw_notify_min_points_val_field');
            if (!!$minimum_user_point_value && is_numeric($minimum_user_point_value) && $minimum_user_point_value > 0) {
                //if the minimum point value is provided then only set else reset
                qa_opt('qw_notify_min_points_opt', $minimum_user_point_option);
                qa_opt('qw_notify_min_points_val', (int) $minimum_user_point_value);
            } else {
                if (!is_numeric($minimum_user_point_value) || $minimum_user_point_value <= 0) {
                    reset_all_notification_points_options();
                    //send a error message to UI
                    $error['enter_point_value'] = "The points value should be a numeric and non-zero positive integer ";
                } else {
                    reset_all_notification_points_options();
                    //send a error message to UI
                    $error['enter_point_value'] = "The points value is required to enable the option ";
                }
            }
        } else {
            reset_all_notification_points_options();
        }
    } else {
        //if none of the elements are selected disable the plugin and send a error message UI
        qa_opt('qw_email_notf_enable', false);
        reset_all_notification_options();
        $error['no_options_selected'] = "Please choose atleast follower option to enable this plugin ";
    }
    // set the notifications page size
    $page_size = qa_post_text('qw_all_notification_page_size_field');
    if (!$page_size || $page_size < 15 || $page_size > 200) {
        $page_size = 15;
        /*15 set to default */
    }
    qa_opt('qw_all_notification_page_size', $page_size);
    return $error;
}