arm_get_all_roles(); $all_active_plans = $arm_subscription_plans->arm_get_all_active_subscription_plans(); $dbFormFields = $arm_member_forms->arm_get_db_form_fields(true); $form_mode = __('Add New Member', 'ARMember'); $action = 'add_member'; $user_id = $arm_form_id = 0; $username = $useremail = $firstname = $last_name = $planID = ''; $u_roles = 'subscriber'; $primary_status = 1; $secondary_status = 0; $user = ''; $cancel_url = admin_url('admin.php?page=' . $arm_slugs->manage_members); $required_class = 0; $planIDs = array(); $futurePlanIDs = array(); $plan_start_date = date('m/d/Y'); if (isset($_POST['action']) && $_POST['action'] == 'add_member') { $username = !empty($_POST['user_login']) ? $_POST['user_login'] : ''; $useremail = !empty($_POST['user_email']) ? $_POST['user_email'] : ''; $firstname = !empty($_POST['first_name']) ? $_POST['first_name'] : ''; $last_name = !empty($_POST['last_name']) ? $_POST['last_name'] : ''; $u_roles = !empty($_POST['roles']) ? $_POST['roles'] : 'subscriber'; if (!empty($_POST['arm_primary_status']) && $_POST['arm_primary_status'] == '1') { $primary_status = '1'; } else { $primary_status = '2'; } $planIDs = !empty($_POST['arm_user_plan']) ? $_POST['arm_user_plan'] : array(); $planIDs = !is_array($planIDs) ? array($planIDs) : $planIDs; } if (isset($_GET['action']) && $_GET['action'] == 'edit_member' && !empty($_GET['id'])) { $form_mode = __('Update Member', 'ARMember'); $action = 'update_member'; $user_id = intval($_GET['id']); $user = $arm_members_class->arm_get_member_detail($user_id); $arm_form_id = isset($user->arm_form_id) ? $user->arm_form_id : 0; if($arm_form_id != 0 && $arm_form_id != ''){ $arm_member_form_fields = $arm_member_forms->arm_get_member_forms_fields($arm_form_id, 'all'); if(!empty($arm_member_form_fields)){ foreach ($arm_member_form_fields as $fields_key => $fields_value) { $arm_member_form_field_slug = $fields_value['arm_form_field_slug']; if($arm_member_form_field_slug != ''){ $dbFormFields[$arm_member_form_field_slug]['label'] = $fields_value['arm_form_field_option']['label']; if(isset($dbFormFields[$arm_member_form_field_slug]['options']) && isset($fields_value['arm_form_field_option']['options'])){ $dbFormFields[$arm_member_form_field_slug]['options'] = $fields_value['arm_form_field_option']['options']; } } } } } $required_class = 1; if (!empty($user)) { $arm_all_user_status = arm_get_all_member_status($user_id); $primary_status = $arm_all_user_status['arm_primary_status']; $secondary_status = $arm_all_user_status['arm_secondary_status']; } $planIDs = get_user_meta($user_id, 'arm_user_plan_ids', true); $planIDs = !empty($planIDs) ? $planIDs : array(); $planID = isset($planIDs[0]) ? $planIDs[0] : 0; $planData = get_user_meta($user_id, 'arm_user_plan_' . $planID, true); $plan_start_date = (isset($planData['arm_start_plan']) && !empty($planData['arm_start_plan'])) ? date('m/d/Y', $planData['arm_start_plan']) : date('m/d/Y'); $futurePlanIDs = get_user_meta($user_id, 'arm_user_future_plan_ids', true); $futurePlanIDs = !empty($futurePlanIDs) ? $futurePlanIDs : array(); } $all_plan_ids = array(); if (!empty($all_active_plans)) { foreach ($all_active_plans as $p) { $all_plan_ids[] = $p['arm_subscription_plan_id']; } } $plan_to_show = array_diff($all_plan_ids, $planIDs); $plan_to_show = array_diff($plan_to_show, $futurePlanIDs); $plansLists = '
  • ' . __('Select Plan', 'ARMember') . '
  • '; if (!empty($all_active_plans)) { foreach ($all_active_plans as $p) { $p_id = $p['arm_subscription_plan_id']; $plansLists .= '
  • ' . stripslashes(esc_attr($p['arm_subscription_plan_name'])) . '
  • '; } } $formHiddenFields = ''; ?>
    get_error_messages(); if (!empty($errors)) { foreach ($errors as $err) { echo '
    '; echo '
    ' . $err . '
    '; echo '
    '; } } ?>
    arm_get_single_member_forms($arm_form_id); $arm_exists_form = $armform->arm_is_form_exists($user->arm_form_id); if ($arm_exists_form) { $armform->init((object) $userRegForm); } } if (!empty($dbFormFields)) { foreach ($dbFormFields as $meta_key => $field) { $field_options = maybe_unserialize($field); $field_options = apply_filters('arm_change_field_options', $field_options); $meta_key = isset($field_options['meta_key']) ? $field_options['meta_key'] : $field_options['id']; $field_id = $meta_key . arm_generate_random_code(); if (!in_array($meta_key, $exclude_keys) && !in_array($field_options['type'], array('section', 'roles', 'html', 'hidden', 'submit', 'repeat_pass', 'repeat_email'))) { ?> settings)) ? maybe_unserialize($armform->settings) : array(); if ($armform->exists() && isset($form_settings['is_hidden_fields']) && $form_settings['is_hidden_fields'] == '1') { if (isset($form_settings['hidden_fields']) && !empty($form_settings['hidden_fields'])) { foreach ($form_settings['hidden_fields'] as $hiddenF) { $hiddenMetaKey = (isset($hiddenF['meta_key']) && !empty($hiddenF['meta_key'])) ? $hiddenF['meta_key'] : sanitize_title('arm_hidden_' . $hiddenF['title']); $hiddenValue = get_user_meta($user_id, $hiddenMetaKey, true); $hiddenValue = (!empty($hiddenValue)) ? $hiddenValue : $hiddenF['value']; $formHiddenFields .= ''; } } } ?> 'avatar', 'label' => __('Avatar', 'ARMember'), 'placeholder' => __('Drop file here or click to select.', 'ARMember'), 'type' => 'avatar', 'value' => '', 'allow_ext' => '', 'file_size_limit' => '2', 'meta_key' => 'avatar', 'required' => 0, 'blank_message' => __('Please select avatar.', 'ARMember'), 'invalid_message' => __('Invalid image selected.', 'ARMember'), ); $avatarOptions = apply_filters('arm_change_field_options', $avatarOptions); ?> isSocialFeature): ?> 'profile_cover', 'label' => __('Profile Cover', 'ARMember'), 'placeholder' => __('Drop file here or click to select.', 'ARMember'), 'type' => 'avatar', 'value' => '', 'allow_ext' => '', 'file_size_limit' => '10', 'meta_key' => 'profile_cover', 'required' => 0, 'blank_message' => __('Please select profile cover.', 'ARMember'), 'invalid_message' => __('Invalid image selected.', 'ARMember'), ); $profileCoverOptions = apply_filters('arm_change_field_options', $profileCoverOptions); ?> arm_social_profile_field_types(); if (!empty($socialProfileFields)) { foreach ($socialProfileFields as $spfKey => $spfLabel) { $spfMetaKey = 'arm_social_field_' . $spfKey; $spfMetaValue = get_user_meta($user_id, $spfMetaKey, true); ?>
    user_login; $disabled = 'disabled="disabled" '; } ?> data-msg-required="" required/>
    required/>
    required/>
    roles)) { $u_roles = $user->roles; } else { $u_roles = array(); } ?>
    value="1" class="armswitch_input" name="arm_primary_status"/>
    armGetMemberStatusText($user_id, $primary_status); ?>
    $meta_key; } echo $arm_member_forms->arm_member_form_get_fields_by_type($field_options, $field_id, $arm_form_id, 'active', $armform); ?>
    arm_member_form_get_fields_by_type($avatarOptions, $avatar_field_id, $arm_form_id, 'active', $armform); ?>

    arm_get_plan_name_by_id($planID); echo (!empty($plan_name)) ? $plan_name : '-'; $plan_id = ($planID > 0) ? $planID : ''; ?>
    arm_get_wp_date_format(); $defaultPlanData = $arm_subscription_plans->arm_default_plan_array(); $suspended_plan_ids = get_user_meta($user_id, 'arm_user_suspended_plan_ids', true); $suspended_plan_ids = (isset($suspended_plan_ids) && !empty($suspended_plan_ids)) ? $suspended_plan_ids : array(); $count_plans = 0; if (!empty($planIDs)) { foreach ($planIDs as $pID) { if (!empty($pID)) { $planData = get_user_meta($user_id, 'arm_user_plan_' . $pID, true); $planData = !empty($planData) ? $planData : array(); if (!empty($planData)) { $planDetail = $planData['arm_current_plan_detail']; if (!empty($planDetail)) { $planObj = new ARM_Plan(0); $planObj->init((object) $planDetail); } else { $planObj = new ARM_Plan($pID); } $no = $count_plans; $planName = $planObj->name; $grace_message = ''; $starts_on = !empty($planData['arm_start_plan']) ? date_i18n($date_format, $planData['arm_start_plan']) : '-'; $expires_on = !empty($planData['arm_expire_plan']) ? ' ' . date_i18n($date_format, $planData['arm_expire_plan']) . ' ' : __('Never Expires', 'ARMember'); $renewal_on = !empty($planData['arm_next_due_payment']) ? date_i18n($date_format, $planData['arm_next_due_payment']) : '-'; $trial_starts = !empty($planData['arm_trial_start']) ? $planData['arm_trial_start'] : ''; $trial_ends = !empty($planData['arm_trial_end']) ? $planData['arm_trial_end'] : ''; $arm_payment_mode = ( $planData['arm_payment_mode'] == 'auto_debit_subscription') ? '
    (' . __('Auto Debit','ARMember') . ')' : ''; $arm_payment_cycle = !empty($planData['arm_payment_cycle']) ? $planData['arm_payment_cycle'] : ''; if ($planObj->is_recurring()) { $recurring_plan_options = $planObj->prepare_recurring_data($arm_payment_cycle); $recurring_time = $recurring_plan_options['rec_time']; $completed = $planData['arm_completed_recurring']; if ($recurring_time == 'infinite' || empty($planData['arm_expire_plan'])) { $remaining_occurence = __('Never Expires', 'ARMember'); } else { $remaining_occurence = $recurring_time - $completed; } if (!empty($planData['arm_expire_plan'])) { if ($remaining_occurence == 0) { $renewal_on = __('No cycles due', 'ARMember'); } else { $renewal_on .= "
    ( " . $remaining_occurence . __(' cycles due', 'ARMember') . " )"; } } $arm_is_user_in_grace = $planData['arm_is_user_in_grace']; $arm_grace_period_end = $planData['arm_grace_period_end']; if ($arm_is_user_in_grace == "1" || $arm_is_user_in_grace == 1) { $arm_grace_period_end = date_i18n($date_format, $arm_grace_period_end); $grace_message .= "
    ( " . __('grace period expires on', 'ARMember') ." ". $arm_grace_period_end . " )"; } } $arm_plan_is_suspended = ''; if (!empty($suspended_plan_ids)) { if (in_array($pID, $suspended_plan_ids)) { $arm_plan_is_suspended = '
    (' . __('Suspended', 'ARMember') . ')
    ' . __('Are you sure you want to active this plan?', 'ARMember') . '
    '; } } $trial_active = ''; if (!empty($trial_starts)) { if ($planData['arm_is_trial_plan'] == 1 || $planData['arm_is_trial_plan'] == '1') { if ($trial_starts < $planData['arm_start_plan']) { $trial_active = "
    (" . __('trial active', 'ARMember') . ")
    "; } } } ?> init((object) $planDetail); } else { $planObj = new ARM_Plan($pID); } } $no = $count_plans; $planName = $planObj->name; $grace_message = ''; $starts_on = !empty($planData['arm_start_plan']) ? date_i18n($date_format, $planData['arm_start_plan']) : '-'; $expires_on = !empty($planData['arm_expire_plan']) ? ' ' . date_i18n($date_format, $planData['arm_expire_plan']) . ' ' : __('Never Expires', 'ARMember'); $renewal_on = !empty($planData['arm_next_due_payment']) ? date_i18n($date_format, $planData['arm_next_due_payment']) : '-'; $trial_starts = !empty($planData['arm_trial_start']) ? $planData['arm_trial_start'] : ''; $trial_ends = !empty($planData['arm_trial_end']) ? $planData['arm_trial_end'] : ''; $arm_payment_mode = ( $planData['arm_payment_mode'] == 'auto_debit_subscription') ? '
    (' . __('Auto Debit','ARMember') . ')' : ''; $arm_payment_cycle = !empty($planData['arm_payment_cycle']) ? $planData['arm_payment_cycle'] : ''; if ($planObj->is_recurring()) { $recurring_plan_options = $planObj->prepare_recurring_data($arm_payment_cycle); $recurring_time = $recurring_plan_options['rec_time']; $completed = $planData['arm_completed_recurring']; if ($recurring_time == 'infinite' || empty($planData['arm_expire_plan'])) { $remaining_occurence = __('Never Expires', 'ARMember'); } else { $remaining_occurence = $recurring_time - $completed; } if (!empty($planData['arm_expire_plan'])) { if ($remaining_occurence == 0) { $renewal_on = __('No cycles due', 'ARMember'); } else { $renewal_on .= "
    ( " . $remaining_occurence . __(' cycles due', 'ARMember') . " )"; } } $arm_is_user_in_grace = $planData['arm_is_user_in_grace']; $arm_grace_period_end = $planData['arm_grace_period_end']; if ($arm_is_user_in_grace == "1") { $arm_grace_period_end = date_i18n($date_format, $arm_grace_period_end); $grace_message .= "
    ( " . __('grace period expires on', 'ARMember') ." ". $arm_grace_period_end . " )"; } } $arm_plan_is_suspended = ''; $trial_active = ''; ?>
    new_user_plan_text(false, $arm_payment_cycle); ?> is_recurring() && $planData['arm_payment_mode'] == 'manual_subscription' && !in_array($pID, $futurePlanIDs)) { $recurringData = $planObj->prepare_recurring_data($arm_payment_cycle); $total_recurrence = $recurringData['rec_time']; $completed_rec = $planData['arm_completed_recurring']; ?>
    new_user_plan_text(false, $arm_payment_cycle); ?>
    arm_member_form_get_fields_by_type($profileCoverOptions, $profile_cover_field_id, $arm_form_id, 'active', $armform); ?>