/bp-settings/bp-settings-template.php

  1. <?php 
  2. /** 
  3. * BuddyPress Settings Template Functions. 
  4. * 
  5. * @package BuddyPress 
  6. * @subpackage SettingsTemplate 
  7. * @since 1.5.0 
  8. */ 
  9.  
  10. // Exit if accessed directly. 
  11. defined( 'ABSPATH' ) || exit; 
  12.  
  13. /** 
  14. * Output the settings component slug. 
  15. * 
  16. * @since 1.5.0 
  17. * 
  18. */ 
  19. function bp_settings_slug() { 
  20. echo bp_get_settings_slug(); 
  21. /** 
  22. * Return the settings component slug. 
  23. * 
  24. * @since 1.5.0 
  25. * 
  26. * @return string 
  27. */ 
  28. function bp_get_settings_slug() { 
  29.  
  30. /** 
  31. * Filters the Settings component slug. 
  32. * 
  33. * @since 1.5.0 
  34. * 
  35. * @param string $slug Settings component slug. 
  36. */ 
  37. return apply_filters( 'bp_get_settings_slug', buddypress()->settings->slug ); 
  38.  
  39. /** 
  40. * Output the settings component root slug. 
  41. * 
  42. * @since 1.5.0 
  43. * 
  44. */ 
  45. function bp_settings_root_slug() { 
  46. echo bp_get_settings_root_slug(); 
  47. /** 
  48. * Return the settings component root slug. 
  49. * 
  50. * @since 1.5.0 
  51. * 
  52. * @return string 
  53. */ 
  54. function bp_get_settings_root_slug() { 
  55.  
  56. /** 
  57. * Filters the Settings component root slug. 
  58. * 
  59. * @since 1.5.0 
  60. * 
  61. * @param string $root_slug Settings component root slug. 
  62. */ 
  63. return apply_filters( 'bp_get_settings_root_slug', buddypress()->settings->root_slug ); 
  64.  
  65. /** 
  66. * Add the 'pending email change' message to the settings page. 
  67. * 
  68. * @since 2.1.0 
  69. */ 
  70. function bp_settings_pending_email_notice() { 
  71. $pending_email = bp_get_user_meta( bp_displayed_user_id(), 'pending_email_change', true ); 
  72.  
  73. if ( empty( $pending_email['newemail'] ) ) { 
  74. return; 
  75.  
  76. if ( bp_get_displayed_user_email() == $pending_email['newemail'] ) { 
  77. return; 
  78.  
  79. ?> 
  80.  
  81. <div id="message" class="bp-template-notice error"> 
  82. <p><?php printf( 
  83. __( 'There is a pending change of your email address to %s.', 'buddypress' ),  
  84. '<code>' . esc_html( $pending_email['newemail'] ) . '</code>' 
  85. ); ?> 
  86. <br /> 
  87. <?php printf( 
  88. __( 'Check your email (%1$s) for the verification link, or <a href="%2$s">cancel the pending change</a>.', 'buddypress' ),  
  89. '<code>' . esc_html( bp_get_displayed_user_email() ) . '</code>',  
  90. esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?dismiss_email_change=1' ) 
  91. ); ?></p> 
  92. </div> 
  93.  
  94. <?php 
  95. add_action( 'bp_before_member_settings_template', 'bp_settings_pending_email_notice' ); 
.