Guest User

Untitled

a guest
Aug 26th, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.96 KB | None | 0 0
  1. Hi @sbaglia today i found myself doing the same task you ask for.
  2.  
  3. First, I would suggest to improve the way you're hiding the email input field (in the form), I see you do:
  4.  
  5. `
  6. <!-- <label for="email"><?php _e( 'Account Email', 'buddypress' ); ?></label>
  7. <input type="text" name="email" id="email" value="<?php echo bp_get_displayed_user_email(); ?>" class="settings-input" /> //-->
  8. `
  9. But this gets commented at HTML level, it means a flaw of security since anyone could edit that and change the email anyway since your form would still be sending the input.
  10.  
  11. You should hide it like this, via PHP:
  12.  
  13. `
  14. <?php /*
  15. <label for="email"><?php _e( 'Account Email', 'buddypress' ); ?></label>
  16. <input type="text" name="email" id="email" value="<?php echo bp_get_displayed_user_email(); ?>" class="settings-input" />
  17. */ ?>
  18. `
  19.  
  20. Said that, you have to prevent the backend comprobation of the email change post, since you will never allow to change it. Otherwise when users try to change their passwords the system checks for the email variable also and since it's not being send, voila, you have got the error.
  21.  
  22. So go to: \wp-content\plugins\buddypress\bp-settings\bp-settings-actions.php around line 158 and edit:
  23.  
  24. ´
  25. /*
  26. // Email feedback
  27. switch ( $email_error ) {
  28.     case 'invalid' :
  29.         $feedback['email_invalid']  = __( 'That email address is invalid. Check the formatting and try again.', 'buddypress' );
  30.         break;
  31.     case 'blocked' :
  32.         $feedback['email_blocked']  = __( 'That email address is currently unavailable for use.', 'buddypress' );
  33.         break;
  34.     case 'taken' :
  35.         $feedback['email_taken']    = __( 'That email address is already taken.', 'buddypress' );
  36.         break;
  37.     case 'empty' :
  38.         $feedback['email_empty']    = __( 'Email address cannot be empty.', 'buddypress' );
  39.         break;
  40.     case false :
  41.         // No change
  42.         break;
  43. }*/
  44. ´
  45. If it's not clear, you just have to wrap the email feedback function between ´/*´ and ´*/´ which is the way you comment code in PHP. ¡Good luck!
Advertisement
Add Comment
Please, Sign In to add comment