From d38db75edd09ad569a510b68f36fb525258cb0be Mon Sep 17 00:00:00 2001 From: frontend Date: Mon, 15 Mar 2021 01:47:35 +0100 Subject: [PATCH] aggiunte birt_date e birth_place --- .../classes/class.simple-wp-membership.php | 1 + simple-membership/classes/class.swpm-form.php | 16 +++ .../classes/class.swpm-installation.php | 4 +- .../classes/class.swpm-members.php | 8 +- .../classes/class.swpm-transfer.php | 11 ++- .../classes/class.swpm-utils-misc.php | 4 + simple-membership/views/add (copia).php | 97 +++++++++++++++++++ simple-membership/views/add.php | 34 +++++++ .../views/admin_member_form_common_part.php | 12 ++- 9 files changed, 177 insertions(+), 10 deletions(-) create mode 100644 simple-membership/views/add (copia).php diff --git a/simple-membership/classes/class.simple-wp-membership.php b/simple-membership/classes/class.simple-wp-membership.php index 278f982..3632451 100644 --- a/simple-membership/classes/class.simple-wp-membership.php +++ b/simple-membership/classes/class.simple-wp-membership.php @@ -397,6 +397,7 @@ class SimpleWpMembership { $fields['email'] = $user_info->user_email; $fields['first_name'] = $user_info->first_name; $fields['last_name'] = $user_info->last_name; + $fields['birth_place'] = $user_info->birth_place; $fields['membership_level'] = $default_level; $fields['member_since'] = SwpmUtils::get_current_date_in_wp_zone(); $fields['account_state'] = $default_ac_status; diff --git a/simple-membership/classes/class.swpm-form.php b/simple-membership/classes/class.swpm-form.php index c8a8c7f..696b896 100644 --- a/simple-membership/classes/class.swpm-form.php +++ b/simple-membership/classes/class.swpm-form.php @@ -215,6 +215,22 @@ class SwpmForm { $this->sanitized['membership_level'] = $membership_level; } + protected function birth_place() { + $birth_place = filter_input(INPUT_POST, 'birth_place', FILTER_SANITIZE_STRING); + $this->sanitized['birth_place'] = sanitize_text_field($birth_place); + return; + } + + protected function birth_date() { + $birth_date = filter_input(INPUT_POST, 'birth_date', FILTER_UNSAFE_RAW); + if (empty($birth_date)) {return;} + if (preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $birth_date)){ + $this->sanitized['birth_date'] = sanitize_text_field($birth_date); + return; + } + $this->errors['birth_date'] = SwpmUtils::_('Birth Date field is invalid'); + } + protected function password_re() { } diff --git a/simple-membership/classes/class.swpm-installation.php b/simple-membership/classes/class.swpm-installation.php index 5512b23..e5955b2 100644 --- a/simple-membership/classes/class.swpm-installation.php +++ b/simple-membership/classes/class.swpm-installation.php @@ -80,7 +80,9 @@ class SwpmInstallation { company_name varchar(255) DEFAULT '', notes text DEFAULT NULL, flags int(11) DEFAULT '0', - profile_image varchar(255) DEFAULT '' + profile_image varchar(255) DEFAULT '', + birth_place varchar(255) DEFAULT NULL, + birth_date date NOT NULL DEFAULT '0000-00-00', )" . $charset_collate . ";"; dbDelta($sql); diff --git a/simple-membership/classes/class.swpm-members.php b/simple-membership/classes/class.swpm-members.php index cc06d13..5f43862 100644 --- a/simple-membership/classes/class.swpm-members.php +++ b/simple-membership/classes/class.swpm-members.php @@ -27,6 +27,7 @@ class SwpmMembers extends WP_List_Table { 'subscription_starts' => SwpmUtils::_( 'Access Starts' ), 'account_state' => SwpmUtils::_( 'Account State' ), 'last_accessed' => SwpmUtils::_( 'Last Login Date' ), + 'birth_place' => SwpmUtils::_( 'Birth Place' ), ); } @@ -41,6 +42,7 @@ class SwpmMembers extends WP_List_Table { 'subscription_starts' => array( 'subscription_starts', false ), 'account_state' => array( 'account_state', false ), 'last_accessed' => array( 'last_accessed', false ), + 'birth_place' => array( 'birth_place', false ), ); } @@ -94,7 +96,7 @@ class SwpmMembers extends WP_List_Table { $this->process_bulk_action(); - $records_query_head = 'SELECT member_id,user_name,first_name,last_name,email,alias,subscription_starts,account_state,last_accessed'; + $records_query_head = 'SELECT member_id,user_name,first_name,last_name,email,alias,subscription_starts,account_state,last_accessed,birth_place'; $count_query_head = 'SELECT COUNT(member_id)'; $query = ' '; @@ -125,7 +127,8 @@ class SwpmMembers extends WP_List_Table { . " OR address_city LIKE '%" . strip_tags( $s ) . "%' " . " OR address_state LIKE '%" . strip_tags( $s ) . "%' " . " OR country LIKE '%" . strip_tags( $s ) . "%' " - . " OR company_name LIKE '%" . strip_tags( $s ) . "%' )"; + . " OR company_name LIKE '%" . strip_tags( $s ) . "%' " + . " OR birth_place LIKE '%" . strip_tags( $s ) . "%' )"; } //Add account status filtering to the query @@ -777,4 +780,3 @@ class SwpmMembers extends WP_List_Table { } } - diff --git a/simple-membership/classes/class.swpm-transfer.php b/simple-membership/classes/class.swpm-transfer.php index 87727ee..1b9730f 100644 --- a/simple-membership/classes/class.swpm-transfer.php +++ b/simple-membership/classes/class.swpm-transfer.php @@ -6,18 +6,21 @@ class SwpmTransfer { 'first_name' => '', 'last_name' => '', 'user_name' => '', 'email' => '', 'password' => '', + 'birth_place' => '', + 'birth_date' => '', 'phone' => '', 'account_state' => '', 'member_since' => '', 'subscription_starts' => '', 'address_street' => '', 'address_city' => '', 'address_state' => '', 'address_zipcode' => '', 'company_name' => '', 'country' => '', 'gender' => 'not specified', - 'membership_level' => '2'); - + 'membership_level' => '2', + ); + public static $default_level_fields = array( 'alias' => '', 'role' => '', 'subscription_period' => '', 'subscription_duration_type' => SwpmMembershipLevel::NO_EXPIRY); - + public static $admin_messages = array(); private static $_this; @@ -39,7 +42,7 @@ class SwpmTransfer { $messages = new SwpmMessages(); $messages->set($key, $value); } - + /*** Deprecated function - exists only for backwards compatibility ***/ public static function get_real_ip_addr() { return SwpmUtils::get_user_ip_address(); diff --git a/simple-membership/classes/class.swpm-utils-misc.php b/simple-membership/classes/class.swpm-utils-misc.php index 7460806..314c28b 100644 --- a/simple-membership/classes/class.swpm-utils-misc.php +++ b/simple-membership/classes/class.swpm-utils-misc.php @@ -323,6 +323,8 @@ class SwpmMiscUtils { '{login_link}', '{reg_link}', '{primary_address}', + '{birth_place}', + '{birth_date}', ); //Define the values @@ -343,6 +345,8 @@ class SwpmMiscUtils { $login_link, $reg_link, $primary_address, + $user_record->birth_place, + $user_record->birth_date, ); $msg_body = str_replace( $tags, $vals, $msg_body ); diff --git a/simple-membership/views/add (copia).php b/simple-membership/views/add (copia).php new file mode 100644 index 0000000..e562bc4 --- /dev/null +++ b/simple-membership/views/add (copia).php @@ -0,0 +1,97 @@ + array('extraData' => '&action=swpm_validate_email&member_id=' . filter_input(INPUT_GET, 'member_id')))); +$settings = SwpmSettings::get_instance(); +$force_strong_pass = $settings->get_value('force-strong-passwords'); +if (!empty($force_strong_pass)) { + $pass_class = "validate[required,custom[strongPass],minSize[8]]"; +} else { + $pass_class = ""; +} +// Filter allowing to change the default value of user_name +$user_name = apply_filters('swpm_registration_form_set_username', $user_name); +?> +
+
+ + + > + + + + + + + + + + + + + + + + > + + + + > + + + + > + + + + get_value('enable-terms-and-conditions'); + if (!empty($terms_enabled)) { + $terms_page_url = $settings->get_value('terms-and-conditions-page-url'); + ?> + + + + get_value('enable-privacy-policy'); + if (!empty($pp_enabled)) { + $pp_page_url = $settings->get_value('privacy-policy-page-url'); + ?> + + + + +
/>
+ '; + //Add the level input verification data. + $swpm_p_key = get_option('swpm_private_key_one'); + if (empty($swpm_p_key)) { + $swpm_p_key = uniqid('', true); + update_option('swpm_private_key_one', $swpm_p_key); + } + $swpm_level_hash = md5($swpm_p_key . '|' . $membership_level); //level hash + echo ''; + ?> +
+ +
+ +
+ +
+ +
+ +
+ + + +
+
diff --git a/simple-membership/views/add.php b/simple-membership/views/add.php index e562bc4..d62bda7 100644 --- a/simple-membership/views/add.php +++ b/simple-membership/views/add.php @@ -38,6 +38,40 @@ $user_name = apply_filters('swpm_registration_form_set_username', $user_name); + + > + + + + + + + + + + + + + + + + + + + + + + + + > + + + + > + + + + > diff --git a/simple-membership/views/admin_member_form_common_part.php b/simple-membership/views/admin_member_form_common_part.php index 538d644..4d97307 100644 --- a/simple-membership/views/admin_member_form_common_part.php +++ b/simple-membership/views/admin_member_form_common_part.php @@ -10,7 +10,7 @@ - + @@ -53,7 +53,15 @@ - + + + + + + + + +