$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);
echo $mpD->ID; ?> "><?php echo $mpD->post_title; ?> </option><?php } } ?> </select> <input type="hidden" name="change_meal_plan" value="1" /> </form> <?php if (!$current_plan_found) { $current_meal_plan = $first_plan; setCurrentMealPlan($first_plan, $user_id); ?> <script type="text/javascript"> jQuery('.choice-mealplan option:first').prepend('Current : '); </script> <?php } $meal_data = get_post($current_meal_plan); $dayArray = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); $mealPlan = array(); foreach ($dayArray as $dayArr) { $mealPlanData = getMealPlanArray(get_field($dayArr, $meal_data->ID)); $mealPlan[$dayArr] = $mealPlanData; } //pr($mealPlan); ?>