コード例 #1
0
ファイル: theme-users.php プロジェクト: besimhu/legacy
function jr_save_profile_fields($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return false;
    }
    global $wpdb;
    $u = new WP_User($user_id);
    if ($_POST['view_resumes'] == 1) {
        update_user_meta($user_id, '_valid_resume_subscription', '1');
    } else {
        update_user_meta($user_id, '_valid_resume_subscription', '0');
    }
    if ($_POST['give_job_pack'] > 0) {
        // Give the user the chosen job pack
        $pack = new jr_pack((int) $_POST['give_job_pack']);
        $pack->give_to_user($user_id);
    }
    if (is_array($_POST['delete_pack']) && sizeof($_POST['delete_pack']) > 0) {
        foreach ($_POST['delete_pack'] as $pack) {
            $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'jr_customer_packs WHERE id = %s AND user_id = %d LIMIT 1;', $pack, $user_id));
        }
    }
}
コード例 #2
0
ファイル: orders.class.php プロジェクト: besimhu/legacy
 function complete_order($approval_method = '')
 {
     $jobs_last = '';
     if ($this->pack_id > 0) {
         // Get pack details
         $pack = new jr_pack($this->pack_id);
         $jobs_last = $pack->job_duration;
         // Add pack to user's account
         $pack->give_to_user($this->user_id);
     }
     if (!$jobs_last) {
         $jobs_last = 30;
     }
     // 30 day default
     // Caculate expirey date from today
     $date = strtotime('+' . $jobs_last . ' day', current_time('timestamp'));
     if ($this->job_id > 0) {
         // Update post
         $job_post = get_post($this->job_id);
         if ($job_post->post_status !== 'private') {
             $job_post = array();
             $job_post['ID'] = $this->job_id;
             $job_post['post_status'] = 'publish';
             $job_post['post_date'] = date('Y-m-d H:i:s');
             $job_post['post_date_gmt'] = get_gmt_from_date(date('Y-m-d H:i:s'));
             wp_update_post($job_post);
             // Update expiry date
             update_post_meta($this->job_id, '_expires', $date);
         }
     }
     // Change order status to completed
     $this->status = 'completed';
     $this->payment_date = date('Y-m-d H:i:s');
     $this->approval_method = $approval_method;
     // Send out mail
     jr_order_complete($this);
     $this->update_order();
     return true;
 }