[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-settings/ -> bp-settings-template.php (source)

   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  function bp_settings_slug() {
  19      echo bp_get_settings_slug();
  20  }
  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  /**
  41   * Output the settings component root slug.
  42   *
  43   * @since 1.5.0
  44   */
  45  function bp_settings_root_slug() {
  46      echo bp_get_settings_root_slug();
  47  }
  48      /**
  49       * Return the settings component root slug.
  50       *
  51       * @since 1.5.0
  52       *
  53       * @return string
  54       */
  55  	function bp_get_settings_root_slug() {
  56  
  57          /**
  58           * Filters the Settings component root slug.
  59           *
  60           * @since 1.5.0
  61           *
  62           * @param string $root_slug Settings component root slug.
  63           */
  64          return apply_filters( 'bp_get_settings_root_slug', buddypress()->settings->root_slug );
  65      }
  66  
  67  /**
  68   * Add the 'pending email change' message to the settings page.
  69   *
  70   * @since 2.1.0
  71   */
  72  function bp_settings_pending_email_notice() {
  73      $pending_email = bp_get_user_meta( bp_displayed_user_id(), 'pending_email_change', true );
  74  
  75      if ( empty( $pending_email['newemail'] ) ) {
  76          return;
  77      }
  78  
  79      if ( bp_get_displayed_user_email() == $pending_email['newemail'] ) {
  80          return;
  81      }
  82  
  83      ?>
  84  
  85      <div id="message" class="bp-template-notice error">
  86          <p>
  87              <?php
  88              printf(
  89                  /* translators: %s: new email address */
  90                  __( 'There is a pending change of your email address to %s.', 'buddypress' ),
  91                  '<code>' . esc_html( $pending_email['newemail'] ) . '</code>'
  92              );
  93              ?>
  94              <br />
  95              <?php
  96              printf(
  97                  /* translators: 1: email address. 2: cancel email change url. */
  98                  __( 'Check your email (%1$s) for the verification link, or <a href="%2$s">cancel the pending change</a>.', 'buddypress' ),
  99                  '<code>' . esc_html( $pending_email['newemail'] ) . '</code>',
 100                  esc_url( wp_nonce_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?dismiss_email_change=1', 'bp_dismiss_email_change' ) )
 101              );
 102              ?>
 103          </p>
 104      </div>
 105  
 106      <?php
 107  }
 108  add_action( 'bp_before_member_settings_template', 'bp_settings_pending_email_notice' );


Generated: Mon Sep 20 01:01:39 2021 Cross-referenced by PHPXref 0.7.1