/** * Toggle "check in" for a user * * @return void */ function meetup_admin_user_checkin() { if (!current_user_can('manage_options')) { return; } check_admin_referer('meetup-checkin'); $meetup_id = isset($_REQUEST['meetup_id']) ? intval($_REQUEST['meetup_id']) : 0; $booking_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $current = isset($_REQUEST['current']) ? intval($_REQUEST['current']) : 0; // toggle the status $status = $current == '3' ? '1' : '3'; // 3:checkin, 1:booked meetup_seat_change_status($booking_id, $status); wp_redirect(admin_url('edit.php?post_type=meetup&page=meetup-attendies&message=checkin&meetup_id=' . $meetup_id)); }
/** * Handle actions from email link * * @return void */ function meetup_handle_email_action() { $action = isset($_GET['action']) ? $_GET['action'] : ''; if (!in_array($action, array('meetup_confirm', 'meetup_cancel'))) { return; } $uid = isset($_GET['uid']) ? intval($_GET['uid']) : 0; $mid = isset($_GET['mid']) ? intval($_GET['mid']) : 0; $bid = isset($_GET['bid']) ? intval($_GET['bid']) : 0; $key = isset($_GET['key']) ? $_GET['key'] : 0; if ($uid && $mid && $key) { $hash = get_user_meta($uid, '_meetup_email_hash', true); if ($hash == $key) { delete_user_meta($uid, '_meetup_email_hash'); if ($action == 'meetup_confirm') { meetup_seat_change_status($bid, 2); // set status to booked $redirect_url = add_query_arg(array('msg' => 'meetup_confirmed'), get_permalink($mid)); } else { if ($action == 'meetup_cancel') { meetup_cancel_seat($uid, $mid, $bid); $redirect_url = add_query_arg(array('msg' => 'meetup_cancelled'), get_permalink($mid)); } } } else { $redirect_url = add_query_arg(array('msg' => 'hash_error'), get_permalink($mid)); } wp_redirect($redirect_url); exit; } }