コード例 #1
0
function lhg_update_scan_status_ajax()
{
    global $lhg_price_db;
    $sid = $_REQUEST['session'];
    $status = $_REQUEST['status'];
    $uid = $_REQUEST['uid'];
    #error_log("SID: $sid - Stat: $status");
    # execute standard actions for status change:
    lhg_db_update_status($sid, $status, $uid);
    $response = new WP_Ajax_Response();
    $response->add(array('data' => 'success', 'supplemental' => array('status' => $status)));
    $response->send();
    die;
}
コード例 #2
0
function lhg_db_update_scaninfo()
{
    # reset filters (only true is sumbitted!)
    $user = wp_get_current_user();
    $userid = $user->ID;
    if (!empty($_POST)) {
        #print "RESET!";
        #only reset if update button was used!
        update_user_meta($userid, 'lhg_scan_show_new', false);
        update_user_meta($userid, 'lhg_scan_show_ongoing', false);
        update_user_meta($userid, 'lhg_scan_show_complete', false);
        update_user_meta($userid, 'lhg_scan_show_feedback', false);
    }
    foreach ($_POST as $key => $value) {
        #echo $key . " => " . $value;
        $sid = substr($key, -30);
        $rawkey = substr($key, 0, -31);
        #print "<br>key: $key -> SID: $sid -> $rawkey -> $value<br>";
        if ($key == "filter_show_new") {
            update_user_meta($userid, 'lhg_scan_show_new', true);
        }
        if ($key == "filter_show_ongoing") {
            update_user_meta($userid, 'lhg_scan_show_ongoing', true);
        }
        if ($key == "filter_show_complete") {
            update_user_meta($userid, 'lhg_scan_show_complete', true);
        }
        if ($key == "filter_show_feedback") {
            update_user_meta($userid, 'lhg_scan_show_feedback', true);
        }
        if ($rawkey == "hwscan_acomment") {
            lhg_db_update_acomment($sid, $value);
        }
        if ($rawkey == "status") {
            lhg_db_update_status($sid, $value, $userid);
        }
    }
}