本文整理汇总了PHP中RSMembershipHelper::getUserFields方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::getUserFields方法的具体用法?PHP RSMembershipHelper::getUserFields怎么用?PHP RSMembershipHelper::getUserFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::getUserFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _execute
function _execute()
{
$mainframe =& JFactory::getApplication();
$option = 'com_rsmembership';
$task = JRequest::getVar('task', '');
if ($task == 'upgrade') {
$this->_bindId();
} else {
$this->_setId();
if ($task == 'upgradepayment') {
// empty session
$this->_emptySession();
$extras = array();
$upgrade = $this->getUpgrade();
$membership = $this->getMembership($upgrade->membership_to_id);
$paymentplugin = JRequest::getCmd('payment', 'none');
// calculate the total price
$total = $upgrade->price;
$user =& JFactory::getUser();
$user_id = $user->get('id');
$row =& JTable::getInstance('RSMembership_Transactions', 'Table');
$row->user_id = $user_id;
$row->user_email = $user->get('email');
$this->_data = new stdClass();
$this->_data->username = $user->get('username');
$this->_data->name = $user->get('name');
$this->_data->email = $user->get('email');
$this->_data->fields = RSMembershipHelper::getUserFields($user->get('id'));
$row->user_data = serialize($this->_data);
$row->type = 'upgrade';
$params = array();
$params[] = 'id=' . $this->_id;
$params[] = 'from_id=' . $upgrade->membership_from_id;
$params[] = 'to_id=' . $upgrade->membership_to_id;
$row->params = implode(';', $params);
// params, membership, extras etc
$date = JFactory::getDate();
$row->date = $date->toUnix();
$row->ip = $_SERVER['REMOTE_ADDR'];
$row->price = $total;
$row->currency = RSMembershipHelper::getConfig('currency');
$row->hash = '';
$row->gateway = $paymentplugin == 'none' ? 'No Gateway' : RSMembership::getPlugin($paymentplugin);
$row->status = 'pending';
$this->_html = '';
// trigger the payment plugin
$paymentpluginClass = $paymentplugin;
if (preg_match('#rsmembershipwire([0-9]+)#', $paymentplugin, $match)) {
$paymentpluginClass = 'rsmembershipwire';
}
$className = 'plgSystem' . $paymentpluginClass;
$delay = false;
if (class_exists($className) && method_exists($className, 'onMembershipPayment')) {
$dispatcher =& JDispatcher::getInstance();
$plugin = new $className($dispatcher, array());
$args = array('plugin' => $paymentplugin, 'data' => &$this->_data, 'extras' => $extras, 'membership' => $membership, 'transaction' => &$row);
$this->_html = call_user_func_array(array($plugin, 'onMembershipPayment'), $args);
if (method_exists($className, 'hasDelayTransactionStoring')) {
$delay = $plugin->hasDelayTransactionStoring();
if (method_exists($className, 'delayTransactionStoring')) {
$plugin->delayTransactionStoring($row->getProperties());
}
}
}
// plugin can delay the transaction storing
if (!$delay) {
// store the transaction
$row->store();
// store the transaction id
$this->transaction_id = $row->id;
// finalize the transaction (send emails)
RSMembership::finalize($this->transaction_id);
// approve the transaction
if ($row->status == 'completed' || $row->price == 0 && $membership->activation != 0) {
RSMembership::approve($this->transaction_id, true);
}
if ($row->price == 0) {
$mainframe->redirect(JRoute::_('index.php?option=com_rsmembership&task=thankyou', false));
}
}
}
}
}
示例2: _execute
function _execute()
{
$app = JFactory::getApplication();
$task = $app->input->get('task', '', 'string');
if ($task == 'addextra') {
$this->_bindId();
} else {
$this->_setId();
if ($task == 'addextrapayment') {
// empty session
$this->_emptySession();
$membership = $this->getMembership();
$extra = $this->getExtra();
$paymentplugin = $app->input->get('payment', 'none', 'cmd');
// calculate the total price
$total = $extra->price;
$user = JFactory::getUser();
$user_id = $user->get('id');
$row = JTable::getInstance('Transaction', 'RSMembershipTable');
$row->user_id = $user_id;
$row->user_email = $user->get('email');
$this->_data = new stdClass();
$this->_data->username = $user->get('username');
$this->_data->name = $user->get('name');
$this->_data->email = $user->get('email');
$this->_data->fields = RSMembershipHelper::getUserFields($user->get('id'));
$membership_fields = RSMembershipHelper::getTransactionMembershipFields($user->get('id'), $membership->last_transaction_id);
if (count($membership_fields)) {
$this->_data->membership_fields = $membership_fields;
}
$row->user_data = serialize($this->_data);
$row->type = 'addextra';
$params = array();
$params[] = 'id=' . $this->_id;
$params[] = 'membership_id=' . $membership->id;
$params[] = 'extras=' . $extra->id;
$row->params = implode(';', $params);
// params, membership, extras etc
$row->date = JFactory::getDate()->toSql();
$row->ip = $_SERVER['REMOTE_ADDR'];
$row->price = $total;
$row->currency = RSMembershipHelper::getConfig('currency');
$row->hash = '';
$row->gateway = $paymentplugin == 'none' ? 'No Gateway' : RSMembership::getPlugin($paymentplugin);
$row->status = 'pending';
$this->_html = '';
// trigger the payment plugin
$delay = false;
$args = array('plugin' => $paymentplugin, 'data' => &$this->_data, 'extras' => array(), 'membership' => $membership, 'transaction' => &$row, 'html' => &$this->_html);
$returns = $app->triggerEvent('onMembershipPayment', $args);
// PHP 5.4 fix...
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
foreach ($returns as $value) {
if ($value) {
$this->_html = $value;
}
}
}
$properties = $row->getProperties();
$returns = $app->triggerEvent('delayTransactionStoring', array(array('plugin' => $paymentplugin, 'properties' => &$properties, 'delay' => &$delay)));
// PHP 5.4 fix...
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
foreach ($returns as $value) {
if ($value) {
$delay = true;
}
}
}
// plugin can delay the transaction storing
if (!$delay) {
// store the transaction
$row->store();
// store the transaction id
$this->transaction_id = $row->id;
// finalize the transaction (send emails)
RSMembership::finalize($this->transaction_id);
// approve the transaction
if ($row->status == 'completed' || $row->price == 0 && $membership->activation != 0) {
RSMembership::approve($this->transaction_id, true);
}
if ($row->price == 0) {
$app->redirect(JRoute::_(RSMembershipRoute::ThankYou(), false));
}
}
}
}
}