$getsubs = get_post($getuserplan); $silverplan = 0; if ($getsubs->post_title == 'Silver') { $silverplan = 1; } $addMoreRecipe = get_field('add_recipe_count', $getsubs->ID) ? get_field('add_recipe_count', $getsubs->ID) : 20; $addMoreVideos = get_field('add_educational_video_count', $getsubs->ID) ? get_field('add_educational_video_count', $getsubs->ID) : 2; $addMorePDFs = get_field('add_educational_pdf_count', $getsubs->ID) ? get_field('add_educational_pdf_count', $getsubs->ID) : 2; //echo '<pre>'; print_r($getsubs); die(); $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; for ($i = 0; $i < 8; $i++) { $n = rand(0, strlen($alphabet) - 1); $pass[$i] = $alphabet[$n]; } $userpass = implode($pass); $userdata = array('user_login' => $userinfo["user_login"], 'user_pass' => $userpass, 'user_nicename' => $userinfo["first_name"], 'user_email' => $userinfo["user_email"], 'user_registered' => date('Y-m-d H:i:s'), 'user_status' => '0', 'display_name' => $userinfo["first_name"]); //$user_id = wp_insert_user( $userdata ) ; $user_id = 2; echo "\$user_id = {$user_id} <br />"; $new_user_recipe = get_new_user_recipe($user_id, $userinfo["acf"]["field_567794581852d"], $userinfo["acf"]["field_56779d416d97d"]); $user_recipe = serialize($new_user_recipe); $new_user_educational_vidoes = get_new_user_educational($user_id, $userinfo["acf"]["field_567794581852d"], $userinfo["acf"]["field_56779d416d97d"], 'video'); $user_educational_video = serialize($new_user_educational_vidoes); $new_user_educational_pdfs = get_new_user_educational($user_id, $userinfo["acf"]["field_567794581852d"], $userinfo["acf"]["field_56779d416d97d"], 'pdf'); $user_educational_pdf = serialize($new_user_educational_pdfs); update_user_meta($user_id, 'user_recipe', $user_recipe); update_user_meta($user_id, 'educational_video', $user_educational_video); update_user_meta($user_id, 'silver_plan', $silverplan); update_user_meta($user_id, 'educational_pdf', $user_educational_pdf); $meal_plan_id = createNewMealPlan($user_id, $userinfo["acf"]["field_567794581852d"], $userinfo["acf"]["field_56779d416d97d"], $newMealName); setCurrentMealPlan($meal_plan_id, $user_id);
* @package unite */ if (!isSubscriber()) { wp_redirect(site_url('login')); exit; } get_header(); $success = false; $user_id = get_current_user_id(); $current_meal_plan = getCurrentMealPlanId($user_id); if (!empty($_POST) && isset($_POST['new_meal_plan'])) { $user_id = get_current_user_id(); $user = get_user_by('id', $user_id); $diet = get_user_meta($user_id, 'diet', true); $goal = get_field('goal', $user); $meal_plan_id = createNewMealPlan($user_id, $diet, $goal->term_id); setCurrentMealPlan($meal_plan_id, $user_id); $current_meal_plan = $meal_plan_id; $success = 'Meal Plan created successfully.'; } if (!empty($_POST) && isset($_POST['mail_meal_plan'])) { //pr($_POST); //die; $data = $_POST['image']; list($type, $data) = explode(';', $data); list(, $data) = explode(',', $data); $data = base64_decode($data); $image_name = $user_id . '-' . time() . '.jpg'; $folder = 'meal_plan/'; $image_path = get_stylesheet_directory() . '/' . $folder . $image_name; file_put_contents($image_path, $data);