public function regigstration_ui($level)
 {
     //Trigger the filter to override the registration form (the form builder addon uses this filter)
     $form = apply_filters('swpm_registration_form_override', '', $level);
     //The $level value could be empty also so the code handling the filter need to check for it.
     if (!empty($form)) {
         //An addon has overridden the registration form. So use that one.
         return $form;
     }
     $settings_configs = SwpmSettings::get_instance();
     $joinuspage_url = $settings_configs->get_value('join-us-page-url');
     $membership_level = '';
     global $wpdb;
     if (SwpmUtils::is_paid_registration()) {
         //Lets check if this is a registration for paid membership
         $member = SwpmUtils::get_paid_member_info();
         if (empty($member)) {
             SwpmUtils::e('Error! Invalid Request. Could not find a match for the given security code and the user ID.');
         } else {
             $membership_level = $member->membership_level;
         }
     } else {
         if (!empty($level)) {
             //Membership level is specified in the shortcode (level specific registration form).
             $member = SwpmTransfer::$default_fields;
             $membership_level = absint($level);
         }
     }
     //Check if free membership registration is disalbed on the site
     if (empty($membership_level)) {
         $joinuspage_link = '<a href="' . $joinuspage_url . '">Join us</a>';
         $free_rego_disabled_msg = '<p>';
         $free_rego_disabled_msg .= SwpmUtils::_('Free membership is disabled on this site. Please make a payment from the ' . $joinuspage_link . ' page to pay for a premium membership.');
         $free_rego_disabled_msg .= '</p><p>';
         $free_rego_disabled_msg .= SwpmUtils::_('You will receive a unique link via email after the payment. You will be able to use that link to complete the premium membership registration.');
         $free_rego_disabled_msg .= '</p>';
         return $free_rego_disabled_msg;
     }
     //Handle the registration form in core plugin
     $mebership_info = SwpmPermission::get_instance($membership_level);
     $membership_level = $mebership_info->get('id');
     if (empty($membership_level)) {
         return "Error! Failed to retrieve membership level ID from the membership info object.";
     }
     $level_identifier = md5($membership_level);
     $membership_level_alias = $mebership_info->get('alias');
     $swpm_registration_submit = filter_input(INPUT_POST, 'swpm_registration_submit');
     if (!empty($swpm_registration_submit)) {
         $member = array_map('sanitize_text_field', $_POST);
     }
     ob_start();
     extract((array) $member, EXTR_SKIP);
     include SIMPLE_WP_MEMBERSHIP_PATH . 'views/add.php';
     return ob_get_clean();
 }
 public function regigstration_ui($level)
 {
     $form = apply_filters('swpm_registration_form_override', '', $level);
     if (!empty($form)) {
         return $form;
     }
     $settings_configs = SwpmSettings::get_instance();
     $joinuspage_url = $settings_configs->get_value('join-us-page-url');
     $membership_level = '';
     global $wpdb;
     if (SwpmUtils::is_paid_registration()) {
         //Lets check if this is a registration for paid membership
         $member = SwpmUtils::get_paid_member_info();
         if (empty($member)) {
             SwpmUtils::e('Error! Invalid Request. Could not find a match for the given security code and the user ID.');
         } else {
             $membership_level = $member->membership_level;
         }
     } else {
         if (!empty($level)) {
             $member = SwpmTransfer::$default_fields;
             $membership_level = absint($level);
         }
     }
     if (empty($membership_level)) {
         $joinuspage_link = '<a href="' . $joinuspage_url . '">Join us</a>';
         echo '<p>';
         SwpmUtils::e('Free membership is disabled on this site. Please make a payment from the ' . $joinuspage_link . ' page to pay for a premium membership.');
         echo '</p><p>';
         SwpmUtils::e('You will receive a unique link via email after the payment. You will be able to use that link to complete the premium membership registration.');
         echo '</p>';
         return;
     }
     $mebership_info = SwpmPermission::get_instance($membership_level);
     $membership_level = $mebership_info->get('id');
     if (empty($membership_level)) {
         return "Membership Level Not Found.";
     }
     $level_identifier = md5($membership_level);
     $membership_level_alias = $mebership_info->get('alias');
     $swpm_registration_submit = filter_input(INPUT_POST, 'swpm_registration_submit');
     if (!empty($swpm_registration_submit)) {
         $member = $_POST;
     }
     ob_start();
     extract((array) $member, EXTR_SKIP);
     include SIMPLE_WP_MEMBERSHIP_PATH . 'views/add.php';
     return ob_get_clean();
 }