PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.7.1
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.7.1
4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 340 releases
← All changes | admin/admin-functions.php +61 -20 2.0.22.7.1 View file →
@@ -25,26 +25,52 @@
25 25 * @param string $value
26 26 *
27 27 * @return string $form
28 28 */
29 -function wppb_manage_fields_display_field_title_slug( $form, $i, $value ){
30 - $wppb_generalSettings = get_option( 'wppb_general_settings', 'not_found' );
31 - if ( $wppb_generalSettings != 'not_found' ){
32 - if ( $wppb_generalSettings['loginWith'] == 'email' )
33 - if ( ( $value == 'Username ( Default - Username )' ) || ( $value == 'Username' ) )
34 - $form .= '<div id="wppb-login-email-nag" class="wppb-backend-notice">' . sprintf( __( 'Login is set to be done using the E-mail. This field will NOT appear in the front-end! ( you can change these settings under the "%s" tab )', 'profilebuilder' ), '<a href="'.admin_url( 'admin.php?page=profile-builder-general-settings' ).'" target="_blank">' . __('General Settings', 'profilebuilder') . '</a>' ) . '</div>';
35 - }
36 29
37 - return $form;
30 +function wppb_manage_fields_display_field_title_slug( $form ){
31 + // add a notice to fields
32 + global $wppb_results_field;
33 + switch ($wppb_results_field){
34 + case 'Default - Username':
35 + $wppb_generalSettings = get_option( 'wppb_general_settings', 'not_found' );
36 + if ( $wppb_generalSettings != 'not_found' && $wppb_generalSettings['loginWith'] == 'email' ) {
37 + $form .= '<div id="wppb-login-email-nag" class="wppb-backend-notice">' . sprintf(__('Login is set to be done using the E-mail. This field will NOT appear in the front-end! ( you can change these settings under the "%s" tab )', 'profile-builder'), '<a href="' . admin_url('admin.php?page=profile-builder-general-settings') . '" target="_blank">' . __('General Settings', 'profile-builder') . '</a>') . '</div>';
38 + }
39 + break;
40 + case 'Default - Display name publicly as':
41 + $form .= '<div id="wppb-display-name-nag" class="wppb-backend-notice">' . __( 'Display name publicly as - only appears on the Edit Profile page!', 'profile-builder' ) . '</div>';
42 + break;
43 + case 'Default - Blog Details':
44 + $form .= '<div id="wppb-blog-details-nag" class="wppb-backend-notice">' . __( 'Blog Details - only appears on the Registration page!', 'profile-builder' ) . '</div>';
45 + break;
46 + }
47 +
48 + return $form;
38 49 }
39 -add_filter( "wck_before_listed_wppb_manage_fields_element_0", 'wppb_manage_fields_display_field_title_slug', 10, 3 );
40 -add_filter( "wck_before_listed_wppb_epf_fields_element_0", 'wppb_manage_fields_display_field_title_slug', 10, 3 );
41 -add_filter( "wck_before_listed_wppb_rf_fields_element_0", 'wppb_manage_fields_display_field_title_slug', 10, 3 );
42 50
51 +add_filter( 'wck_after_content_element', 'wppb_manage_fields_display_field_title_slug' );
43 52
53 +/**
54 + * Check if field type is 'Default - Display name publicly as' so we can add a notification for it
55 + *
56 + * @since v.2.2
57 + *
58 + * @param string $wck_element_class
59 + * @param string $meta
60 + * @param array $results
61 + * @param integer $element_id
62 + *
63 + */
64 +function wppb_manage_fields_display_name_notice( $wck_element_class, $meta, $results, $element_id ) {
65 + global $wppb_results_field;
44 66
67 + $wppb_results_field = $results[$element_id]['field'];
68 +}
69 +add_filter( 'wck_element_class_wppb_manage_fields', 'wppb_manage_fields_display_name_notice', 10, 4 );
45 70
46 71
72 +
47 73 /**
48 74 * Function that adds a custom class to the existing container
49 75 *
50 76 * @since v.2.0
@@ -58,9 +84,9 @@
58 84 */
59 85 function wppb_update_container_class( $update_container_class, $meta, $results, $element_id ) {
60 86 $wppb_element_type = Wordpress_Creation_Kit_PB::wck_generate_slug( $results[$element_id]["field"] );
61 87
62 - return "class='update_container_$meta update_container_$wppb_element_type element_type_$wppb_element_type'";
88 + return "class='wck_update_container update_container_$meta update_container_$wppb_element_type element_type_$wppb_element_type'";
63 89 }
64 90 add_filter( 'wck_update_container_class_wppb_manage_fields', 'wppb_update_container_class', 10, 4 );
65 91
66 92
@@ -102,18 +128,17 @@
102 128 if( $password ){
103 129 $wppb_generalSettings = get_option( 'wppb_general_settings' );
104 130 if( !empty( $wppb_generalSettings['minimum_password_length'] ) ){
105 131 if( strlen( $password ) < $wppb_generalSettings['minimum_password_length'] )
106 - $errors->add( 'pass', __( '<strong>ERROR</strong>: The password must have the minimum length of '. $wppb_generalSettings['minimum_password_length'] .' characters', 'profilebuilder' ) );
132 + $errors->add( 'pass', sprintf( __( '<strong>ERROR</strong>: The password must have the minimum length of %s characters', 'profile-builder' ), $wppb_generalSettings['minimum_password_length'] ) );
107 133 }
108 134
109 135 if( isset( $_POST['wppb_password_strength'] ) && !empty( $wppb_generalSettings['minimum_password_strength'] ) ){
110 -
111 136 $password_strength_array = array( 'short' => 0, 'bad' => 1, 'good' => 2, 'strong' => 3 );
112 - $password_strength_text = array( 'short' => __( 'Very weak', 'profilebuilder' ), 'bad' => __( 'Weak', 'profilebuilder' ), 'good' => __( 'Medium', 'profilebuilder' ), 'strong' => __( 'Strong', 'profilebuilder' ) );
137 + $password_strength_text = array( 'short' => __( 'Very weak', 'profile-builder' ), 'bad' => __( 'Weak', 'profile-builder' ), 'good' => __( 'Medium', 'profile-builder' ), 'strong' => __( 'Strong', 'profile-builder' ) );
113 138
114 139 foreach( $password_strength_text as $psr_key => $psr_text ){
115 - if( $psr_text == $_POST['wppb_password_strength'] ){
140 + if( $psr_text == sanitize_text_field( $_POST['wppb_password_strength'] ) ){
116 141 $password_strength_result_slug = $psr_key;
117 142 break;
118 143 }
119 144 }
@@ -119,9 +144,9 @@
119 144 }
120 145
121 146 if( !empty( $password_strength_result_slug ) ){
122 147 if( $password_strength_array[$password_strength_result_slug] < $password_strength_array[$wppb_generalSettings['minimum_password_strength']] )
123 - $errors->add( 'pass', __( '<strong>ERROR</strong>: The password must have a minimum strength of '. $password_strength_text[$wppb_generalSettings['minimum_password_strength']], 'profilebuilder' ) );
148 + $errors->add( 'pass', sprintf( __( '<strong>ERROR</strong>: The password must have a minimum strength of %s', 'profile-builder' ), $password_strength_text[$wppb_generalSettings['minimum_password_strength']] ) );
124 149 }
125 150 }
126 151 }
127 152
@@ -158,11 +183,27 @@
158 183 /* Modify the Add Entry buttons for WCK metaboxes according to context */
159 184 add_filter( 'wck_add_entry_button', 'wppb_change_add_entry_button', 10, 2 );
160 185 function wppb_change_add_entry_button( $string, $meta ){
161 186 if( $meta == 'wppb_manage_fields' || $meta == 'wppb_epf_fields' || $meta == 'wppb_rf_fields' ){
162 - return __( "Add Field", 'profilebuilder' );
187 + return __( "Add Field", 'profile-builder' );
163 188 }elseif( $meta == 'wppb_epf_page_settings' || $meta == 'wppb_rf_page_settings' || $meta == 'wppb_ul_page_settings' ){
164 - return __( "Save Settings", 'profilebuilder' );
189 + return __( "Save Settings", 'profile-builder' );
165 190 }
166 191
167 192 return $string;
168 -}
193 +}
194 +
195 +/* Add admin footer text for encouraging users to leave a review of the plugin on wordpress.org */
196 +function wppb_admin_rate_us( $footer_text ) {
197 + global $current_screen;
198 +
199 + if ($current_screen->parent_base == 'profile-builder'){
200 + $rate_text = sprintf( __( 'If you enjoy using <strong> %1$s </strong> please <a href="%2$s" target="_blank">rate us on WordPress.org</a>. More happy users means more features, less bugs and better support for everyone. ', 'profile-builder' ),
201 + PROFILE_BUILDER,
202 + 'https://wordpress.org/support/view/plugin-reviews/profile-builder?filter=5#postform'
203 + );
204 + return '<span id="footer-thankyou">' .$rate_text . '</span>';
205 + } else {
206 + return $footer_text;
207 + }
208 +}
209 +add_filter('admin_footer_text','wppb_admin_rate_us');