本文整理汇总了PHP中MS_Model_Member::get_usernames方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Model_Member::get_usernames方法的具体用法?PHP MS_Model_Member::get_usernames怎么用?PHP MS_Model_Member::get_usernames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Model_Member
的用法示例。
在下文中一共展示了MS_Model_Member::get_usernames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_fields
/**
* Prepare html fields.
*
* @since 1.0.0
*
* @return array
*/
function prepare_fields()
{
$invoice = $this->data['invoice'];
$currency = MS_Plugin::instance()->settings->currency;
$user_name = '';
$transaction_link = '';
$user_id = 0;
$user_list = array();
if ($invoice->id) {
$member = $invoice->get_member();
$user_id = $member->id;
$user_name = $member->name;
$transaction_link = sprintf('<a href="%s" target="_blank">%s</a>', MS_Controller_Plugin::get_admin_url('billing', array('show' => 'logs', 'invoice' => $invoice->id)), __('Show Transactions', 'membership2'));
} else {
$user_list = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
}
$fields = array('link_transactions' => array('id' => 'link_transactions', 'title' => $transaction_link, 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'wrapper_class' => 'ms-transactions-link'), 'txt_user' => array('id' => 'txt_user', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => sprintf('<a href="%s">%s</a>', MS_Controller_Plugin::get_admin_url('add-member', array('user_id' => $user_id)), $user_name)), 'txt_membership' => array('id' => 'txt_membership', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_created' => array('id' => 'txt_created', 'title' => __('Invoice created on', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'status' => array('id' => 'status', 'title' => __('Invoice status', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => MS_Model_Invoice::get_status_types(true), 'value' => $invoice->status), 'user_id' => array('id' => 'user_id', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->user_id, 'field_options' => $user_list), 'membership_id' => array('id' => 'membership_id', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->membership_id, 'field_options' => $this->data['memberships']), 'amount' => array('id' => 'amount', 'title' => sprintf(__('Amount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->amount), 'config' => array('step' => 'any', 'min' => 0)), 'discount' => array('id' => 'discount', 'title' => sprintf(__('Discount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->discount), 'config' => array('step' => 'any', 'min' => 0)), 'due_date' => array('id' => 'due_date', 'title' => __('Due date', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $invoice->due_date), 'description' => array('id' => 'description', 'title' => __('Description', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'class' => 'widefat', 'value' => $invoice->description), 'notes' => array('id' => 'notes', 'title' => __('Notes', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'class' => 'widefat', 'value' => $invoice->get_notes_desc()), 'invoice_id' => array('id' => 'invoice_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), 'separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'execute' => array('id' => 'execute', 'title' => __('Execute status change actions on Save (add/remove membership)', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'value' => true), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', 'membership2'), 'value' => __('Cancel', 'membership2'), 'url' => esc_url_raw(remove_query_arg(array('action', 'invoice_id'))), 'class' => 'wpmui-field-button button'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', 'membership2')));
if ($invoice->id > 0) {
$fields['user_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
$fields['membership_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
$fields['txt_membership']['value'] = $this->data['memberships'][$invoice->membership_id];
$fields['txt_created']['value'] = MS_Helper_Period::format_date($invoice->invoice_date);
} else {
unset($fields['txt_user']);
unset($fields['txt_membership']);
unset($fields['txt_created']);
unset($fields['txt_separator']);
}
return apply_filters('ms_view_billing_edit_prepare_fields', $fields, $this);
}
示例2: prepare_fields
/**
* Prepare html fields.
*
* @since 1.0.1.0
*
* @return array
*/
function prepare_fields()
{
$member = $this->data['member'];
$userlist = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
$log = $this->data['log'];
$data_action = MS_Controller_Billing::AJAX_ACTION_TRANSACTION_LINK_DATA;
$update_action = MS_Controller_Billing::AJAX_ACTION_TRANSACTION_UPDATE;
$fields = array();
$member_id = 0;
if ($member && $member->id) {
$member_id = $member->id;
}
$fields['info'] = array('id' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Transaction ID', 'membership2'), 'value' => $log->id), 'gateway' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Payment Gateway', 'membership2'), 'value' => MS_Model_Gateway::get_name($log->gateway_id, true)), 'amount' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Transaction Amount', 'membership2'), 'value' => MS_Helper_Billing::format_price($log->amount)), 'details' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Transaction Details', 'membership2'), 'value' => $log->description), 'sep' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR, 'value' => 'vertical'));
$fields['member'] = array('user_id' => array('id' => 'user_id', 'title' => __('1. Payment by user', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $member_id, 'field_options' => $userlist));
$fields['subscription'] = array('subscription_id' => array('id' => 'subscription_id', 'title' => __('2. Payment for subscription', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => 0, 'field_options' => array()));
$fields['invoice'] = array('invoice_id' => array('id' => 'invoice_id', 'title' => __('3. Link payment with invoice', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => 0, 'field_options' => array(), 'after' => __('The selected Invoice will be marked as "paid"', 'membership2')));
$fields['buttons'] = array('nonce_link_data' => array('id' => 'nonce_link_data', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($data_action)), 'nonce_update' => array('id' => 'nonce_update', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($update_action)), 'log_id' => array('id' => 'log_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $log->id), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Cancel', 'membership2'), 'class' => 'wpmui-field-button button close'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Transaction', 'membership2')));
return apply_filters('ms_view_billing_link_prepare_fields', $fields, $this);
}
示例3: ajax_link_transaction
/**
* Ajax action handler used by the transaction logs list to change a
* transaction log entry.
*
* Returns a form to link a transaction with an invoice.
*
* @since 1.0.1.0
*/
public function ajax_link_transaction()
{
$data = array();
$resp = '';
$fields = array('id');
if (self::validate_required($fields) && $this->verify_nonce()) {
$id = intval($_POST['id']);
$log = MS_Factory::load('MS_Model_Transactionlog', $id);
if ($log->member_id) {
$data['member'] = $log->get_member();
} else {
$data['member'] = false;
}
$data['log'] = $log;
$data['users'] = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
$view = MS_Factory::create('MS_View_Billing_Link');
$view->data = apply_filters('ms_view_billing_link_data', $data);
$resp = $view->to_html();
}
echo $resp;
exit;
}