| @@ -10,18 +10,18 @@ | ||
| 10 | 10 | class UsersWP_Activator { |
| 11 | 11 | |
| 12 | 12 | /** @var array DB updates and callbacks that need to be run per version */ |
| 13 | 13 | private static $db_updates = array( |
| 14 | - '1.2.0.0' => array( | |
| 14 | + '1.2.0.0' => array( | |
| 15 | 15 | 'uwp_upgrade_1200', |
| 16 | 16 | ), |
| 17 | 17 | '1.2.0.13' => array( |
| 18 | 18 | 'uwp_upgrade_12013', |
| 19 | 19 | ), |
| 20 | - '1.2.2.5' => array( | |
| 20 | + '1.2.2.5' => array( | |
| 21 | 21 | 'uwp_upgrade_1225', |
| 22 | 22 | ), |
| 23 | - '1.2.3' => array( | |
| 23 | + '1.2.3' => array( | |
| 24 | 24 | 'uwp_upgrade_1230', |
| 25 | 25 | ), |
| 26 | 26 | ); |
| 27 | 27 | |
| @@ -39,20 +39,20 @@ | ||
| 39 | 39 | * @since 1.0.0 |
| 40 | 40 | * @package userswp |
| 41 | 41 | * @return void |
| 42 | 42 | */ |
| 43 | - public static function activate( $network_wide = false ) { | |
| 43 | + public static function activate($network_wide = false) { | |
| 44 | 44 | |
| 45 | - if ( is_multisite() ) { | |
| 45 | + if (is_multisite()) { | |
| 46 | 46 | $main_site = get_network()->site_id; |
| 47 | - if ( $network_wide ) { | |
| 47 | + if($network_wide){ | |
| 48 | 48 | |
| 49 | - update_network_option( '', 'uwp_is_network_active', 1 ); | |
| 49 | + update_network_option('', 'uwp_is_network_active', 1); | |
| 50 | 50 | switch_to_blog( $main_site ); |
| 51 | 51 | restore_current_blog(); |
| 52 | - | |
| 53 | - if ( defined( 'UWP_ROOT_PAGES' ) ) { | |
| 54 | - if ( UWP_ROOT_PAGES == 'all' ) { | |
| 52 | + | |
| 53 | + if (defined('UWP_ROOT_PAGES')) { | |
| 54 | + if (UWP_ROOT_PAGES == 'all') { | |
| 55 | 55 | $blog_ids = self::get_blog_ids(); |
| 56 | 56 | |
| 57 | 57 | foreach ( $blog_ids as $blog_id ) { |
| 58 | 58 | switch_to_blog( $blog_id ); |
| @@ -69,17 +69,19 @@ | ||
| 69 | 69 | switch_to_blog( $main_site ); |
| 70 | 70 | self::install(); |
| 71 | 71 | restore_current_blog(); |
| 72 | 72 | } |
| 73 | -} else { | |
| 73 | + | |
| 74 | + } else { | |
| 74 | 75 | self::install(); |
| 75 | 76 | } |
| 76 | 77 | } else { |
| 77 | 78 | self::install(); |
| 78 | 79 | } |
| 80 | + | |
| 79 | 81 | } |
| 80 | 82 | |
| 81 | - public static function install() { | |
| 83 | + public static function install(){ | |
| 82 | 84 | |
| 83 | 85 | uwp_generate_default_pages(); |
| 84 | 86 | self::add_default_options(); |
| 85 | 87 | uwp_create_tables(); |
| @@ -84,32 +86,32 @@ | ||
| 84 | 86 | self::add_default_options(); |
| 85 | 87 | uwp_create_tables(); |
| 86 | 88 | |
| 87 | 89 | // run update functions if needed |
| 88 | - if ( self::needs_db_update() ) { | |
| 90 | + if(self::needs_db_update()){ | |
| 89 | 91 | self::update(); |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | - if ( ! get_option( 'uwp_default_data_installed' ) ) { | |
| 94 | + if (!get_option('uwp_default_data_installed')) { | |
| 93 | 95 | // new install |
| 94 | 96 | self::create_default_fields(); |
| 95 | 97 | self::insert_form_extras(); |
| 96 | - update_option( 'uwp_default_data_installed', 1 ); | |
| 97 | - update_option( 'uwp_activation_redirect', 1 ); | |
| 98 | - } else { | |
| 98 | + update_option('uwp_default_data_installed', 1); | |
| 99 | + update_option('uwp_activation_redirect', 1); | |
| 100 | + }else{ | |
| 99 | 101 | // upgrade |
| 100 | 102 | // if updating from < 1.2.0 then add the try bootstrap notice |
| 101 | - if ( version_compare( get_option( 'uwp_db_version', null ), '1.2.0', '<' ) ) { | |
| 102 | - update_option( 'uwp_notice_try_bootstrap', true ); | |
| 103 | - uwp_update_option( 'design_style', '' ); | |
| 103 | + if(version_compare(get_option( 'uwp_db_version', null ),"1.2.0","<")){ | |
| 104 | + update_option("uwp_notice_try_bootstrap",true); | |
| 105 | + uwp_update_option('design_style',''); | |
| 104 | 106 | } |
| 105 | 107 | } |
| 106 | 108 | |
| 107 | 109 | self::flush_rewrite_rules(); |
| 108 | - update_option( 'uwp_flush_rewrite', 1 ); | |
| 110 | + update_option('uwp_flush_rewrite', 1); | |
| 109 | 111 | |
| 110 | 112 | // update the version |
| 111 | - update_option( 'uwp_db_version', USERSWP_VERSION ); | |
| 113 | + update_option('uwp_db_version', USERSWP_VERSION); | |
| 112 | 114 | |
| 113 | 115 | $installed = get_option( 'uwp_installed_on' ); |
| 114 | 116 | |
| 115 | 117 | if ( empty( $installed ) ) { |
| @@ -114,8 +116,9 @@ | ||
| 114 | 116 | |
| 115 | 117 | if ( empty( $installed ) ) { |
| 116 | 118 | update_option( 'uwp_installed_on', time() ); |
| 117 | 119 | } |
| 120 | + | |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | /** |
| 121 | 124 | * Get all IDs of blogs that are not activated, not spam, and not deleted |
| @@ -142,89 +145,90 @@ | ||
| 142 | 145 | * @return void |
| 143 | 146 | */ |
| 144 | 147 | public static function add_default_options() { |
| 145 | 148 | |
| 146 | - $settings = get_option( 'uwp_settings', array() ); | |
| 149 | + $settings = get_option( 'uwp_settings', array()); | |
| 147 | 150 | |
| 148 | 151 | $options = array( |
| 149 | - 'register_modal' => 1, | |
| 150 | - 'uwp_registration_action' => 'auto_approve', | |
| 151 | - 'wp_register_redirect' => 1, | |
| 152 | - 'login_modal' => 1, | |
| 153 | - 'login_redirect_to' => -1, | |
| 154 | - 'block_wp_login' => 0, | |
| 155 | - 'disable_wp_2fa' => 0, | |
| 156 | - 'forgot_modal' => 1, | |
| 157 | - 'change_enable_old_password' => 1, | |
| 158 | - 'change_disable_password_nag' => 0, | |
| 159 | - 'enable_profile_header' => 1, | |
| 160 | - 'enable_profile_body' => 1, | |
| 161 | - 'profile_avatar_size' => '', | |
| 162 | - 'profile_banner_size' => '', | |
| 163 | - 'profile_banner_width' => 1000, | |
| 164 | - 'profile_no_of_items' => 10, | |
| 165 | - 'users_no_of_items' => 10, | |
| 166 | - 'uwp_disable_author_link' => 0, | |
| 167 | - 'users_default_layout' => '3col', | |
| 168 | - 'author_box_enable_disable' => 1, | |
| 169 | - 'author_box_display_content' => 'below_content', | |
| 170 | - 'author_box_display_post_types' => array( 'post' ), | |
| 171 | - 'author_box_content' => '', | |
| 172 | - 'author_box_bio_limit' => 200, | |
| 173 | - 'registration_success_email_admin' => 1, | |
| 174 | - 'registration_success_email_subject_admin' => UsersWP_Defaults::registration_success_email_subject_admin(), | |
| 175 | - 'registration_success_email_content_admin' => UsersWP_Defaults::registration_success_email_content_admin(), | |
| 176 | - 'registration_activate_email' => 1, | |
| 177 | - 'registration_activate_email_subject' => UsersWP_Defaults::registration_activate_email_subject(), | |
| 178 | - 'registration_activate_email_content' => UsersWP_Defaults::registration_activate_email_content(), | |
| 179 | - 'registration_success_email' => 1, | |
| 180 | - 'registration_success_email_subject' => UsersWP_Defaults::registration_success_email_subject(), | |
| 181 | - 'registration_success_email_content' => UsersWP_Defaults::registration_success_email_content(), | |
| 182 | - 'forgot_password_email' => 1, | |
| 183 | - 'forgot_password_email_subject' => UsersWP_Defaults::forgot_password_email_subject(), | |
| 184 | - 'forgot_password_email_content' => UsersWP_Defaults::forgot_password_email_content(), | |
| 185 | - 'change_password_email' => 1, | |
| 186 | - 'change_password_email_subject' => UsersWP_Defaults::change_password_email_subject(), | |
| 187 | - 'change_password_email_content' => UsersWP_Defaults::change_password_email_content(), | |
| 188 | - 'reset_password_email' => 1, | |
| 189 | - 'reset_password_email_subject' => UsersWP_Defaults::reset_password_email_subject(), | |
| 190 | - 'reset_password_email_content' => UsersWP_Defaults::reset_password_email_content(), | |
| 191 | - 'account_update_email' => 1, | |
| 192 | - 'account_update_email_subject' => UsersWP_Defaults::account_update_email_subject(), | |
| 193 | - 'account_update_email_content' => UsersWP_Defaults::account_update_email_content(), | |
| 194 | - 'account_delete_email' => 1, | |
| 195 | - 'account_delete_email_subject' => UsersWP_Defaults::account_delete_email_subject(), | |
| 196 | - 'account_delete_email_content' => UsersWP_Defaults::account_delete_email_content(), | |
| 197 | - 'account_delete_email_admin' => 1, | |
| 198 | - 'account_delete_email_subject_admin' => UsersWP_Defaults::account_delete_email_subject_admin(), | |
| 199 | - 'account_delete_email_content_admin' => UsersWP_Defaults::account_delete_email_content_admin(), | |
| 200 | - 'wp_new_user_notification_email' => 1, | |
| 201 | - 'wp_new_user_notification_email_subject' => UsersWP_Defaults::wp_new_user_notification_email_subject(), | |
| 202 | - 'wp_new_user_notification_email_content' => UsersWP_Defaults::wp_new_user_notification_email_content(), | |
| 203 | - 'account_new_email_activation_email' => 1, | |
| 204 | - 'account_new_email_activation_email_subject' => UsersWP_Defaults::account_new_email_activation_email_subject(), | |
| 205 | - 'account_new_email_activation_email_content' => UsersWP_Defaults::account_new_email_activation_email_content(), | |
| 206 | - 'wp_new_user_notification_email_admin' => 1, | |
| 152 | + 'register_modal' => 1, | |
| 153 | + 'uwp_registration_action' => 'auto_approve', | |
| 154 | + 'wp_register_redirect' => 1, | |
| 155 | + 'login_modal' => 1, | |
| 156 | + 'login_redirect_to' => -1, | |
| 157 | + 'block_wp_login' => 0, | |
| 158 | + 'disable_wp_2fa' => 0, | |
| 159 | + 'forgot_modal' => 1, | |
| 160 | + 'change_enable_old_password' => 1, | |
| 161 | + 'change_disable_password_nag' => 0, | |
| 162 | + 'enable_profile_header' => 1, | |
| 163 | + 'enable_profile_body' => 1, | |
| 164 | + 'profile_avatar_size' => '', | |
| 165 | + 'profile_banner_size' => '', | |
| 166 | + 'profile_banner_width' => 1000, | |
| 167 | + 'profile_no_of_items' => 10, | |
| 168 | + 'users_no_of_items' => 10, | |
| 169 | + 'uwp_disable_author_link' => 0, | |
| 170 | + 'users_default_layout' => '3col', | |
| 171 | + 'author_box_enable_disable' => 1, | |
| 172 | + 'author_box_display_content' => 'below_content', | |
| 173 | + 'author_box_display_post_types' => array('post'), | |
| 174 | + 'author_box_content' => '', | |
| 175 | + 'author_box_bio_limit' => 200, | |
| 176 | + 'registration_success_email_admin' => 1, | |
| 177 | + 'registration_success_email_subject_admin' => UsersWP_Defaults::registration_success_email_subject_admin(), | |
| 178 | + 'registration_success_email_content_admin' => UsersWP_Defaults::registration_success_email_content_admin(), | |
| 179 | + 'registration_activate_email' => 1, | |
| 180 | + 'registration_activate_email_subject' => UsersWP_Defaults::registration_activate_email_subject(), | |
| 181 | + 'registration_activate_email_content' => UsersWP_Defaults::registration_activate_email_content(), | |
| 182 | + 'registration_success_email' => 1, | |
| 183 | + 'registration_success_email_subject' => UsersWP_Defaults::registration_success_email_subject(), | |
| 184 | + 'registration_success_email_content' => UsersWP_Defaults::registration_success_email_content(), | |
| 185 | + 'forgot_password_email' => 1, | |
| 186 | + 'forgot_password_email_subject' => UsersWP_Defaults::forgot_password_email_subject(), | |
| 187 | + 'forgot_password_email_content' => UsersWP_Defaults::forgot_password_email_content(), | |
| 188 | + 'change_password_email' => 1, | |
| 189 | + 'change_password_email_subject' => UsersWP_Defaults::change_password_email_subject(), | |
| 190 | + 'change_password_email_content' => UsersWP_Defaults::change_password_email_content(), | |
| 191 | + 'reset_password_email' => 1, | |
| 192 | + 'reset_password_email_subject' => UsersWP_Defaults::reset_password_email_subject(), | |
| 193 | + 'reset_password_email_content' => UsersWP_Defaults::reset_password_email_content(), | |
| 194 | + 'account_update_email' => 1, | |
| 195 | + 'account_update_email_subject' => UsersWP_Defaults::account_update_email_subject(), | |
| 196 | + 'account_update_email_content' => UsersWP_Defaults::account_update_email_content(), | |
| 197 | + 'account_delete_email' => 1, | |
| 198 | + 'account_delete_email_subject' => UsersWP_Defaults::account_delete_email_subject(), | |
| 199 | + 'account_delete_email_content' => UsersWP_Defaults::account_delete_email_content(), | |
| 200 | + 'account_delete_email_admin' => 1, | |
| 201 | + 'account_delete_email_subject_admin' => UsersWP_Defaults::account_delete_email_subject_admin(), | |
| 202 | + 'account_delete_email_content_admin' => UsersWP_Defaults::account_delete_email_content_admin(), | |
| 203 | + 'wp_new_user_notification_email' => 1, | |
| 204 | + 'wp_new_user_notification_email_subject' => UsersWP_Defaults::wp_new_user_notification_email_subject(), | |
| 205 | + 'wp_new_user_notification_email_content' => UsersWP_Defaults::wp_new_user_notification_email_content(), | |
| 206 | + 'account_new_email_activation_email' => 1, | |
| 207 | + 'account_new_email_activation_email_subject' => UsersWP_Defaults::account_new_email_activation_email_subject(), | |
| 208 | + 'account_new_email_activation_email_content' => UsersWP_Defaults::account_new_email_activation_email_content(), | |
| 209 | + 'wp_new_user_notification_email_admin' => 1, | |
| 207 | 210 | 'wp_new_user_notification_email_subject_admin' => UsersWP_Defaults::wp_new_user_notification_email_subject_admin(), |
| 208 | 211 | 'wp_new_user_notification_email_content_admin' => UsersWP_Defaults::wp_new_user_notification_email_content_admin(), |
| 209 | - 'user_post_counts_cpts' => array( 'post' ), | |
| 210 | - 'login_user_post_counts_cpts' => array( 'post' ), | |
| 211 | - 'multiple_registration_forms' => uwp_get_default_form_data(), | |
| 212 | - 'profile_seo_meta_description_length' => 150, | |
| 212 | + 'user_post_counts_cpts' => array('post'), | |
| 213 | + 'login_user_post_counts_cpts' => array('post'), | |
| 214 | + 'multiple_registration_forms' => uwp_get_default_form_data(), | |
| 215 | + 'profile_seo_meta_description_length' => 150, | |
| 213 | 216 | ); |
| 214 | 217 | |
| 215 | - foreach ( $options as $option => $value ) { | |
| 216 | - if ( ! isset( $settings[ $option ] ) ) { | |
| 217 | - $settings[ $option ] = $value; | |
| 218 | + foreach ($options as $option => $value){ | |
| 219 | + if (!isset($settings[$option])) { | |
| 220 | + $settings[$option] = $value; | |
| 218 | 221 | } |
| 219 | 222 | } |
| 220 | 223 | |
| 221 | 224 | update_option( 'uwp_settings', $settings ); |
| 225 | + | |
| 222 | 226 | } |
| 223 | 227 | |
| 224 | - public static function init_background_updater() { | |
| 225 | - if ( empty( self::$background_updater ) ) { | |
| 226 | - include_once __DIR__ . '/class-uwp-background-updater.php'; | |
| 228 | + public static function init_background_updater(){ | |
| 229 | + if(empty(self::$background_updater)){ | |
| 230 | + include_once dirname( __FILE__ ) . '/class-uwp-background-updater.php'; | |
| 227 | 231 | self::$background_updater = new UsersWP_Background_Updater(); |
| 228 | 232 | } |
| 229 | 233 | } |
| 230 | 234 | |
| @@ -234,15 +238,15 @@ | ||
| 234 | 238 | * @since 1.0.0 |
| 235 | 239 | * @package userswp |
| 236 | 240 | * @return void |
| 237 | 241 | */ |
| 238 | - public static function uwp_update_usermeta( $dispatch = false ) { | |
| 242 | + public static function uwp_update_usermeta($dispatch = false) { | |
| 239 | 243 | $update_callback = 'uwp_insert_usermeta'; |
| 240 | 244 | self::init_background_updater(); |
| 241 | 245 | |
| 242 | 246 | uwp_error_log( sprintf( 'Queuing %s - %s', USERSWP_VERSION, $update_callback ) ); |
| 243 | 247 | self::$background_updater->push_to_queue( $update_callback ); |
| 244 | - if ( $dispatch ) { | |
| 248 | + if($dispatch){ | |
| 245 | 249 | self::$background_updater->save()->dispatch(); |
| 246 | 250 | } |
| 247 | 251 | } |
| 248 | 252 | |
| @@ -265,9 +269,9 @@ | ||
| 265 | 269 | private static function needs_db_update() { |
| 266 | 270 | $current_db_version = get_option( 'uwp_db_version', null ); |
| 267 | 271 | $updates = self::get_db_update_callbacks(); |
| 268 | 272 | |
| 269 | - return ! is_null( $current_db_version ) && ! empty( $updates ) && version_compare( $current_db_version, max( array_keys( $updates ) ), '<' ); | |
| 273 | + return ! empty( $updates ) && version_compare( $current_db_version, max( array_keys( $updates ) ), '<' ); | |
| 270 | 274 | } |
| 271 | 275 | |
| 272 | 276 | /** |
| 273 | 277 | * Push all needed DB updates to the queue for processing. |
| @@ -287,13 +291,14 @@ | ||
| 287 | 291 | } |
| 288 | 292 | } |
| 289 | 293 | } |
| 290 | 294 | |
| 295 | + | |
| 291 | 296 | if ( $update_queued ) { |
| 292 | 297 | self::uwp_update_usermeta();// make sure to sync user meta |
| 293 | 298 | self::$background_updater->save()->dispatch(); |
| 294 | - } else { | |
| 295 | - self::uwp_update_usermeta( true );// make sure to sync user meta | |
| 299 | + }else{ | |
| 300 | + self::uwp_update_usermeta(true);// make sure to sync user meta | |
| 296 | 301 | } |
| 297 | 302 | } |
| 298 | 303 | |
| 299 | 304 | /** |
| @@ -302,17 +307,18 @@ | ||
| 302 | 307 | * @since 1.0.0 |
| 303 | 308 | * @package userswp |
| 304 | 309 | * @return void |
| 305 | 310 | */ |
| 306 | - public static function create_default_fields() { | |
| 311 | + public static function create_default_fields() | |
| 312 | + { | |
| 307 | 313 | $form_builder = new UsersWP_Form_Builder(); |
| 308 | 314 | |
| 309 | 315 | $fields = self::uwp_default_custom_fields(); |
| 310 | 316 | |
| 311 | - $fields = apply_filters( 'uwp_before_default_custom_fields_saved', $fields ); | |
| 317 | + $fields = apply_filters('uwp_before_default_custom_fields_saved', $fields); | |
| 312 | 318 | |
| 313 | - foreach ( $fields as $field_index => $field ) { | |
| 314 | - $form_builder->admin_form_field_save( $field ); | |
| 319 | + foreach ($fields as $field_index => $field) { | |
| 320 | + $form_builder->admin_form_field_save($field); | |
| 315 | 321 | } |
| 316 | 322 | } |
| 317 | 323 | |
| 318 | 324 | /** |
| @@ -321,9 +327,9 @@ | ||
| 321 | 327 | * @since 1.0.0 |
| 322 | 328 | * @package userswp |
| 323 | 329 | * @return array Merged custom fields. |
| 324 | 330 | */ |
| 325 | - public static function uwp_default_custom_fields() { | |
| 331 | + public static function uwp_default_custom_fields(){ | |
| 326 | 332 | |
| 327 | 333 | $login = self::uwp_default_custom_fields_login(); |
| 328 | 334 | $forgot = self::uwp_default_custom_fields_forgot(); |
| 329 | 335 | $avatar = self::uwp_default_custom_fields_avatar(); |
| @@ -331,13 +337,14 @@ | ||
| 331 | 337 | $change = self::uwp_default_custom_fields_change(); |
| 332 | 338 | $reset = self::uwp_default_custom_fields_reset(); |
| 333 | 339 | $account = self::uwp_default_custom_fields_account(); |
| 334 | 340 | |
| 335 | - $fields = array_merge( $login, $forgot, $account, $avatar, $banner, $change, $reset ); | |
| 341 | + $fields = array_merge($login, $forgot, $account, $avatar, $banner, $change, $reset); | |
| 336 | 342 | |
| 337 | - $fields = apply_filters( 'uwp_default_custom_fields', $fields ); | |
| 343 | + $fields = apply_filters('uwp_default_custom_fields', $fields); | |
| 338 | 344 | |
| 339 | 345 | return $fields; |
| 346 | + | |
| 340 | 347 | } |
| 341 | 348 | |
| 342 | 349 | /** |
| 343 | 350 | * Returns Login form default custom fields. |
| @@ -345,39 +352,39 @@ | ||
| 345 | 352 | * @since 1.0.0 |
| 346 | 353 | * @package userswp |
| 347 | 354 | * @return array Login form default custom fields. |
| 348 | 355 | */ |
| 349 | - public static function uwp_default_custom_fields_login() { | |
| 356 | + public static function uwp_default_custom_fields_login(){ | |
| 350 | 357 | |
| 351 | 358 | $fields = array(); |
| 352 | 359 | |
| 353 | 360 | $fields[] = array( |
| 354 | - 'form_type' => 'login', | |
| 355 | - 'field_type' => 'text', | |
| 356 | - 'data_type' => 'XVARCHAR', | |
| 357 | - 'site_title' => __( 'Username', 'userswp' ), | |
| 358 | - 'htmlvar_name' => 'username', | |
| 361 | + 'form_type' => 'login', | |
| 362 | + 'field_type' => 'text', | |
| 363 | + 'data_type' => 'XVARCHAR', | |
| 364 | + 'site_title' => __('Username', 'userswp'), | |
| 365 | + 'htmlvar_name' => 'username', | |
| 359 | 366 | 'default_value' => '', |
| 360 | 367 | 'option_values' => '', |
| 361 | - 'is_default' => '1', | |
| 362 | - 'is_active' => '1', | |
| 363 | - 'is_required' => '1', | |
| 368 | + 'is_default' => '1', | |
| 369 | + 'is_active' => '1', | |
| 370 | + 'is_required' => '1' | |
| 364 | 371 | ); |
| 365 | 372 | |
| 366 | 373 | $fields[] = array( |
| 367 | - 'form_type' => 'login', | |
| 368 | - 'field_type' => 'password', | |
| 369 | - 'data_type' => 'XVARCHAR', | |
| 370 | - 'site_title' => __( 'Password', 'userswp' ), | |
| 371 | - 'htmlvar_name' => 'password', | |
| 374 | + 'form_type' => 'login', | |
| 375 | + 'field_type' => 'password', | |
| 376 | + 'data_type' => 'XVARCHAR', | |
| 377 | + 'site_title' => __('Password', 'userswp'), | |
| 378 | + 'htmlvar_name' => 'password', | |
| 372 | 379 | 'default_value' => '', |
| 373 | 380 | 'option_values' => '', |
| 374 | - 'is_default' => '1', | |
| 375 | - 'is_active' => '1', | |
| 376 | - 'is_required' => '1', | |
| 381 | + 'is_default' => '1', | |
| 382 | + 'is_active' => '1', | |
| 383 | + 'is_required' => '1' | |
| 377 | 384 | ); |
| 378 | 385 | |
| 379 | - $fields = apply_filters( 'uwp_default_custom_fields_login', $fields ); | |
| 386 | + $fields = apply_filters('uwp_default_custom_fields_login', $fields); | |
| 380 | 387 | |
| 381 | 388 | return $fields; |
| 382 | 389 | } |
| 383 | 390 | |
| @@ -387,26 +394,26 @@ | ||
| 387 | 394 | * @since 1.0.0 |
| 388 | 395 | * @package userswp |
| 389 | 396 | * @return array Forgot form default custom fields. |
| 390 | 397 | */ |
| 391 | - public static function uwp_default_custom_fields_forgot() { | |
| 398 | + public static function uwp_default_custom_fields_forgot(){ | |
| 392 | 399 | |
| 393 | 400 | $fields = array(); |
| 394 | 401 | |
| 395 | 402 | $fields[] = array( |
| 396 | - 'form_type' => 'forgot', | |
| 397 | - 'field_type' => 'email', | |
| 398 | - 'data_type' => 'XVARCHAR', | |
| 399 | - 'site_title' => __( 'Email', 'userswp' ), | |
| 400 | - 'htmlvar_name' => 'email', | |
| 403 | + 'form_type' => 'forgot', | |
| 404 | + 'field_type' => 'email', | |
| 405 | + 'data_type' => 'XVARCHAR', | |
| 406 | + 'site_title' => __('Email', 'userswp'), | |
| 407 | + 'htmlvar_name' => 'email', | |
| 401 | 408 | 'default_value' => '', |
| 402 | 409 | 'option_values' => '', |
| 403 | - 'is_default' => '1', | |
| 404 | - 'is_active' => '1', | |
| 405 | - 'is_required' => '1', | |
| 410 | + 'is_default' => '1', | |
| 411 | + 'is_active' => '1', | |
| 412 | + 'is_required' => '1' | |
| 406 | 413 | ); |
| 407 | 414 | |
| 408 | - $fields = apply_filters( 'uwp_default_custom_fields_forgot', $fields ); | |
| 415 | + $fields = apply_filters('uwp_default_custom_fields_forgot', $fields); | |
| 409 | 416 | |
| 410 | 417 | return $fields; |
| 411 | 418 | } |
| 412 | 419 | |
| @@ -416,35 +423,35 @@ | ||
| 416 | 423 | * @since 1.0.0 |
| 417 | 424 | * @package userswp |
| 418 | 425 | * @return array Avatar form default custom fields. |
| 419 | 426 | */ |
| 420 | - public static function uwp_default_custom_fields_avatar() { | |
| 427 | + public static function uwp_default_custom_fields_avatar(){ | |
| 421 | 428 | |
| 422 | 429 | $fields = array(); |
| 423 | 430 | |
| 424 | 431 | $fields[] = array( |
| 425 | - 'form_type' => 'avatar', | |
| 426 | - 'field_type' => 'file', | |
| 427 | - 'data_type' => 'TEXT', | |
| 428 | - 'site_title' => __( 'Avatar', 'userswp' ), | |
| 429 | - 'htmlvar_name' => 'avatar', | |
| 432 | + 'form_type' => 'avatar', | |
| 433 | + 'field_type' => 'file', | |
| 434 | + 'data_type' => 'TEXT', | |
| 435 | + 'site_title' => __('Avatar', 'userswp'), | |
| 436 | + 'htmlvar_name' => 'avatar', | |
| 430 | 437 | 'default_value' => '', |
| 431 | 438 | 'option_values' => '', |
| 432 | - 'is_default' => '1', | |
| 433 | - 'is_active' => '1', | |
| 434 | - 'is_required' => '1', | |
| 435 | - 'extra_fields' => array( | |
| 436 | - 'uwp_file_types' => array( | |
| 439 | + 'is_default' => '1', | |
| 440 | + 'is_active' => '1', | |
| 441 | + 'is_required' => '1', | |
| 442 | + 'extra_fields' => array( | |
| 443 | + 'uwp_file_types' => array( | |
| 437 | 444 | 'jpg', |
| 438 | 445 | 'jpe', |
| 439 | 446 | 'jpeg', |
| 440 | 447 | 'gif', |
| 441 | - 'png', | |
| 448 | + 'png' | |
| 442 | 449 | ), |
| 443 | - ), | |
| 450 | + ) | |
| 444 | 451 | ); |
| 445 | 452 | |
| 446 | - $fields = apply_filters( 'uwp_default_custom_fields_avatar', $fields ); | |
| 453 | + $fields = apply_filters('uwp_default_custom_fields_avatar', $fields); | |
| 447 | 454 | |
| 448 | 455 | return $fields; |
| 449 | 456 | } |
| 450 | 457 | |
| @@ -454,35 +461,35 @@ | ||
| 454 | 461 | * @since 1.0.0 |
| 455 | 462 | * @package userswp |
| 456 | 463 | * @return array Banner form default custom fields. |
| 457 | 464 | */ |
| 458 | - public static function uwp_default_custom_fields_banner() { | |
| 465 | + public static function uwp_default_custom_fields_banner(){ | |
| 459 | 466 | |
| 460 | 467 | $fields = array(); |
| 461 | 468 | |
| 462 | 469 | $fields[] = array( |
| 463 | - 'form_type' => 'banner', | |
| 464 | - 'field_type' => 'file', | |
| 465 | - 'data_type' => 'TEXT', | |
| 466 | - 'site_title' => __( 'Banner', 'userswp' ), | |
| 467 | - 'htmlvar_name' => 'banner', | |
| 470 | + 'form_type' => 'banner', | |
| 471 | + 'field_type' => 'file', | |
| 472 | + 'data_type' => 'TEXT', | |
| 473 | + 'site_title' => __('Banner', 'userswp'), | |
| 474 | + 'htmlvar_name' => 'banner', | |
| 468 | 475 | 'default_value' => '', |
| 469 | 476 | 'option_values' => '', |
| 470 | - 'is_default' => '1', | |
| 471 | - 'is_active' => '1', | |
| 472 | - 'is_required' => '1', | |
| 473 | - 'extra_fields' => array( | |
| 474 | - 'uwp_file_types' => array( | |
| 477 | + 'is_default' => '1', | |
| 478 | + 'is_active' => '1', | |
| 479 | + 'is_required' => '1', | |
| 480 | + 'extra_fields' => array( | |
| 481 | + 'uwp_file_types' => array( | |
| 475 | 482 | 'jpg', |
| 476 | 483 | 'jpe', |
| 477 | 484 | 'jpeg', |
| 478 | 485 | 'gif', |
| 479 | - 'png', | |
| 486 | + 'png' | |
| 480 | 487 | ), |
| 481 | - ), | |
| 488 | + ) | |
| 482 | 489 | ); |
| 483 | 490 | |
| 484 | - $fields = apply_filters( 'uwp_default_custom_fields_banner', $fields ); | |
| 491 | + $fields = apply_filters('uwp_default_custom_fields_banner', $fields); | |
| 485 | 492 | |
| 486 | 493 | return $fields; |
| 487 | 494 | } |
| 488 | 495 | |
| @@ -492,52 +499,52 @@ | ||
| 492 | 499 | * @since 1.0.0 |
| 493 | 500 | * @package userswp |
| 494 | 501 | * @return array Change Password form default custom fields. |
| 495 | 502 | */ |
| 496 | - public static function uwp_default_custom_fields_change() { | |
| 503 | + public static function uwp_default_custom_fields_change(){ | |
| 497 | 504 | |
| 498 | 505 | $fields = array(); |
| 499 | 506 | |
| 500 | 507 | $fields[] = array( |
| 501 | - 'form_type' => 'change', | |
| 502 | - 'field_type' => 'password', | |
| 503 | - 'data_type' => 'XVARCHAR', | |
| 504 | - 'site_title' => __( 'Old Password', 'userswp' ), | |
| 505 | - 'htmlvar_name' => 'old_password', | |
| 508 | + 'form_type' => 'change', | |
| 509 | + 'field_type' => 'password', | |
| 510 | + 'data_type' => 'XVARCHAR', | |
| 511 | + 'site_title' => __('Old Password', 'userswp'), | |
| 512 | + 'htmlvar_name' => 'old_password', | |
| 506 | 513 | 'default_value' => '', |
| 507 | 514 | 'option_values' => '', |
| 508 | - 'is_default' => '1', | |
| 509 | - 'is_active' => '1', | |
| 510 | - 'is_required' => '1', | |
| 515 | + 'is_default' => '1', | |
| 516 | + 'is_active' => '1', | |
| 517 | + 'is_required' => '1' | |
| 511 | 518 | ); |
| 512 | 519 | |
| 513 | 520 | $fields[] = array( |
| 514 | - 'form_type' => 'change', | |
| 515 | - 'field_type' => 'password', | |
| 516 | - 'data_type' => 'XVARCHAR', | |
| 517 | - 'site_title' => __( 'New Password', 'userswp' ), | |
| 518 | - 'htmlvar_name' => 'password', | |
| 521 | + 'form_type' => 'change', | |
| 522 | + 'field_type' => 'password', | |
| 523 | + 'data_type' => 'XVARCHAR', | |
| 524 | + 'site_title' => __('New Password', 'userswp'), | |
| 525 | + 'htmlvar_name' => 'password', | |
| 519 | 526 | 'default_value' => '', |
| 520 | 527 | 'option_values' => '', |
| 521 | - 'is_default' => '1', | |
| 522 | - 'is_active' => '1', | |
| 523 | - 'is_required' => '1', | |
| 528 | + 'is_default' => '1', | |
| 529 | + 'is_active' => '1', | |
| 530 | + 'is_required' => '1' | |
| 524 | 531 | ); |
| 525 | 532 | |
| 526 | 533 | $fields[] = array( |
| 527 | - 'form_type' => 'change', | |
| 528 | - 'field_type' => 'password', | |
| 529 | - 'data_type' => 'XVARCHAR', | |
| 530 | - 'site_title' => __( 'Confirm Password', 'userswp' ), | |
| 531 | - 'htmlvar_name' => 'confirm_password', | |
| 534 | + 'form_type' => 'change', | |
| 535 | + 'field_type' => 'password', | |
| 536 | + 'data_type' => 'XVARCHAR', | |
| 537 | + 'site_title' => __('Confirm Password', 'userswp'), | |
| 538 | + 'htmlvar_name' => 'confirm_password', | |
| 532 | 539 | 'default_value' => '', |
| 533 | 540 | 'option_values' => '', |
| 534 | - 'is_default' => '1', | |
| 535 | - 'is_active' => '1', | |
| 536 | - 'is_required' => '1', | |
| 541 | + 'is_default' => '1', | |
| 542 | + 'is_active' => '1', | |
| 543 | + 'is_required' => '1' | |
| 537 | 544 | ); |
| 538 | 545 | |
| 539 | - $fields = apply_filters( 'uwp_default_custom_fields_change', $fields ); | |
| 546 | + $fields = apply_filters('uwp_default_custom_fields_change', $fields); | |
| 540 | 547 | |
| 541 | 548 | return $fields; |
| 542 | 549 | } |
| 543 | 550 | |
| @@ -547,39 +554,39 @@ | ||
| 547 | 554 | * @since 1.0.0 |
| 548 | 555 | * @package userswp |
| 549 | 556 | * @return array Reset Password form default custom fields. |
| 550 | 557 | */ |
| 551 | - public static function uwp_default_custom_fields_reset() { | |
| 558 | + public static function uwp_default_custom_fields_reset(){ | |
| 552 | 559 | |
| 553 | 560 | $fields = array(); |
| 554 | 561 | |
| 555 | 562 | $fields[] = array( |
| 556 | - 'form_type' => 'reset', | |
| 557 | - 'field_type' => 'password', | |
| 558 | - 'data_type' => 'XVARCHAR', | |
| 559 | - 'site_title' => __( 'Password', 'userswp' ), | |
| 560 | - 'htmlvar_name' => 'password', | |
| 563 | + 'form_type' => 'reset', | |
| 564 | + 'field_type' => 'password', | |
| 565 | + 'data_type' => 'XVARCHAR', | |
| 566 | + 'site_title' => __('Password', 'userswp'), | |
| 567 | + 'htmlvar_name' => 'password', | |
| 561 | 568 | 'default_value' => '', |
| 562 | 569 | 'option_values' => '', |
| 563 | - 'is_default' => '1', | |
| 564 | - 'is_active' => '1', | |
| 565 | - 'is_required' => '1', | |
| 570 | + 'is_default' => '1', | |
| 571 | + 'is_active' => '1', | |
| 572 | + 'is_required' => '1' | |
| 566 | 573 | ); |
| 567 | 574 | |
| 568 | 575 | $fields[] = array( |
| 569 | - 'form_type' => 'reset', | |
| 570 | - 'field_type' => 'password', | |
| 571 | - 'data_type' => 'XVARCHAR', | |
| 572 | - 'site_title' => __( 'Confirm Password', 'userswp' ), | |
| 573 | - 'htmlvar_name' => 'confirm_password', | |
| 576 | + 'form_type' => 'reset', | |
| 577 | + 'field_type' => 'password', | |
| 578 | + 'data_type' => 'XVARCHAR', | |
| 579 | + 'site_title' => __('Confirm Password', 'userswp'), | |
| 580 | + 'htmlvar_name' => 'confirm_password', | |
| 574 | 581 | 'default_value' => '', |
| 575 | 582 | 'option_values' => '', |
| 576 | - 'is_default' => '1', | |
| 577 | - 'is_active' => '1', | |
| 578 | - 'is_required' => '1', | |
| 583 | + 'is_default' => '1', | |
| 584 | + 'is_active' => '1', | |
| 585 | + 'is_required' => '1' | |
| 579 | 586 | ); |
| 580 | 587 | |
| 581 | - $fields = apply_filters( 'uwp_default_custom_fields_reset', $fields ); | |
| 588 | + $fields = apply_filters('uwp_default_custom_fields_reset', $fields); | |
| 582 | 589 | |
| 583 | 590 | return $fields; |
| 584 | 591 | } |
| 585 | 592 | |
| @@ -589,128 +596,130 @@ | ||
| 589 | 596 | * @since 1.0.0 |
| 590 | 597 | * @package userswp |
| 591 | 598 | * @return array Account form default custom fields. |
| 592 | 599 | */ |
| 593 | - public static function uwp_default_custom_fields_account() { | |
| 600 | + public static function uwp_default_custom_fields_account(){ | |
| 594 | 601 | |
| 595 | 602 | $fields = array(); |
| 596 | 603 | |
| 597 | 604 | $fields[] = array( |
| 598 | - 'form_type' => 'account', | |
| 599 | - 'field_type' => 'text', | |
| 600 | - 'data_type' => 'XVARCHAR', | |
| 601 | - 'site_title' => __( 'First Name', 'userswp' ), | |
| 602 | - 'htmlvar_name' => 'first_name', | |
| 603 | - 'default_value' => '', | |
| 604 | - 'option_values' => '', | |
| 605 | - 'is_default' => '1', | |
| 606 | - 'is_public' => '1', | |
| 607 | - 'is_active' => '1', | |
| 608 | - 'is_required' => '1', | |
| 605 | + 'form_type' => 'account', | |
| 606 | + 'field_type' => 'text', | |
| 607 | + 'data_type' => 'XVARCHAR', | |
| 608 | + 'site_title' => __('First Name', 'userswp'), | |
| 609 | + 'htmlvar_name' => 'first_name', | |
| 610 | + 'default_value' => '', | |
| 611 | + 'option_values' => '', | |
| 612 | + 'is_default' => '1', | |
| 613 | + 'is_public' => '1', | |
| 614 | + 'is_active' => '1', | |
| 615 | + 'is_required' => '1', | |
| 609 | 616 | 'is_register_field' => '1', |
| 610 | - 'is_search_field' => '1', | |
| 617 | + 'is_search_field' => '1', | |
| 611 | 618 | ); |
| 612 | 619 | |
| 613 | 620 | $fields[] = array( |
| 614 | - 'form_type' => 'account', | |
| 615 | - 'field_type' => 'text', | |
| 616 | - 'data_type' => 'XVARCHAR', | |
| 617 | - 'site_title' => __( 'Last Name', 'userswp' ), | |
| 618 | - 'htmlvar_name' => 'last_name', | |
| 619 | - 'default_value' => '', | |
| 620 | - 'option_values' => '', | |
| 621 | - 'is_default' => '1', | |
| 622 | - 'is_public' => '1', | |
| 623 | - 'is_active' => '1', | |
| 624 | - 'is_required' => '1', | |
| 621 | + 'form_type' => 'account', | |
| 622 | + 'field_type' => 'text', | |
| 623 | + 'data_type' => 'XVARCHAR', | |
| 624 | + 'site_title' => __('Last Name', 'userswp'), | |
| 625 | + 'htmlvar_name' => 'last_name', | |
| 626 | + 'default_value' => '', | |
| 627 | + 'option_values' => '', | |
| 628 | + 'is_default' => '1', | |
| 629 | + 'is_public' => '1', | |
| 630 | + 'is_active' => '1', | |
| 631 | + 'is_required' => '1', | |
| 625 | 632 | 'is_register_field' => '1', |
| 626 | - 'is_search_field' => '1', | |
| 633 | + 'is_search_field' => '1', | |
| 627 | 634 | ); |
| 628 | 635 | |
| 629 | 636 | $fields[] = array( |
| 630 | - 'form_type' => 'account', | |
| 631 | - 'field_type' => 'text', | |
| 632 | - 'data_type' => 'XVARCHAR', | |
| 633 | - 'site_title' => __( 'Username', 'userswp' ), | |
| 634 | - 'htmlvar_name' => 'username', | |
| 635 | - 'default_value' => '', | |
| 636 | - 'option_values' => '', | |
| 637 | - 'is_default' => '1', | |
| 638 | - 'is_public' => '1', | |
| 639 | - 'is_active' => '1', | |
| 640 | - 'is_required' => '1', | |
| 641 | - 'is_register_field' => '1', | |
| 642 | - 'is_search_field' => '1', | |
| 637 | + 'form_type' => 'account', | |
| 638 | + 'field_type' => 'text', | |
| 639 | + 'data_type' => 'XVARCHAR', | |
| 640 | + 'site_title' => __('Username', 'userswp'), | |
| 641 | + 'htmlvar_name' => 'username', | |
| 642 | + 'default_value' => '', | |
| 643 | + 'option_values' => '', | |
| 644 | + 'is_default' => '1', | |
| 645 | + 'is_public' => '1', | |
| 646 | + 'is_active' => '1', | |
| 647 | + 'is_required' => '1', | |
| 648 | + 'is_register_field' => '1', | |
| 649 | + 'is_search_field' => '1', | |
| 643 | 650 | 'is_register_only_field' => '1', |
| 644 | 651 | ); |
| 645 | 652 | |
| 646 | 653 | $fields[] = array( |
| 647 | - 'form_type' => 'account', | |
| 648 | - 'field_type' => 'text', | |
| 649 | - 'data_type' => 'XVARCHAR', | |
| 650 | - 'site_title' => __( 'Display Name', 'userswp' ), | |
| 651 | - 'htmlvar_name' => 'display_name', | |
| 652 | - 'default_value' => '', | |
| 653 | - 'option_values' => '', | |
| 654 | - 'is_default' => '1', | |
| 655 | - 'is_public' => '1', | |
| 656 | - 'is_active' => '1', | |
| 657 | - 'is_required' => '0', | |
| 654 | + 'form_type' => 'account', | |
| 655 | + 'field_type' => 'text', | |
| 656 | + 'data_type' => 'XVARCHAR', | |
| 657 | + 'site_title' => __('Display Name', 'userswp'), | |
| 658 | + 'htmlvar_name' => 'display_name', | |
| 659 | + 'default_value' => '', | |
| 660 | + 'option_values' => '', | |
| 661 | + 'is_default' => '1', | |
| 662 | + 'is_public' => '1', | |
| 663 | + 'is_active' => '1', | |
| 664 | + 'is_required' => '0', | |
| 658 | 665 | 'is_register_field' => '0', |
| 659 | - 'is_search_field' => '1', | |
| 666 | + 'is_search_field' => '1', | |
| 660 | 667 | ); |
| 661 | 668 | |
| 662 | 669 | $fields[] = array( |
| 663 | - 'form_type' => 'account', | |
| 664 | - 'field_type' => 'email', | |
| 665 | - 'data_type' => 'XVARCHAR', | |
| 666 | - 'site_title' => __( 'Email', 'userswp' ), | |
| 667 | - 'htmlvar_name' => 'email', | |
| 668 | - 'default_value' => '', | |
| 669 | - 'option_values' => '', | |
| 670 | - 'is_default' => '1', | |
| 671 | - 'is_active' => '1', | |
| 672 | - 'is_required' => '1', | |
| 670 | + 'form_type' => 'account', | |
| 671 | + 'field_type' => 'email', | |
| 672 | + 'data_type' => 'XVARCHAR', | |
| 673 | + 'site_title' => __('Email', 'userswp'), | |
| 674 | + 'htmlvar_name' => 'email', | |
| 675 | + 'default_value' => '', | |
| 676 | + 'option_values' => '', | |
| 677 | + 'is_default' => '1', | |
| 678 | + 'is_active' => '1', | |
| 679 | + 'is_required' => '1', | |
| 673 | 680 | 'is_register_field' => '1', |
| 674 | - 'is_search_field' => '1', | |
| 681 | + 'is_search_field' => '1', | |
| 675 | 682 | ); |
| 676 | 683 | |
| 684 | + | |
| 677 | 685 | $fields[] = array( |
| 678 | - 'form_type' => 'account', | |
| 679 | - 'field_type' => 'textarea', | |
| 680 | - 'data_type' => 'TEXT', | |
| 681 | - 'site_title' => __( 'Bio', 'userswp' ), | |
| 682 | - 'htmlvar_name' => 'bio', | |
| 683 | - 'default_value' => '', | |
| 684 | - 'option_values' => '', | |
| 685 | - 'is_default' => '0', | |
| 686 | - 'is_active' => '1', | |
| 687 | - 'is_public' => '1', | |
| 688 | - 'is_required' => '1', | |
| 686 | + 'form_type' => 'account', | |
| 687 | + 'field_type' => 'textarea', | |
| 688 | + 'data_type' => 'TEXT', | |
| 689 | + 'site_title' => __('Bio', 'userswp'), | |
| 690 | + 'htmlvar_name' => 'bio', | |
| 691 | + 'default_value' => '', | |
| 692 | + 'option_values' => '', | |
| 693 | + 'is_default' => '0', | |
| 694 | + 'is_active' => '1', | |
| 695 | + 'is_public' => '1', | |
| 696 | + 'is_required' => '1', | |
| 689 | 697 | 'is_search_field' => '1', |
| 690 | - 'show_in' => array( '[users]' ), | |
| 698 | + 'show_in' => array('[users]') | |
| 691 | 699 | ); |
| 692 | 700 | |
| 693 | 701 | $fields[] = array( |
| 694 | - 'form_type' => 'account', | |
| 695 | - 'field_type' => 'password', | |
| 696 | - 'data_type' => 'XVARCHAR', | |
| 697 | - 'site_title' => __( 'Password', 'userswp' ), | |
| 698 | - 'htmlvar_name' => 'password', | |
| 699 | - 'default_value' => '', | |
| 700 | - 'option_values' => '', | |
| 701 | - 'is_default' => '1', | |
| 702 | - 'is_active' => '1', | |
| 703 | - 'is_required' => '1', | |
| 704 | - 'is_register_field' => '1', | |
| 702 | + 'form_type' => 'account', | |
| 703 | + 'field_type' => 'password', | |
| 704 | + 'data_type' => 'XVARCHAR', | |
| 705 | + 'site_title' => __('Password', 'userswp'), | |
| 706 | + 'htmlvar_name' => 'password', | |
| 707 | + 'default_value' => '', | |
| 708 | + 'option_values' => '', | |
| 709 | + 'is_default' => '1', | |
| 710 | + 'is_active' => '1', | |
| 711 | + 'is_required' => '1', | |
| 712 | + 'is_register_field' => '1', | |
| 705 | 713 | 'is_register_only_field' => '1', |
| 706 | - 'extra' => array( | |
| 707 | - 'confirm_password' => '1', | |
| 708 | - ), | |
| 714 | + 'extra' => array( | |
| 715 | + 'confirm_password' => '1' | |
| 716 | + ) | |
| 709 | 717 | ); |
| 710 | 718 | |
| 711 | - $fields = apply_filters( 'uwp_default_custom_fields_account', $fields ); | |
| 712 | 719 | |
| 720 | + $fields = apply_filters('uwp_default_custom_fields_account', $fields); | |
| 721 | + | |
| 713 | 722 | return $fields; |
| 714 | 723 | } |
| 715 | 724 | |
| 716 | 725 | /** |
| @@ -730,9 +739,9 @@ | ||
| 730 | 739 | * @since 1.0.0 |
| 731 | 740 | * @package userswp |
| 732 | 741 | * @return void |
| 733 | 742 | */ |
| 734 | - public static function insert_form_extras( $form_id = 1 ) { | |
| 743 | + public static function insert_form_extras($form_id = 1) { | |
| 735 | 744 | global $wpdb; |
| 736 | 745 | $extras_table_name = uwp_get_table_prefix() . 'uwp_form_extras'; |
| 737 | 746 | |
| 738 | 747 | $fields = array(); |
| @@ -737,54 +746,56 @@ | ||
| 737 | 746 | |
| 738 | 747 | $fields = array(); |
| 739 | 748 | |
| 740 | 749 | $fields[] = array( |
| 741 | - 'form_type' => 'register', | |
| 742 | - 'field_type' => 'text', | |
| 743 | - 'is_default' => '0', | |
| 744 | - 'htmlvar_name' => 'first_name', | |
| 750 | + 'form_type' => 'register', | |
| 751 | + 'field_type' => 'text', | |
| 752 | + 'is_default' => '0', | |
| 753 | + 'htmlvar_name' => 'first_name' | |
| 745 | 754 | ); |
| 746 | 755 | |
| 747 | 756 | $fields[] = array( |
| 748 | - 'form_type' => 'register', | |
| 749 | - 'field_type' => 'text', | |
| 750 | - 'is_default' => '0', | |
| 751 | - 'htmlvar_name' => 'last_name', | |
| 757 | + 'form_type' => 'register', | |
| 758 | + 'field_type' => 'text', | |
| 759 | + 'is_default' => '0', | |
| 760 | + 'htmlvar_name' => 'last_name' | |
| 752 | 761 | ); |
| 753 | 762 | |
| 754 | 763 | $fields[] = array( |
| 755 | - 'form_type' => 'register', | |
| 756 | - 'field_type' => 'text', | |
| 757 | - 'is_default' => '1', | |
| 758 | - 'htmlvar_name' => 'username', | |
| 764 | + 'form_type' => 'register', | |
| 765 | + 'field_type' => 'text', | |
| 766 | + 'is_default' => '1', | |
| 767 | + 'htmlvar_name' => 'username' | |
| 759 | 768 | ); |
| 760 | 769 | |
| 761 | 770 | $fields[] = array( |
| 762 | - 'form_type' => 'register', | |
| 763 | - 'field_type' => 'email', | |
| 764 | - 'is_default' => '1', | |
| 765 | - 'htmlvar_name' => 'email', | |
| 771 | + 'form_type' => 'register', | |
| 772 | + 'field_type' => 'email', | |
| 773 | + 'is_default' => '1', | |
| 774 | + 'htmlvar_name' => 'email' | |
| 766 | 775 | ); |
| 767 | 776 | |
| 768 | 777 | $fields[] = array( |
| 769 | - 'form_type' => 'register', | |
| 770 | - 'field_type' => 'password', | |
| 771 | - 'is_default' => '0', | |
| 772 | - 'htmlvar_name' => 'password', | |
| 778 | + 'form_type' => 'register', | |
| 779 | + 'field_type' => 'password', | |
| 780 | + 'is_default' => '0', | |
| 781 | + 'htmlvar_name' => 'password' | |
| 773 | 782 | ); |
| 774 | 783 | |
| 775 | - foreach ( $fields as $field ) { | |
| 776 | - $last_order = $wpdb->get_var( 'SELECT MAX(sort_order) as last_order FROM ' . $extras_table_name . ' where form_id = ' . $form_id ); | |
| 784 | + | |
| 785 | + foreach ($fields as $field) { | |
| 786 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . $extras_table_name . " where form_id = ". $form_id); | |
| 777 | 787 | $sort_order = (int)$last_order + 1; |
| 778 | 788 | $wpdb->query( |
| 779 | 789 | $wpdb->prepare( |
| 780 | - 'insert into ' . $extras_table_name . ' set | |
| 790 | + | |
| 791 | + "insert into " . $extras_table_name . " set | |
| 781 | 792 | form_type = %s, |
| 782 | 793 | field_type = %s, |
| 783 | 794 | is_default = %s, |
| 784 | 795 | site_htmlvar_name = %s, |
| 785 | 796 | sort_order = %s, |
| 786 | - form_id = %s', | |
| 797 | + form_id = %s", | |
| 787 | 798 | array( |
| 788 | 799 | $field['form_type'], |
| 789 | 800 | $field['field_type'], |
| 790 | 801 | $field['is_default'], |
| @@ -789,9 +800,9 @@ | ||
| 789 | 800 | $field['field_type'], |
| 790 | 801 | $field['is_default'], |
| 791 | 802 | $field['htmlvar_name'], |
| 792 | 803 | $sort_order, |
| 793 | - $form_id, | |
| 804 | + $form_id | |
| 794 | 805 | ) |
| 795 | 806 | ) |
| 796 | 807 | ); |
| 797 | 808 | } |
| @@ -803,21 +814,21 @@ | ||
| 803 | 814 | * @since 2.0.0 |
| 804 | 815 | * @package userswp |
| 805 | 816 | * @return void |
| 806 | 817 | */ |
| 807 | - public static function automatic_upgrade() { | |
| 808 | - $uwp_db_version = get_option( 'uwp_db_version' ); | |
| 818 | + public static function automatic_upgrade(){ | |
| 819 | + $uwp_db_version = get_option('uwp_db_version'); | |
| 809 | 820 | |
| 810 | 821 | if ( $uwp_db_version != USERSWP_VERSION ) { |
| 811 | - self::activate( is_plugin_active_for_network( 'userswp/userswp.php' ) ); | |
| 812 | - $settings = get_option( 'uwp_settings', array() ); | |
| 822 | + self::activate(is_plugin_active_for_network( 'userswp/userswp.php' )); | |
| 823 | + $settings = get_option( 'uwp_settings', array()); | |
| 813 | 824 | $needs_update = false; |
| 814 | - if ( isset( $settings['design_style'] ) && 'bootstrap' == $settings['design_style'] ) { | |
| 825 | + if(isset($settings['design_style']) && 'bootstrap' == $settings['design_style'] ){ | |
| 815 | 826 | $settings['users_default_layout'] = '3col'; |
| 816 | 827 | $needs_update = true; |
| 817 | 828 | } |
| 818 | 829 | |
| 819 | - if ( isset( $settings['uwp_registration_action'] ) && $settings['uwp_registration_action'] == 'force_redirect' ) { | |
| 830 | + if(isset($settings['uwp_registration_action']) && $settings['uwp_registration_action'] == 'force_redirect'){ | |
| 820 | 831 | $settings['uwp_registration_action'] = 'auto_approve_login'; |
| 821 | 832 | $needs_update = true; |
| 822 | 833 | } |
| 823 | 834 | |
| @@ -826,31 +837,28 @@ | ||
| 826 | 837 | if ( ! empty( $get_register_form ) && is_array( $get_register_form ) ) { |
| 827 | 838 | |
| 828 | 839 | foreach ( $get_register_form as $key => $register_form ) { |
| 829 | 840 | |
| 830 | - if ( ! empty( $register_form['id'] ) ) { | |
| 841 | + if ( ! empty( $register_form['id'] )) { | |
| 831 | 842 | |
| 832 | - $reg_action = isset( $register_form['reg_action'] ) ? $register_form['reg_action'] : ''; | |
| 843 | + $reg_action = isset($register_form['reg_action']) ? $register_form['reg_action'] : ''; | |
| 833 | 844 | |
| 834 | - if ( isset( $reg_action ) && $reg_action == 'force_redirect' ) { | |
| 835 | - $settings['multiple_registration_forms'][ $key ]['reg_action'] = 'auto_approve_login'; | |
| 845 | + if(isset($reg_action) && $reg_action == 'force_redirect'){ | |
| 846 | + $settings['multiple_registration_forms'][$key]['reg_action'] = 'auto_approve_login'; | |
| 836 | 847 | $needs_update = true; |
| 837 | 848 | } |
| 838 | 849 | |
| 839 | - $reg_title = isset( $register_form['title'] ) ? $register_form['title'] : ''; | |
| 850 | + $reg_title = isset($register_form['title']) ? $register_form['title'] : ''; | |
| 840 | 851 | |
| 841 | - if ( isset( $reg_title ) && ! empty( $reg_title ) ) { | |
| 842 | - $clean_title = sanitize_text_field( $reg_title ); | |
| 843 | - if ( $clean_title !== $reg_title ) { | |
| 844 | - $settings['multiple_registration_forms'][ $key ]['title'] = $clean_title; | |
| 845 | - $needs_update = true; | |
| 846 | - } | |
| 852 | + if(isset($reg_title) && !empty($reg_title)){ | |
| 853 | + $settings['multiple_registration_forms'][$key]['title'] = sanitize_title_with_dashes($reg_title); | |
| 854 | + $needs_update = true; | |
| 847 | 855 | } |
| 848 | 856 | } |
| 849 | 857 | } |
| 850 | 858 | } |
| 851 | 859 | |
| 852 | - if ( $needs_update ) { | |
| 860 | + if($needs_update){ | |
| 853 | 861 | update_option( 'uwp_settings', $settings ); |
| 854 | 862 | } |
| 855 | 863 | |
| 856 | 864 | // Run this function once. |
| @@ -857,5 +865,8 @@ | ||
| 857 | 865 | update_option( 'uwp_db_version', USERSWP_VERSION ); |
| 858 | 866 | |
| 859 | 867 | } |
| 860 | 868 | } |
| 861 | -} | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | +} | |