if(($_POST['fbd_parent_action']??'')==='save_monthly_goal'){ global $wpdb; $t=$wpdb->prefix.'fbd_monthly_goals'; $child=sanitize_key($_POST['goal_child']??'both'); if(!in_array($child,['emma','xander','both'],true)) $child='both'; $target=max(1,(int)($_POST['goal_target']??30)); $reward=max(0,(float)($_POST['goal_reward']??10)); $wpdb->query($wpdb->prepare("UPDATE $t SET active=0 WHERE child=%s",$child)); $wpdb->insert($t,['child'=>$child,'target_count'=>$target,'reward'=>$reward,'active'=>1,'created_at'=>current_time('mysql')],['%s','%d','%f','%d','%s']); return 'Monthly goal saved.'; } global $wpdb; require_once ABSPATH.'wp-admin/includes/upgrade.php'; $charset=$wpdb->get_charset_collate(); $goals=$wpdb->prefix.'fbd_monthly_goals'; dbDelta("CREATE TABLE $goals ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, child varchar(20) NOT NULL DEFAULT 'both', target_count int(11) NOT NULL DEFAULT 30, reward decimal(10,2) NOT NULL DEFAULT 10.00, active tinyint(1) NOT NULL DEFAULT 1, created_at datetime NOT NULL, PRIMARY KEY (id) ) $charset;"); Hello world! – Family Calendar

Hello world!

Written by

in

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

Comments

Ét svar til “Hello world!”

  1. A WordPress Commenter Avatar

    Hi, this is a comment.
    To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
    Commenter avatars come from Gravatar.

Skriv et svar

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *