function load_options() { echo '<div id="message" class="updated"><p>' . __('HSBC CPI Gateway Requires the Site to run on HTTPS/SSL', 'ym') . '</p></div>'; if (!is_ssl()) { echo '<div id="message" class="error"><p>' . __('You are not using SSL', 'ym') . '</p></div>'; } else { echo '<div id="message" class="updated"><p>' . __('And you are!', 'ym') . '</p></div>'; } echo '<div id="message" class="updated"><p>' . __('<strong>NOTE</strong> the Hash Key is Specfic to the Currency inuse. Please make sure to set the Correct Currency', 'ym') . '</p></div>'; $options = array(); $options[] = array('name' => 'store_front_id', 'label' => __('Your StoreFront ID', 'ym'), 'caption' => __('ClientID sent via Email', 'ym'), 'type' => 'text'); $options[] = array('name' => 'cpi_hash_key', 'label' => __('Your Hash Key', 'ym'), 'caption' => __('Hash Key sent in a Letter', 'ym'), 'type' => 'text'); $options[] = array('name' => 'cancel_url', 'label' => __('Cancel URL', 'ym'), 'caption' => __('On Payment Cancel return to this URL', 'ym'), 'type' => 'url'); $options[] = array('name' => 'error_url', 'label' => __('Error URL', 'ym'), 'caption' => __('On Payment Error return to this URL', 'ym'), 'type' => 'url'); $options[] = array('name' => 'status', 'label' => __('Mode', 'ym'), 'caption' => '', 'type' => 'status'); $customs = array(); $fld_obj = get_option('ym_custom_fields'); if (strpos($fld_obj->order, ';') !== false) { $orders = explode(';', $fld_obj->order); } else { $orders = array($fld_obj->order); } foreach ($orders as $order) { $entry = ym_get_custom_field_by_id($order); if ($entry) { $customs[$entry['name']] = $entry['label']; } } // field map $options[] = array('name' => 'map_billingaddress1', 'label' => __('Custom Field Map: BillingAddress1', 'ym'), 'caption' => __('If Enabled all *Billing Required* Fields are required', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_billingaddress2', 'label' => __('Custom Field Map: BillingAddress2', 'ym'), 'caption' => __('*Billing Optional*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_billingcity', 'label' => __('Custom Field Map: BillingCity', 'ym'), 'caption' => __('*Billing Required*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_billingcountry', 'label' => __('Custom Field Map: BillingCountry', 'ym'), 'caption' => __('*Billing Required*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_billingcounty', 'label' => __('Custom Field Map: BillingCounty', 'ym'), 'caption' => __('*Billing Optional*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_billingpostal', 'label' => __('Custom Field Map: BillingPostal', 'ym'), 'caption' => __('*Billing Required*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'copybillingshipping', 'label' => __('Copy Billing to Shipping', 'ym'), 'caption' => __('Copy the Custom Field Map from above to below', 'ym'), 'type' => 'yesno'); $options[] = array('name' => 'map_shippingaddress1', 'label' => __('Custom Field Map: ShippingAddress1', 'ym'), 'caption' => __('If Enabled all *Shipping Required* Fields are required', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_shippingaddress2', 'label' => __('Custom Field Map: ShippingAddress2', 'ym'), 'caption' => __('*Shipping Optional*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_shippingcity', 'label' => __('Custom Field Map: ShippingCity', 'ym'), 'caption' => __('*Shipping Required*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_shippingcountry', 'label' => __('Custom Field Map: ShippingCountry', 'ym'), 'caption' => __('*Shipping Required*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_shippingcounty', 'label' => __('Custom Field Map: ShippingCounty', 'ym'), 'caption' => __('*Shipping Optional*', 'ym'), 'type' => 'select', 'options' => $customs); $options[] = array('name' => 'map_shippingpostal', 'label' => __('Custom Field Map: ShippingPostal', 'ym'), 'caption' => __('*Shipping Required*', 'ym'), 'type' => 'select', 'options' => $customs); return $options; }
function sync_with_gateway() { global $wpdb; if ($_GET['mm_action']) { if (!strpos($_SERVER['SERVER_SOFTWARE'], 'Debian')) { ob_end_flush(); // echo as we go ob_implicit_flush(true); } echo '<pre>'; echo 'Syncing with Gateway' . "\n"; } if ($_GET['mm_action']) { echo 'Syncing YM Custom Fields with MailChimp Merge Vars' . "\n"; } $local_fields = $live_fields = $fields_to_add = array(); $fields = get_option('ym_custom_fields'); $order = explode(';', $fields->order); $words = $custom_field_data = array(); foreach ($order as $index) { $field = ym_get_custom_field_by_id($index); if ($field['name'] != 'subscription_introduction' && $field['name'] != 'subscription_options' && strlen($field['name']) <= 10 && $field['name'] != 'first_name' && $field['name'] != 'last_name' && $field['name'] != 'user_email' && $field['name'] != 'ym_password' && $field['name'] != 'user_url') { $word = strtoupper($field['name']); $local_fields[] = $word; $words[$word] = $field['name']; if ($field['name'] == 'birthdate') { $field['type'] = 'birthday'; } $custom_field_data[$word] = $field; } } $live_fieldsd = $this->mailchimp->listMergeVars($this->options->list); if ($live_fieldsd->error) { echo 'An Error Occured'; return; } // process foreach ($live_fieldsd as $field) { $live_fields[] = $field->tag; } $fields_to_add = array_diff($local_fields, $live_fields); foreach ($fields_to_add as $field) { switch ($custom_field_data[$field]['type']) { case 'birthday': $type = 'birthday'; break; case 'text': default: $type = 'text'; } $r = $this->mailchimp->listMergeVarAdd($this->options->list, $field, $words[$field], array('field_type' => $type)); if ($_GET['mm_action']) { echo 'Result for: ' . $field . ' - ' . $r . "\n"; } } if ($_GET['mm_action']) { echo 'Syncing All Users to list' . "\n"; } $all_local_users = $all_live_users_subscribed = $all_live_users_unsubscribed = array(); $list = 'wordpress_users'; $subd = $this->mailchimp->listMembers($this->options->list, 'subscribed', FALSE, FALSE, 15000); $unsubd = $this->mailchimp->listMembers($this->options->list, 'unsubscribed', FALSE, FALSE, 15000); if ($subd->error || $unsubd->error) { // error echo 'An Error Occured'; return; } foreach ($subd->data as $user) { $all_live_users_subscribed[] = $user->email; } foreach ($unsubd->data as $user) { $all_live_users_unsubscribed[] = $user->email; } foreach ($wpdb->get_results(mailmanager_get_sql($list)) as $row) { $all_local_users[] = strtolower($row->email); } if ($_GET['mm_action']) { echo 'There are locally: ' . sizeof($all_local_users) . "\n"; echo 'There are live: ' . sizeof($all_live_users_subscribed) . " Subscribed\n"; echo 'There are live: ' . sizeof($all_live_users_unsubscribed) . " Unsubcribed\n"; } // sync delete // umsubed // clean all in order to handle resubscribe..... $sql = 'DELETE FROM ' . $wpdb->prefix . 'mm_list_unsubscribe WHERE list_name = \'' . $this->options->list . '\''; $wpdb->query($sql); foreach ($all_live_users_unsubscribed as $user_email) { $user_id = get_user_by_email($user_email); $user_id = $user_id->ID; // log unsub mailmanager_unsubscribe_user($this->options->list, $user_id); } $users_to_add = array_diff($all_local_users, $all_live_users_subscribed, $all_live_users_unsubscribed); if ($_GET['mm_action']) { echo 'There are ' . sizeof($users_to_add) . ' Users to add' . "\n"; } include YM_MM_INCLUDES_DIR . 'countries.inc.php'; foreach ($users_to_add as $user_email) { $data = get_user_by_email($user_email); $merge = array(); $merge = array('FNAME' => $data->first_name, 'LNAME' => $data->last_name); $fields = ym_get_custom_field_array($data->ID); foreach ((array) $fields as $field => $value) { $merge[strtoupper(str_replace(' ', '_', $field))] = $value; } if ($merge['COUNTRY']) { $merge['COUNTRY'] = $countries[$merge['COUNTRY']]; } if (isset($merge['BIRTHDATE']) && $merge['BIRTHDATE']) { $merge['BIRTHDATE'] = explode('-', $merge['BIRTHDATE']); // m d y // $merge['BIRTHDATE'] = $merge['BIRTHDATE'][2] . '-' . $merge['BIRTHDATE'][0] . '-' . $merge['BIRTHDATE'][1]; $merge['BIRTHDATE'] = $merge['BIRTHDATE'][0] . '/' . $merge['BIRTHDATE'][1]; } if ($_GET['mm_action']) { echo 'Adding ' . $user_email . "\n"; } $this->mailchimp->listSubscribe($this->options->list, $user_email, $merge, $this->options->double_opt_in, $this->options->welcome_message); } // for exitinst subscribed update fields if ($_GET['mm_action']) { echo 'Updating existing users' . "\n"; } $counter = 0; foreach ($all_live_users_subscribed as $index => $user_email) { $data = get_user_by_email($user_email); $merge = array(); $merge = array('FNAME' => $data->first_name, 'LNAME' => $data->last_name); $fields = ym_get_custom_field_array($data->ID); foreach ((array) $fields as $field => $value) { $merge[strtoupper($field)] = $value; } if (isset($merge['COUNTRY'])) { $merge['COUNTRY'] = $countries[$merge['COUNTRY']]; } if (isset($merge['BIRTHDATE']) && $merge['BIRTHDATE']) { $merge['BIRTHDATE'] = explode('-', $merge['BIRTHDATE']); // m d y // $merge['BIRTHDATE'] = $merge['BIRTHDATE'][2] . '-' . $merge['BIRTHDATE'][0] . '-' . $merge['BIRTHDATE'][1]; $merge['BIRTHDATE'] = $merge['BIRTHDATE'][0] . '/' . $merge['BIRTHDATE'][1]; } echo $this->mailchimp->listUpdateMember($this->options->list, $user_email, $merge); $counter++; if ($counter >= 20) { $counter = 0; echo ' ' . ($index + 1) . '/' . count($all_live_users_subscribed); echo "\n"; } } echo "\n"; // hadnle lists and segments if ($_GET['mm_action']) { echo 'General Sync Complete - Moving on to YM MM List/Segmentation' . "\n"; } // what segments exists // if list associations are to a segment..... // validate segemetns // in case deleted server side // server side $segments = $this->mailchimp->listSegments($this->options->list); $this->associations = new StdClass(); foreach ($segments as $segment) { $name = $segment->name; $this->associations->{$name} = $segment->id; } $this->saveassociations(); // any segments left to make? foreach (mailmanager_get_recipients() as $nice_key => $word_name) { $assoc = $this->associations->{$nice_key}; if (!$assoc) { if ($_GET['mm_action']) { echo 'Creating Segment: ' . $nice_key . "\n"; } // the ym list needs a segment if ($id = $this->mailchimp->listStaticSegmentAdd($this->options->list, $nice_key)) { $this->associations->{$nice_key} = $id; $assoc = $id; // just to be safe in case of crash $this->saveassociations(); } else { if ($_GET['mm_action']) { echo 'There was an error, creating a list segment' . "\n"; } return; } // ought to error catch..... } } // just in case $this->saveassociations(); $emails = array(); foreach ($this->associations as $nice_key => $word_name) { foreach ($wpdb->get_results(mailmanager_get_sql($nice_key)) as $row) { if ($row->email) { $emails[$row->email][] = $this->associations->{$nice_key}; } } } // member iterate $subd = $this->mailchimp->listMembers($this->options->list, 'subscribed', FALSE, FALSE, 15000); $counter = 0; foreach ($subd->data as $index => $user) { $email = $user->email; // ping // should generally do nothing // but in case admin switch the level // or the ipn was missed // do this first to stop multiple existings $user_data = get_user_by_email($email); if ($user_data) { $this->change_user_list(array('user_id' => $user_data->ID)); } // obeslete below now? $data = $this->mailchimp->listMemberInfo($this->options->list, $email); $segments = array(); foreach ((array) $data->data[0]->static_segments as $segment) { $segments[] = $segment->id; } $diff = array_diff((array) $emails[$email], $segments); // add or remove a user from a segment foreach ($diff as $item) { $r = $this->mailchimp->listStaticSegmentMembersAdd($this->options->list, $item, array($email)); if ($_GET['mm_action']) { echo 'a'; // echo 'Adding ' . $email . ' to ' . $item . "\n"; if ($r->success) { echo $r->success; } else { echo $r->error; } } } $counter++; if ($counter >= 20) { $counter = 0; echo ' ' . ($index + 1) . '/' . count($subd->data); echo "\n"; } } // complete if ($_GET['mm_action']) { echo 'Segmentation Complete' . "\n"; echo 'WebHook check' . "\n"; } $url = site_url() . '/?mm_webhook=1'; if (FALSE === stripos($url, 'localhost')) { $hooks = $this->mailchimp->listWebHooks($this->options->list); $found = FALSE; foreach ($hooks as $hook) { if ($hook->url == $url) { $found = TRUE; } } if (!$found) { // can't handle upemail properly $this->mailchimp->listWebhookAdd($this->options->list, $url, '11111'); } } else { if ($_GET['mm_action']) { echo 'On Localhost' . "\n"; } } if ($_GET['mm_action']) { echo 'Checking for abuse/spam reports' . "\n"; } // cron job, runs daily.... // so get the last day only $reports = $this->mailchimp->listAbuseReports($this->options->list, 0, 1000, time() - 86400); if ($reports->total) { foreach ($reports->data as $report) { $email = $report['email']; $user = get_user_by_email($email); $user_id = $user->ID; @ym_log_transaction(YM_USER_STATUS_UPDATE, 'Inactive', $user_id); update_user_option($user_id, 'ym_status', 'Inactive', true); if ($_GET['mm_action']) { echo $email . ' reported spam removing/inactivising' . "\n"; } } } if ($_GET['mm_action']) { echo 'All Done' . "\n"; echo '</pre>'; if (!strpos($_SERVER['SERVER_SOFTWARE'], 'Debian')) { ob_flush(); // restart wordpress ob ob_start(); } } }
function ym_reg_flow_fields() { // commons abstracted out here for clarity $commons = array('login' => array('nice' => 'Login', 'text' => array('Login', 0), 'name' => array('login', 0), 'type' => array('widget', 1), 'required' => array('0', 1), 'single' => 1, 'classes' => '', 'options' => array()), 'freetext' => array('nice' => 'FreeText', 'text' => array('', 0), 'name' => array('freetext', 0), 'type' => array('textarea', 1), 'required' => array('0', 1), 'single' => 0, 'classes' => ''), 'username' => array('nice' => 'Username', 'text' => array('Username', 0), 'name' => array('username', 1), 'type' => array('text', 1), 'required' => array('1', 1), 'single' => 1, 'classes' => ''), 'email_address' => array('nice' => 'Email Address', 'text' => array('Email Address', 0), 'name' => array('email_address', 1), 'type' => array('text', 1), 'required' => array('1', 1), 'single' => 1, 'classes' => ''), 'page_logic' => array('nice' => __('Page Logic', 'ym'), 'text' => array('page_logic', 1), 'name' => array('page_logic', 1), 'type' => array('page_logic', 1), 'required' => array('0', 1), 'single' => 1, 'classes' => ''), 'register_facebook' => array('nice' => __('Register with Facebook', 'ym'), 'text' => array('Register with Facebook', 0), 'name' => array('register_facebook', 0), 'type' => array('widget', 1), 'required' => array('0', 1), 'single' => 1, 'classes' => '')); // load custom fields that are active/enabled $fld_obj = get_option('ym_custom_fields'); $entries = $fld_obj->entries; $order = explode(';', $fld_obj->order); $req_lock = array('subscription_introduction', 'subscription_options', 'terms_and_conditions', 'coupon'); $exclude = array('user_email'); $customs = array(); foreach ($order as $id) { $entry = ym_get_custom_field_by_id($id); if (in_array($entry['name'], $exclude)) { continue; } if (!in_array($entry['name'], $req_lock)) { $req = 0; } else { $req = 1; } $customs[$entry['name']] = array('id' => $id, 'nice' => $entry['label'], 'text' => array($entry['label'], 1), 'name' => array($entry['name'], 1), 'type' => array('custom', 1), 'required' => array($entry['required'], $req), 'single' => 1, 'classes' => ''); if ($entry['name'] == 'ym_password') { $customs['ym_password']['options']['confirm_password'] = 0; } } // load active payment gateways $gateways = array(); $activated = get_option('ym_modules'); foreach ($activated as $gateway) { $class = new $gateway(); $name = $class->name; $gateways[$gateway . '_button'] = array('nice' => $name, 'text' => array($name, 0), 'name' => array($gateway, 1), 'type' => array('payment', 0), 'required' => array('0', 1), 'single' => 0, 'classes' => ''); } // package buy now buttons $buy_nows = array(); // name is AKA label for the field $fields = array('common' => $commons, 'custom' => $customs, 'payment' => $gateways); return $fields; }
} else { if (!validate_custom_field_label($name)) { // failed chars $new_error = __('Name can only contain a-z, 0-9, and _ characters', 'ym'); } else { if (!validate_custom_field_label_length($name)) { echo '<div id="message" class="error"><p>' . __('You have created a name that is longer than 10 Characters and cannot be synced with MailChimp', 'ym') . '</p></div>'; } } } if (empty($new_error)) { $fld_obj = get_option('ym_custom_fields'); $entries = $fld_obj->entries; foreach ($entries as $key => $entry) { if ($id == $entry['id']) { $old = ym_get_custom_field_by_id($id); $entry = array('id' => $id, 'name' => $name, 'label' => $label, 'caption' => $caption, 'available_values' => $available_values, 'type' => $type, 'required' => $required, 'value' => $value, 'page' => $page, 'readonly' => $readonly, 'profile_only' => $profile_only, 'no_profile' => $no_profile, 'builtin' => $old['builtin']); $fld_obj->entries[$key] = $entry; $sort_msg = __('Custom Field Updated', 'ym'); $_GET['mode'] = ''; $_GET['id'] = ''; } } update_option('ym_custom_fields', $fld_obj); } } $fields = get_option('ym_custom_fields'); $entries = $fields->entries; $ordering = $fields->order; if (isset($msg) && !empty($msg)) { ym_display_message($msg);
function ym_update_user_custom_fields($user_id, $data = array()) { global $ym_update_user_custom_fields_called; if ($ym_update_user_custom_fields_called) { return; } $ym_update_user_custom_fields_called = TRUE; // master sync // email first name last name password $core = array('ID' => $user_id); $return = 1; foreach ((array) $data as $id => $item) { $field = ym_get_custom_field_by_id($id); if ($item) { switch ($field['name']) { case 'user_email': case 'user_url': $core[$field['name']] = $item; break; case 'first_name': case 'last_name': update_user_meta($user_id, $field['name'], $item); break; case 'ym_password': // don't store the password unset($data[$field['name']]); if (!empty($item)) { wp_set_password($item, $user_id); $return = 'password'; } break; case 'user_description': update_user_meta($user_id, 'description', $item); break; } } } if (count($core) > 1) { wp_update_user($core); } // explicity clean/stop save of ym_password $id = ym_get_custom_field_by_name('ym_password'); $data[$id['id']] = ''; update_user_meta($user_id, 'ym_custom_fields', $data); return $return; }
function ym_members_filters($filters) { global $ym_members_tasks; // filters ym_box_top(__('Search and Sort', 'ym')); echo '<table style="width: 100%;">'; echo ' <tr><td colspan="10"> <table class="form-table" style="width: 100%;"> <tr><td> <strong>' . __('Filter Members by:', 'ym') . '</strong> <select name="filter_by_option" id="filter_by_option"> <option value="">' . __('No Filter', 'ym') . '</option> <option value="username" ' . ($filters['by_option'] == 'username' ? 'selected="selected"' : '') . '>' . __('Username', 'ym') . '</option> <option value="user_email" ' . ($filters['by_option'] == 'user_email' ? 'selected="selected"' : '') . '>' . __('User Email', 'ym') . '</option> <option value="package" ' . ($filters['by_option'] == 'package' ? 'selected="selected"' : '') . '>' . __('Package', 'ym') . '</option> <option value="package_type" ' . ($filters['by_option'] == 'package_type' ? 'selected="selected"' : '') . '>' . __('Package Type', 'ym') . '</option> <option value="custom_field" ' . ($filters['by_option'] == 'custom_field' ? 'selected="selected"' : '') . '>' . __('Custom Field', 'ym') . '</option> <option value="status" ' . ($filters['by_option'] == 'status' ? 'selected="selected"' : '') . '>' . __('Status', 'ym') . '</option> '; echo ' <option value="">--' . __('User Exposed Fields', 'ym') . '--</option> '; $funbus = ''; $available = new YourMember_User(); $available = $available->api_expose(); foreach ($available as $item) { if ($item != 'status' && $item != 'account_type') { $funbus .= 'filter_by_text_exposed_' . $item . ' '; echo '<option value="exposed_' . $item . '" ' . ($filters['by_option'] == 'exposed_' . $item ? 'selected="selected"' : '') . '>' . ucwords(str_replace('_', ' ', str_replace('account', 'package', $item))) . '</option>'; } } echo ' </select> </td><td> <select name="filter_by_text_package" class="filter_by_text filter_by_text_package"> <option value="">' . __('Select', 'ym') . '</option> <option value="none" '; if ('none' == $filters['by_text']) { echo 'selected="selected"'; } echo '>' . __('No Package', 'ym') . '</option>'; global $ym_packs; foreach ($ym_packs->packs as $pack) { echo '<option value="' . $pack['id'] . '" '; if ($pack['id'] == $filters['by_text']) { echo 'selected="selected"'; } echo '>' . ym_get_pack_label($pack) . '</option>'; } echo ' </select> <select name="filter_by_text_package_type" class="filter_by_text filter_by_text_package_type"> <option value="">' . __('Select', 'ym') . '</option> <option value="none" '; if ('none' == $filters['by_text']) { echo 'selected="selected"'; } echo '>' . __('No Package Type', 'ym') . '</option>'; global $ym_package_types; foreach ($ym_package_types->types as $type) { echo '<option value="' . $type . '" '; if ($type == $filters['by_text']) { echo 'selected="selected"'; } echo '>' . $type . '</option>'; } echo ' </select> <select name="filter_by_text_custom_field" class="filter_by_text filter_by_text_custom_field"> <option value="">' . __('Select', 'ym') . '</option> '; $customs = get_option('ym_custom_fields'); $order = explode(';', $customs->order); foreach ($order as $id) { $custom = ym_get_custom_field_by_id($id); echo '<option value="' . $id . '" '; if ($id == $filters['cf_field']) { echo 'selected="selected"'; } echo '>' . $custom['label'] . '</option>'; } echo ' </select> <select name="filter_by_text_status" class="filter_by_text filter_by_text_status"> <option value="">' . __('Select', 'ym') . '</option> '; global $status_str; foreach ($status_str as $state) { echo '<option '; if ($state == $filters['by_text']) { echo 'selected="selected"'; } echo '>' . $state . '</option>'; } echo ' </select> </td><td> <input type="text" name="filter_by_text" class="filter_by_text filter_by_text_username filter_by_text_user_email filter_by_text_custom_field ' . $funbus . '" value="' . $filters['by_text'] . '" size="10"> </td><td style="width: 120px;"> <input type="submit" id="change_filters" name="task" class="button-primary" value="' . $ym_members_tasks['change_filters'] . '" /> </td></tr> <tr><td style="width: 25%;"></td><td style="width: 25%;"></td><td style="width: 25%;">' . __('Use * to wildcard match', 'ym') . '</td><td style="width: 25%;"></td></tr> <tr><td> <strong>' . __('Sort Members by:', 'ym') . '</strong> <select name="filter_by_order_by"> <option value="ID" ' . ($filters['order_by'] == 'ID' ? 'selected="selected"' : '') . '>' . __('User ID', 'ym') . '</option> <option value="login" ' . ($filters['order_by'] == 'login' ? 'selected="selected"' : '') . '>' . __('User Login', 'ym') . '</option> <option value="email" ' . ($filters['order_by'] == 'email' ? 'selected="selected"' : '') . '>' . __('Email Address', 'ym') . '</option> <option value="registered" ' . ($filters['order_by'] == 'registered' ? 'selected="selected"' : '') . '>' . __('Registration Date', 'ym') . '</option> '; echo ' <option value="">--' . __('User Exposed Fields', 'ym') . '--</option> '; foreach ($available as $item) { echo '<option value="exposed_' . $item . '" ' . ($filters['order_by'] == 'exposed_' . $item ? 'selected="selected"' : '') . '>' . ucwords(str_replace('_', ' ', str_replace('account', 'package', $item))) . '</option>'; } echo ' </select> <td> </td> </td><td> <select name="filter_by_order_by_direction"> <option value="ASC" ' . ($filters['order_by_direction'] == 'ASC' ? 'selected="selected"' : '') . '>' . __('Ascending', 'ym') . '</option> <option value="DESC" ' . ($filters['order_by_direction'] == 'DESC' ? 'selected="selected"' : '') . '>' . __('Descending', 'ym') . '</option> </select> </td><td> <input type="submit" id="change_order" name="task" class="button-primary" value="' . $ym_members_tasks['change_order'] . '" /> </td></tr> </table> </td></tr> '; echo '</table>'; ym_box_bottom(); return; }