Changeset 487459
- Timestamp:
- 01/10/2012 11:54:12 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
active-directory-integration/trunk/ad-integration.php
r487433 r487459 401 401 // Prevent email change 402 402 if ($this->_prevent_email_change) { 403 add_action( 'user_profile_update_errors', array(&$this, 'prevent_email_change'), 10, 3 ); 403 add_action( 'edit_user_profile', array(&$this, 'user_profile_prevent_email_change')); // cosmetic 404 add_action( 'show_user_profile', array(&$this, 'user_profile_prevent_email_change')); // cosmetic 405 add_action( 'user_profile_update_errors', array(&$this, 'prevent_email_change'), 10, 3 ); // true prevention 404 406 } 405 407 } … … 1408 1410 } 1409 1411 } 1410 1411 // disable email field if needed (dirty hack) 1412 if ($this->_prevent_email_change && ($adi_samaccountname != '') && (!current_user_can('level_10'))) { 1413 ?> 1414 <script type="text/javascript"> 1415 var email = document.getElementById('email'); 1416 if (email) { 1417 email.setAttribute('disabled','disabled'); 1418 } 1419 </script> 1420 <?php 1421 } 1422 1423 } 1412 } 1413 1414 1415 1424 1416 1425 1417 /** … … 1592 1584 1593 1585 /** 1586 * Disable email field in user profile if needed (actions edit_user_profile and show_user_profile) 1587 * This is not safe and only for cosmetic reasons, but we also have the method prevent_email_change() (see below). 1588 * 1589 * @param object $user 1590 */ 1591 public function user_profile_prevent_email_change($user) 1592 { 1593 // disable email field if needed (dirty hack) 1594 if ($this->_prevent_email_change && $this->_is_adi_user($user->ID) && (!current_user_can('level_10'))) { 1595 ?> 1596 <script type="text/javascript"> 1597 var email = document.getElementById('email'); 1598 if (email) { 1599 email.setAttribute('disabled','disabled'); 1600 } 1601 </script> 1602 <?php 1603 } 1604 } 1605 1606 /** 1594 1607 * Prevent ADI users from changing their email (action user_profile_update_errors) 1595 1608 * … … 1598 1611 * @param object $user 1599 1612 */ 1600 public function prevent_email_change(&$errors, $update, &$user) { 1613 public function prevent_email_change(&$errors, $update, &$user) 1614 { 1601 1615 if ($this->_prevent_email_change && ($this->_is_adi_user($user->ID)) && (!current_user_can('level_10'))) { 1602 1616 $old = get_user_by('id', $user->ID);
Note: See TracChangeset
for help on using the changeset viewer.