aggiunte birt_date e birth_place
This commit is contained in:
parent
083deb5a60
commit
d38db75edd
9 changed files with 177 additions and 10 deletions
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
|
|
97
simple-membership/views/add (copia).php
Normal file
97
simple-membership/views/add (copia).php
Normal file
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
SimpleWpMembership::enqueue_validation_scripts(array('ajaxEmailCall' => 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);
|
||||
?>
|
||||
<div class="swpm-registration-widget-form">
|
||||
<form id="swpm-registration-form" class="swpm-validate-form" name="swpm-registration-form" method="post" action="">
|
||||
<input type ="hidden" name="level_identifier" value="<?php echo $level_identifier ?>" />
|
||||
<table>
|
||||
<tr class="swpm-registration-username-row" <?php apply_filters('swpm_registration_form_username_tr_attributes', ''); ?>>
|
||||
<td><label for="user_name"><?php echo SwpmUtils::_('Username') ?></label></td>
|
||||
<td><input type="text" id="user_name" class="validate[required,custom[noapostrophe],custom[SWPMUserName],minSize[4],ajax[ajaxUserCall]]" value="<?php echo esc_attr($user_name); ?>" size="50" name="user_name" <?php apply_filters('swpm_registration_form_username_input_attributes', ''); ?>/></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-email-row">
|
||||
<td><label for="email"><?php echo SwpmUtils::_('Email') ?></label></td>
|
||||
<td><input type="text" autocomplete="off" id="email" class="validate[required,custom[email],ajax[ajaxEmailCall]]" value="<?php echo esc_attr($email); ?>" size="50" name="email" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-password-row">
|
||||
<td><label for="password"><?php echo SwpmUtils::_('Password') ?></label></td>
|
||||
<td><input type="password" autocomplete="off" id="password" class="<?php echo $pass_class; ?>" value="" size="50" name="password" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-password-retype-row">
|
||||
<td><label for="password_re"><?php echo SwpmUtils::_('Repeat Password') ?></label></td>
|
||||
<td><input type="password" autocomplete="off" id="password_re" value="" size="50" name="password_re" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-firstname-row" <?php apply_filters('swpm_registration_form_firstname_tr_attributes', ''); ?>>
|
||||
<td><label for="first_name"><?php echo SwpmUtils::_('First Name') ?></label></td>
|
||||
<td><input type="text" id="first_name" value="<?php echo esc_attr($first_name); ?>" size="50" name="first_name" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-lastname-row" <?php apply_filters('swpm_registration_form_lastname_tr_attributes', ''); ?>>
|
||||
<td><label for="last_name"><?php echo SwpmUtils::_('Last Name') ?></label></td>
|
||||
<td><input type="text" id="last_name" value="<?php echo esc_attr($last_name); ?>" size="50" name="last_name" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-membership-level-row" <?php apply_filters('swpm_registration_form_membership_level_tr_attributes', ''); ?>>
|
||||
<td><label for="membership_level"><?php echo SwpmUtils::_('Membership Level') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
echo $membership_level_alias; //Show the level name in the form.
|
||||
//Add the input fields for the level data.
|
||||
echo '<input type="hidden" value="' . $membership_level . '" size="50" name="membership_level" id="membership_level" />';
|
||||
//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 '<input type="hidden" name="swpm_level_hash" value="' . $swpm_level_hash . '" />';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
apply_filters('swpm_registration_form_before_terms_and_conditions', '');
|
||||
//check if we need to display Terms and Conditions checkbox
|
||||
$terms_enabled = $settings->get_value('enable-terms-and-conditions');
|
||||
if (!empty($terms_enabled)) {
|
||||
$terms_page_url = $settings->get_value('terms-and-conditions-page-url');
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;">
|
||||
<label><input type="checkbox" id="accept_terms" name="accept_terms" class="validate[required]" value="1"> <?php echo SwpmUtils::_('I accept the ') ?> <a href="<?php echo $terms_page_url; ?>" target="_blank"><?php echo SwpmUtils::_('Terms and Conditions') ?></a></label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
//check if we need to display Privacy Policy checkbox
|
||||
$pp_enabled = $settings->get_value('enable-privacy-policy');
|
||||
if (!empty($pp_enabled)) {
|
||||
$pp_page_url = $settings->get_value('privacy-policy-page-url');
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;">
|
||||
<label><input type="checkbox" id="accept_pt" name="accept_pp" class="validate[required]" value="1"> <?php echo SwpmUtils::_('I agree to the ') ?> <a href="<?php echo $pp_page_url; ?>" target="_blank"><?php echo SwpmUtils::_('Privacy Policy') ?></a></label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<div class="swpm-before-registration-submit-section" align="center"><?php echo apply_filters('swpm_before_registration_submit_button', ''); ?></div>
|
||||
|
||||
<div class="swpm-registration-submit-section" align="center">
|
||||
<input type="submit" value="<?php echo SwpmUtils::_('Register') ?>" class="swpm-registration-submit" name="swpm_registration_submit" />
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="action" value="custom_posts" />
|
||||
|
||||
</form>
|
||||
</div>
|
|
@ -38,6 +38,40 @@ $user_name = apply_filters('swpm_registration_form_set_username', $user_name);
|
|||
<td><label for="last_name"><?php echo SwpmUtils::_('Last Name') ?></label></td>
|
||||
<td><input type="text" id="last_name" value="<?php echo esc_attr($last_name); ?>" size="50" name="last_name" /></td>
|
||||
</tr>
|
||||
<!-- custom fields for anagraphic datas-->
|
||||
<tr class="swpm-registration-phone-row" <?php apply_filters('swpm_registration_form_phone_tr_attributes', ''); ?>>
|
||||
<td><label for="phone"><?php echo SwpmUtils::_('Phone') ?></label></td>
|
||||
<td><input type="text" id="phone" value="<?php echo esc_attr($phone); ?>" size="50" name="phone" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-address-street-row">
|
||||
<th><label for="address_street"><?php echo SwpmUtils::_('Street') ?> di residenza</label></th>
|
||||
<td><input class="regular-text" name="address_street" type="text" id="address_street" value="<?php echo esc_attr($address_street); ?>" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-address-city-row">
|
||||
<th><label for="address_city"><?php echo SwpmUtils::_('City') ?> di residenza </label></th>
|
||||
<td><input class="regular-text" name="address_city" type="text" id="address_city" value="<?php echo esc_attr($address_city); ?>" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-address-state-row">
|
||||
<th><label for="address_state"><?php echo SwpmUtils::_('State') ?> di residenza</label></th>
|
||||
<td><input class="regular-text" name="address_state" type="text" id="address_state" value="<?php echo esc_attr($address_state); ?>" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-address-zipcode-row">
|
||||
<th><label for="address_zipcode"><?php echo SwpmUtils::_('Zipcode') ?> di residenza</label></th>
|
||||
<td><input class="regular-text" name="address_zipcode" type="text" id="address_zipcode" value="<?php echo esc_attr($address_zipcode); ?>" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-address-country-row">
|
||||
<th><label for="country"><?php echo SwpmUtils::_('Country') ?> di residenza</label></th>
|
||||
<td><select class="regular-text" id="country" name="country"><?php echo SwpmMiscUtils::get_countries_dropdown($country) ?></select></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-birthplace-row" <?php apply_filters('swpm_registration_form_birthplace_tr_attributes', ''); ?>>
|
||||
<td><label for="birth_place"><?php echo SwpmUtils::_('Luogo di Nascita') ?></label></td>
|
||||
<td><input type="text" id="birth_place" value="<?php echo esc_attr($birth_place); ?>" size="50" name="birth_place" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-registration-birthdate-row" <?php apply_filters('swpm_registration_form_birthdate_tr_attributes', ''); ?>>
|
||||
<th scope="row"><label for="birth_date"><?php echo SwpmUtils::_('Data di nascita') ?> </label></th>
|
||||
<td><input name="birth_date" type="date" id="birth_date" value="<?php echo esc_attr($birth_date); ?>" /></td>
|
||||
</tr>
|
||||
|
||||
<tr class="swpm-registration-membership-level-row" <?php apply_filters('swpm_registration_form_membership_level_tr_attributes', ''); ?>>
|
||||
<td><label for="membership_level"><?php echo SwpmUtils::_('Membership Level') ?></label></td>
|
||||
<td>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<tr class="swpm-admin-edit-access-starts">
|
||||
<th scope="row"><label for="subscription_starts"><?php echo SwpmUtils::_('Access Starts') ?> </label></th>
|
||||
<td><input class="regular-text" name="subscription_starts" type="text" id="subscription_starts" value="<?php echo esc_attr($subscription_starts); ?>" /></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr class="swpm-admin-edit-first-name">
|
||||
<th scope="row"><label for="first_name"><?php echo SwpmUtils::_('First Name') ?> </label></th>
|
||||
<td><input class="regular-text" name="first_name" type="text" id="first_name" value="<?php echo esc_attr($first_name); ?>" /></td>
|
||||
|
@ -53,7 +53,15 @@
|
|||
<tr class="swpm-admin-edit-company">
|
||||
<th scope="row"><label for="company_name"><?php echo SwpmUtils::_('Company') ?></label></th>
|
||||
<td><input name="company_name" type="text" id="company_name" class="regular-text" value="<?php echo esc_attr($company_name); ?>" /></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr class="swpm-admin-edit-birth-place">
|
||||
<th scope="row"><label for="birth_place"><?php echo SwpmUtils::_('Birth Place') ?> </label></th>
|
||||
<td><input class="regular-text" name="birth_place" type="text" id="birth_place" value="<?php echo esc_attr($birth_place); ?>" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-admin-edit-birth-date">
|
||||
<th scope="row"><label for="birth_date"><?php echo SwpmUtils::_('Birth Date') ?> </label></th>
|
||||
<td><input name="birth_date" type="date" id="birth_date" value="<?php echo esc_attr($birth_date); ?>" /></td>
|
||||
</tr>
|
||||
<tr class="swpm-admin-edit-member-since">
|
||||
<th scope="row"><label for="member_since"><?php echo SwpmUtils::_('Member Since') ?> </label></th>
|
||||
<td><input class="regular-text" name="member_since" type="text" id="member_since" value="<?php echo esc_attr($member_since); ?>" /></td>
|
||||
|
|
Loading…
Reference in a new issue