User registration & user profile – Profile Builder - Version 1.0.10

Version Description

Bugfix - The wp_update_user attempts to clear and reset cookies if it's updating the password. Because of that we get "headers already sent". Fixed by hooking into the init.

Download this release

Release Info

Developer reflectionmedia
Plugin Icon 128x128 User registration & user profile – Profile Builder
Version 1.0.10
Comparing to
See all releases

Code changes from version 1.0.9 to 1.0.10

includes/wppb-front-end-profile.php CHANGED
@@ -1,12 +1,46 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  function wppb_front_end_profile_info() {
 
 
 
3
  ob_start();
4
  get_currentuserinfo();
5
  $wppb_defaultOptions = get_option('wppb_default_settings');
6
  $changesSaved = 'no';
7
-
8
-
9
-
10
  /* Load registration file. */
11
  require_once(ABSPATH . WPINC . '/registration.php');
12
  /* Get user info. */
@@ -19,12 +53,11 @@ function wppb_front_end_profile_info() {
19
  else $thisEmail = $current_user->id;
20
 
21
  /* Update user password. */
22
- if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
23
- if ( $_POST['pass1'] == $_POST['pass2'] ){
24
- wp_update_user( array( 'ID' => $current_user->id, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
25
- $changesSaved = 'yes';
26
- }else
27
- $error = __('The passwords you entered didn\'t match. Your password was not updated.', 'profilebuilder');
28
  }
29
 
30
 
@@ -279,7 +312,6 @@ function wppb_front_end_profile_info() {
279
  $output = ob_get_contents();
280
  ob_end_clean();
281
  return $output;
282
-
283
  }
284
 
285
  ?>
1
  <?php
2
+ /*
3
+ wp_update_user only attempts to clear and reset cookies if it's updating the password.
4
+ The php function setcookie(), used in both the cookie-clearing and cookie-resetting functions,
5
+ adds to the page headers and therefore must be called within the first php tag on the page, and
6
+ before the WordPress get_header() function. Since wp_update_user needs this, it must be at the
7
+ beginning of the page as well.
8
+ */
9
+ $wppb_saved_pass = false;
10
+ $wppb_error_pass = false;
11
+
12
+ function wppb_save_the_password(){
13
+ global $wppb_saved_pass;
14
+ global $wppb_error_pass;
15
+ /* Load registration file. */
16
+ require_once(ABSPATH . WPINC . '/registration.php');
17
+ /* Get user info. */
18
+ global $current_user;
19
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' && wp_verify_nonce($_POST['edit_nonce_field'],'verify_edit_user') ) {
20
+ /* Update user password. */
21
+ if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
22
+ if ( $_POST['pass1'] == $_POST['pass2'] )
23
+ {
24
+ wp_update_user( array( 'ID' => $current_user->id, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
25
+ $wppb_saved_pass = true;
26
+ } else {
27
+ $wppb_error_pass = true;
28
+ }
29
+ }
30
+ }
31
+ }
32
+ add_action('init', 'wppb_save_the_password');
33
+
34
+ /* the shortcode function */
35
  function wppb_front_end_profile_info() {
36
+ global $wppb_saved_pass;
37
+ global $wppb_error_pass;
38
+
39
  ob_start();
40
  get_currentuserinfo();
41
  $wppb_defaultOptions = get_option('wppb_default_settings');
42
  $changesSaved = 'no';
43
+
 
 
44
  /* Load registration file. */
45
  require_once(ABSPATH . WPINC . '/registration.php');
46
  /* Get user info. */
53
  else $thisEmail = $current_user->id;
54
 
55
  /* Update user password. */
56
+ if ($wppb_saved_pass == true){
57
+ $changesSaved = 'yes';
58
+ }
59
+ if ($wppb_error_pass == true){
60
+ $error = __('The passwords you entered didn\'t match. Your password was not updated.', 'profilebuilder');
 
61
  }
62
 
63
 
312
  $output = ob_get_contents();
313
  ob_end_clean();
314
  return $output;
 
315
  }
316
 
317
  ?>
profile-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Profile Builder
4
  Plugin URI: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed.
6
- Version: 1.0.9
7
  Author: Reflection Media
8
  Author URI: http://reflectionmedia.ro
9
  License: GPL2
3
  Plugin Name: Profile Builder
4
  Plugin URI: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed.
6
+ Version: 1.0.10
7
  Author: Reflection Media
8
  Author URI: http://reflectionmedia.ro
9
  License: GPL2
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === Profile Builder ===
2
 
3
  Contributors: reflectionmedia, barinagabriel
4
  Donate link: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin
5
  Tags: registration, profile, user registration, custom field registration, customize profile, user fields, builder, profile builder
6
  Requires at least: 3.1
7
  Tested up to: 3.1.2
8
- Stable tag: 1.0.9
9
 
10
 
11
  Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed.
@@ -64,6 +64,10 @@ No, only fields visible to the users will/can be modified/updated.
64
 
65
  == Changelog ==
66
 
 
 
 
 
67
  = 1.0.9 =
68
  Bugfix - On the edit profile page the website field added a new http:// everytime you updated your profile.
69
  Bugfix/ExtraFeature - Add support for shortcodes to be run in a text widget area.
1
+ === Profile Builder ===
2
 
3
  Contributors: reflectionmedia, barinagabriel
4
  Donate link: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin
5
  Tags: registration, profile, user registration, custom field registration, customize profile, user fields, builder, profile builder
6
  Requires at least: 3.1
7
  Tested up to: 3.1.2
8
+ Stable tag: 1.0.10
9
 
10
 
11
  Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed.
64
 
65
  == Changelog ==
66
 
67
+ = 1.0.10 =
68
+ Bugfix - The wp_update_user attempts to clear and reset cookies if it's updating the password.
69
+ Because of that we get "headers already sent". Fixed by hooking into the init.
70
+
71
  = 1.0.9 =
72
  Bugfix - On the edit profile page the website field added a new http:// everytime you updated your profile.
73
  Bugfix/ExtraFeature - Add support for shortcodes to be run in a text widget area.
screenshots/screenshot-1.jpg DELETED
Binary file
screenshots/screenshot-2.jpg DELETED
Binary file
screenshots/screenshot-3.jpg DELETED
Binary file
screenshots/screenshot1.jpg ADDED
Binary file
screenshots/screenshot2.jpg ADDED
Binary file
screenshots/screenshot3.jpg ADDED
Binary file
screenshots/screenshot4.jpg ADDED
Binary file
screenshots/screenshot6.jpg ADDED
Binary file
screenshots/screenshot7.jpg ADDED
Binary file