Ejemplo n.º 1
0
 /**
  * Returns the sanitized reward type for display or calculation.
  *
  * (1) inv .. Percentage based on actually paid amount.
  * (2) mem .. Percentage based on current membership price setting.
  * (3) abs .. Absolute value (in USD/etc).
  *
  * @since  1.0.0
  * @param  MS_Model_Membership $membership
  * @return string A valid reward type: inv/mem/abs
  */
 protected function get_type($membership)
 {
     $available_types = array('inv', 'mem', 'abs');
     $type = $membership->get_custom_data('aff_reward_type');
     if (!in_array($type, $available_types)) {
         $type = 'abs';
     }
     return $type;
 }
 /**
  * Displays a flag in the payment options page to enable/disable invitation
  * codes for a specific membership.
  *
  * @since  1.0.1.0
  * @param  MS_View $view The view that called the action.
  * @param  MS_Model_Membership $membership Membership being edited.
  */
 public function membership_option($view, $membership)
 {
     $action = MS_Controller_Membership::AJAX_ACTION_SET_CUSTOM_FIELD;
     $nonce = wp_create_nonce($action);
     $fields = array(array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), array('id' => 'no_invitation', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Does this Membership require an Invitation code?', 'membership2'), 'value' => lib3()->is_true($membership->get_custom_data('no_invitation')), 'before' => sprintf('%s <i class="wpmui-fa wpmui-fa-lock"></i>', __('Yes', 'membership2')), 'after' => sprintf('<i class="wpmui-fa wpmui-fa-unlock"></i> %s', __('No (public membership)', 'membership2')), 'class' => 'reverse', 'ajax_data' => array('action' => $action, '_wpnonce' => $nonce, 'membership_id' => $membership->id, 'field' => 'no_invitation')));
     foreach ($fields as $field) {
         MS_Helper_Html::html_element($field);
     }
 }