function eddsss_subscription_status_shortcode()
 {
     if (!is_user_logged_in() || !class_exists('EDD_Recurring_Customer')) {
         return;
     }
     $user_id = get_current_user_id();
     $status = EDD_Recurring_Customer::get_customer_status($user_id);
     if ($status !== 'active' && $status !== 'cancelled' && $status !== 'expired') {
         return;
     }
     // Check if expired and set to expired if so
     if (EDD_Recurring_Customer::is_customer_expired($user_id)) {
         $status = 'expired';
         EDD_Recurring_Customer::set_customer_status($user_id, $status);
     }
     $message = '';
     switch ($status) {
         case 'active':
             $message = sprintf(__('Your subscription is active and will renew on %s.', 'edd'), date_i18n(get_option('date_format'), EDD_Recurring_Customer::get_customer_expiration($user_id)));
             break;
         case 'cancelled':
             $message = sprintf(__('Your subscription is cancelled and expires on %s.', 'edd'), date_i18n(get_option('date_format'), EDD_Recurring_Customer::get_customer_expiration($user_id)));
             break;
         case 'expired':
             $message = sprintf(__('Your subscription expired on %s.', 'edd'), date_i18n(get_option('date_format'), EDD_Recurring_Customer::get_customer_expiration($user_id)));
             break;
     }
     if (!empty($message)) {
         return '<div id="edd-subscription-status" class="' . esc_attr($status) . '">' . $message . '</div>';
     }
 }
 /**
  * Setup final data
  *
  * @access      private
  * @since       1.0
  * @return      array
  */
 function reports_data()
 {
     global $wpdb;
     $reports_data = array();
     $subscribers = $this->query();
     if (!empty($subscribers->results)) {
         foreach ($subscribers->results as $subscriber) {
             $expiration = EDD_Recurring_Customer::get_customer_expiration($subscriber->ID);
             $exp_date = !empty($expiration) ? date(get_option('date_format'), $expiration) : '';
             $status = EDD_Recurring_Customer::get_customer_status($subscriber->ID);
             $status = !empty($status) ? $status : __('none', 'edd-recurring');
             $recurring_id = EDD_Recurring_Customer::get_customer_id($subscriber->ID);
             $recurring_id = !empty($recurring_id) ? $recurring_id : __('none', 'edd-recurring');
             $reports_data[] = array('ID' => $subscriber->ID, 'username' => $subscriber->user_login, 'status' => $status, 'expiration' => $exp_date, 'recurring_id' => $recurring_id);
         }
     }
     return $reports_data;
 }
 /**
  * Displays a payment update form
  *
  * @since  x.x
  * @return string
  */
 public function update_payment_form()
 {
     global $user_ID;
     if (!is_user_logged_in()) {
         return;
     }
     if (!EDD_Recurring_Customer::is_customer_active($user_ID)) {
         return;
     }
     if ('cancelled' === EDD_Recurring_Customer::get_customer_status($user_ID)) {
         return;
     }
     // Gateways can choose to show the form or not by using this filter
     $show_cc_form = apply_filters('edd_recurring_customer_can_update_card', false, $user_ID);
     if (!$show_cc_form) {
         $form_fields = array();
         $form_fields['cc_number'] = array('type' => 'text', 'options' => array('name' => 'edd-recurring-card-number', 'label' => __('Credit Card Number', 'edd-recurring'), 'placeholder' => __('Credit Card Number', 'edd-recurring'), 'autocomplete' => false));
         $form_fields['cc_name'] = array('type' => 'text', 'options' => array('name' => 'edd-recurring-card-name', 'label' => __('Name on Card', 'edd-recurring'), 'placeholder' => __('Name on Card', 'edd-recurring'), 'autocomplete' => true));
         $form_fields['cvc_number'] = array('type' => 'text', 'options' => array('name' => 'edd-recurring-cvc-number', 'class' => 'small-text', 'label' => __('CVC Number', 'edd-recurring'), 'placeholder' => __('###', 'edd-recurring'), 'autocomplete' => false));
         $form_fields['exp_head'] = array('type' => 'legend', 'options' => array('text' => __('Card Expiration', 'edd-recurring')));
         $form_fields['exp_month'] = array('type' => 'month_dropdown');
         $form_fields['exp_year'] = array('type' => 'year_dropdown', 'number_of_years' => 10);
         $elements = apply_filters('edd_recurring_update_form_elements', $form_fields, $user_ID);
     }
     $form_output = '';
     if (isset($_GET['updated']) && $_GET['updated'] == true && !edd_get_errors()) {
         $form_output = '<p class="edd_success"><strong>' . __('Success', 'edd') . ':</strong> ' . __('Your profile has been edited successfully.', 'edd') . '</p>';
     }
     $form_output .= '<div id="edd-recurring-update-wrapper">';
     $form_output .= '<form action="' . remove_query_arg('updated', edd_get_current_page_url()) . '" id="edd-recurring-form" method="POST">';
     $form_input_html = '';
     if (!$show_cc_form) {
         // Iterate through all the form elements, and add them to the HTML
         foreach ($elements as $element) {
             switch ($element['type']) {
                 case 'month_dropdown':
                     $form_input_html .= EDD()->html->{$element}['type']();
                     break;
                 case 'year_dropdown':
                     $form_input_html .= EDD()->html->{$element}['type']('edd-recurring-exp-year', null, 0, $element['number_of_years']);
                     break;
                 case 'legend':
                     $form_input_html .= '<legend>' . $element['options']['text'] . '</legend>';
                     break;
                 default:
                     $form_input_html .= EDD()->html->{$element}['type']($element['options']);
                     $form_input_html .= '<br />';
                     break;
             }
         }
     }
     ob_start();
     edd_print_errors();
     $form_output .= ob_get_clean();
     $form_output .= apply_filters('edd_recurring_update_form_html', $form_input_html, $user_ID);
     $recurring_gateway = apply_filters('edd_recurring_update_gateway', '', $user_ID);
     $form_output .= '<input name="edd-recurring-update-gateway" type="hidden" value="' . $recurring_gateway . '" />';
     $form_output .= wp_nonce_field('update-payment', 'edd_recurring_update_nonce', true, false);
     $form_output .= '<input type="hidden" name="edd_action" value="recurring_update_payment" />';
     $form_output .= '<input type="submit" name="edd-recurring-update-submit" id="edd-recurring-update-submit" value="' . esc_attr(__('Update Payment', 'edd-recurring')) . '" />';
     $form_output .= '</form>';
     $form_output .= '</div>';
     return '<div id="edd_checkout_form_wrap">' . $form_output . '</div>';
 }