[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-templates/bp-nouveau/ -> buddypress-functions.php (source)

   1  <?php
   2  /**
   3   * Functions of BuddyPress's "Nouveau" template pack.
   4   *
   5   * @since 3.0.0
   6   * @version 3.1.0
   7   *
   8   * @buddypress-template-pack {
   9   *   Template Pack ID:       nouveau
  10   *   Template Pack Name:     BP Nouveau
  11   *   Version:                1.0.0
  12   *   WP required version:    4.5.0
  13   *   BP required version:    3.0.0
  14   *   Description:            A new template pack for BuddyPress!
  15   *   Text Domain:            bp-nouveau
  16   *   Domain Path:            /languages/
  17   *   Author:                 The BuddyPress community
  18   *   Template Pack Supports: activity, blogs, friends, groups, messages, notifications, settings, xprofile
  19   * }}
  20   */
  21  
  22  // Exit if accessed directly.
  23  defined( 'ABSPATH' ) || exit;
  24  
  25  /** Theme Setup ***************************************************************/
  26  
  27  /**
  28   * Loads BuddyPress Nouveau Template pack functionality.
  29   *
  30   * See @link BP_Theme_Compat() for more.
  31   *
  32   * @since 3.0.0
  33   */
  34  class BP_Nouveau extends BP_Theme_Compat {
  35      /**
  36       * Instance of this class.
  37       */
  38      protected static $instance = null;
  39  
  40      /**
  41       * Return the instance of this class.
  42       *
  43       * @since 3.0.0
  44       */
  45  	public static function get_instance() {
  46          if ( null === self::$instance ) {
  47              self::$instance = new self;
  48          }
  49  
  50          return self::$instance;
  51      }
  52  
  53      /**
  54       * The BP Nouveau constructor.
  55       *
  56       * @since 3.0.0
  57       */
  58  	public function __construct() {
  59          parent::start();
  60  
  61          $this->includes();
  62          $this->setup_support();
  63      }
  64  
  65      /**
  66       * BP Nouveau global variables.
  67       *
  68       * @since 3.0.0
  69       */
  70  	protected function setup_globals() {
  71          $bp = buddypress();
  72  
  73          foreach ( $bp->theme_compat->packages['nouveau'] as $property => $value ) {
  74              $this->{$property} = $value;
  75          }
  76  
  77          $this->includes_dir  = trailingslashit( $this->dir ) . 'includes/';
  78          $this->directory_nav = new BP_Core_Nav();
  79      }
  80  
  81      /**
  82       * Includes!
  83       *
  84       * @since 3.0.0
  85       */
  86  	protected function includes() {
  87          require $this->includes_dir . 'functions.php';
  88          require $this->includes_dir . 'classes.php';
  89          require $this->includes_dir . 'template-tags.php';
  90  
  91          // Test suite requires the AJAX functions early.
  92          if ( function_exists( 'tests_add_filter' ) ) {
  93              require $this->includes_dir . 'ajax.php';
  94  
  95          // Load AJAX code only on AJAX requests.
  96          } else {
  97              add_action( 'admin_init', function() {
  98                  if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX ) {
  99                      require bp_nouveau()->includes_dir . 'ajax.php';
 100                  }
 101              }, 0 );
 102          }
 103  
 104          add_action( 'bp_customize_register', function() {
 105              if ( bp_is_root_blog() && current_user_can( 'customize' ) ) {
 106                  require bp_nouveau()->includes_dir . 'customizer.php';
 107              }
 108          }, 0 );
 109  
 110          foreach ( bp_core_get_packaged_component_ids() as $component ) {
 111              $component_loader = trailingslashit( $this->includes_dir ) . $component . '/loader.php';
 112  
 113              if ( ! bp_is_active( $component ) || ! file_exists( $component_loader ) ) {
 114                  continue;
 115              }
 116  
 117              require( $component_loader );
 118          }
 119  
 120          /**
 121           * Fires after all of the BuddyPress Nouveau includes have been loaded. Passed by reference.
 122           *
 123           * @since 3.0.0
 124           *
 125           * @param BP_Nouveau $value Current BP_Nouveau instance.
 126           */
 127          do_action_ref_array( 'bp_nouveau_includes', array( &$this ) );
 128      }
 129  
 130      /**
 131       * Setup the Template Pack features support.
 132       *
 133       * @since 3.0.0
 134       */
 135  	protected function setup_support() {
 136          $width         = 1300;
 137          $top_offset    = 150;
 138  
 139          /** This filter is documented in bp-core/bp-core-avatars.php. */
 140          $avatar_height = apply_filters( 'bp_core_avatar_full_height', $top_offset );
 141  
 142          if ( $avatar_height > $top_offset ) {
 143              $top_offset = $avatar_height;
 144          }
 145  
 146          bp_set_theme_compat_feature( $this->id, array(
 147              'name'     => 'cover_image',
 148              'settings' => array(
 149                  'components'   => array( 'members', 'groups' ),
 150                  'width'        => $width,
 151                  'height'       => $top_offset + round( $avatar_height / 2 ),
 152                  'callback'     => 'bp_nouveau_theme_cover_image',
 153                  'theme_handle' => 'bp-nouveau',
 154              ),
 155          ) );
 156      }
 157  
 158      /**
 159       * Setup the Template Pack common actions.
 160       *
 161       * @since 3.0.0
 162       */
 163  	protected function setup_actions() {
 164          // Filter BuddyPress template hierarchy and look for page templates.
 165          add_filter( 'bp_get_buddypress_template', array( $this, 'theme_compat_page_templates' ), 10, 1 );
 166  
 167          // Add our "buddypress" div wrapper to theme compat template parts.
 168          add_filter( 'bp_replace_the_content', array( $this, 'theme_compat_wrapper' ), 999 );
 169  
 170          // We need to neutralize the BuddyPress core "bp_core_render_message()" once it has been added.
 171          add_action( 'bp_actions', array( $this, 'neutralize_core_template_notices' ), 6 );
 172  
 173          // Scripts.
 174          add_action( 'bp_enqueue_scripts', array( $this, 'register_scripts' ), 2 ); // Register theme JS.
 175          remove_action( 'bp_enqueue_scripts', 'bp_core_confirmation_js' );
 176          add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); // Enqueue theme CSS.
 177          add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue theme JS.
 178          add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization.
 179  
 180          // Body no-js class.
 181          add_filter( 'body_class', array( $this, 'add_nojs_body_class' ), 20, 1 );
 182  
 183          // Ajax querystring.
 184          add_filter( 'bp_ajax_querystring', 'bp_nouveau_ajax_querystring', 10, 2 );
 185  
 186          // Register directory nav items.
 187          add_action( 'bp_screens', array( $this, 'setup_directory_nav' ), 15 );
 188  
 189          // Register the Default front pages Dynamic Sidebars.
 190          add_action( 'widgets_init', 'bp_nouveau_register_sidebars', 11 );
 191  
 192          // Register the Primary Object nav widget.
 193          add_action( 'bp_widgets_init', array( 'BP_Nouveau_Object_Nav_Widget', 'register_widget' ) );
 194  
 195          // Set the BP Uri for the Ajax customizer preview.
 196          add_filter( 'bp_uri', array( $this, 'customizer_set_uri' ), 10, 1 );
 197  
 198          // Modify "registration disabled" and welcome message if invitations are enabled.
 199          add_action( 'bp_nouveau_feedback_messages', array( $this, 'filter_registration_messages' ), 99 );
 200  
 201          /** Override **********************************************************/
 202  
 203          /**
 204           * Fires after all of the BuddyPress theme compat actions have been added.
 205           *
 206           * @since 3.0.0
 207           *
 208           * @param BP_Nouveau $this Current BP_Nouveau instance.
 209           */
 210          do_action_ref_array( 'bp_theme_compat_actions', array( &$this ) );
 211      }
 212  
 213      /**
 214       * Enqueue the template pack css files
 215       *
 216       * @since 3.0.0
 217       */
 218  	public function enqueue_styles() {
 219          $min = bp_core_get_minified_asset_suffix();
 220          $rtl = '';
 221  
 222          if ( is_rtl() ) {
 223              $rtl = '-rtl';
 224          }
 225  
 226          /**
 227           * Filters the BuddyPress Nouveau CSS dependencies.
 228           *
 229           * @since 3.0.0
 230           *
 231           * @param array $value Array of style dependencies. Default Dashicons.
 232           */
 233          $css_dependencies = apply_filters( 'bp_nouveau_css_dependencies', array( 'dashicons' ) );
 234  
 235          /**
 236           * Filters the styles to enqueue for BuddyPress Nouveau.
 237           *
 238           * This filter provides a multidimensional array that will map to arguments used for wp_enqueue_style().
 239           * The primary index should have the stylesheet handle to use, and be assigned an array that has indexes for
 240           * file location, dependencies, and version.
 241           *
 242           * @since 3.0.0
 243           *
 244           * @param array $value Array of styles to enqueue.
 245           */
 246          $styles = apply_filters( 'bp_nouveau_enqueue_styles', array(
 247              'bp-nouveau' => array(
 248                  'file' => 'css/buddypress%1$s%2$s.css', 'dependencies' => $css_dependencies, 'version' => $this->version,
 249              ),
 250          ) );
 251  
 252          if ( $styles ) {
 253  
 254              foreach ( $styles as $handle => $style ) {
 255                  if ( ! isset( $style['file'] ) ) {
 256                      continue;
 257                  }
 258  
 259                  $file = sprintf( $style['file'], $rtl, $min );
 260  
 261                  // Locate the asset if needed.
 262                  if ( false === strpos( $style['file'], '://' ) ) {
 263                      $asset = bp_locate_template_asset( $file );
 264  
 265                      if ( empty( $asset['uri'] ) || false === strpos( $asset['uri'], '://' ) ) {
 266                          continue;
 267                      }
 268  
 269                      $file = $asset['uri'];
 270                  }
 271  
 272                  $data = bp_parse_args(
 273                      $style,
 274                      array(
 275                          'dependencies' => array(),
 276                          'version'      => $this->version,
 277                          'type'         => 'screen',
 278                      ),
 279                      'nouveau_enqueue_styles'
 280                  );
 281  
 282                  wp_enqueue_style( $handle, $file, $data['dependencies'], $data['version'], $data['type'] );
 283  
 284                  if ( $min ) {
 285                      wp_style_add_data( $handle, 'suffix', $min );
 286                  }
 287              }
 288          }
 289  
 290          // Compatibility stylesheets for specific themes.
 291          $theme                = get_template();
 292          $companion_stylesheet = bp_locate_template_asset( sprintf( 'css/%1$s%2$s.css', $theme, $min ) );
 293          $companion_handle     = 'bp-' . $theme;
 294  
 295          if ( ! is_rtl() && isset( $companion_stylesheet['uri'] ) && $companion_stylesheet['uri'] ) {
 296              wp_enqueue_style( $companion_handle, $companion_stylesheet['uri'], array(), $this->version, 'screen' );
 297  
 298              if ( $min ) {
 299                  wp_style_add_data( $companion_handle, 'suffix', $min );
 300              }
 301          }
 302  
 303          // Compatibility stylesheet for specific themes, RTL-version.
 304          if ( is_rtl() ) {
 305              $rtl_companion_stylesheet = bp_locate_template_asset( sprintf( 'css/%1$s-rtl%2$s.css', $theme, $min ) );
 306  
 307              if ( isset( $rtl_companion_stylesheet['uri'] ) ) {
 308                  $companion_handle .= '-rtl';
 309                  wp_enqueue_style( $companion_handle, $rtl_companion_stylesheet['uri'], array(), $this->version, 'screen' );
 310  
 311                  if ( $min ) {
 312                      wp_style_add_data( $companion_handle, 'suffix', $min );
 313                  }
 314              }
 315          }
 316      }
 317  
 318      /**
 319       * Register Template Pack JavaScript files
 320       *
 321       * @since 3.0.0
 322       */
 323  	public function register_scripts() {
 324          $min          = bp_core_get_minified_asset_suffix();
 325          $dependencies = bp_core_get_js_dependencies();
 326          $bp_confirm   = array_search( 'bp-confirm', $dependencies );
 327  
 328          unset( $dependencies[ $bp_confirm ] );
 329  
 330          /**
 331           * Filters the scripts to enqueue for BuddyPress Nouveau.
 332           *
 333           * This filter provides a multidimensional array that will map to arguments used for wp_register_script().
 334           * The primary index should have the script handle to use, and be assigned an array that has indexes for
 335           * file location, dependencies, version and if it should load in the footer or not.
 336           *
 337           * @since 3.0.0
 338           *
 339           * @param array $value Array of scripts to register.
 340           */
 341          $scripts = apply_filters( 'bp_nouveau_register_scripts', array(
 342              'bp-nouveau' => array(
 343                  'file'         => 'js/buddypress-nouveau%s.js',
 344                  'dependencies' => $dependencies,
 345                  'version'      => $this->version,
 346                  'footer'       => true,
 347              ),
 348          ) );
 349  
 350          // Bail if no scripts.
 351          if ( empty( $scripts ) ) {
 352              return;
 353          }
 354  
 355          // Add The password verify if needed.
 356          if ( bp_is_active( 'settings' ) || bp_get_signup_allowed() ) {
 357              /**
 358               * BP Nouveau is now directly using the `wp-admin/js/user-profile.js` script.
 359               *
 360               * Setting the user password is now more consistent with how WordPress handles it.
 361               *
 362               * @deprecated 5.0.0
 363               */
 364              $scripts['bp-nouveau-password-verify'] = array(
 365                  'file'         => 'js/password-verify%s.js',
 366                  'dependencies' => array( 'bp-nouveau', 'password-strength-meter' ),
 367                  'footer'       => true,
 368              );
 369          }
 370  
 371          foreach ( $scripts as $handle => $script ) {
 372              if ( ! isset( $script['file'] ) ) {
 373                  continue;
 374              }
 375  
 376              $file = sprintf( $script['file'], $min );
 377  
 378              // Locate the asset if needed.
 379              if ( false === strpos( $script['file'], '://' ) ) {
 380                  $asset = bp_locate_template_asset( $file );
 381  
 382                  if ( empty( $asset['uri'] ) || false === strpos( $asset['uri'], '://' ) ) {
 383                      continue;
 384                  }
 385  
 386                  $file = $asset['uri'];
 387              }
 388  
 389              $data = bp_parse_args(
 390                  $script,
 391                  array(
 392                      'dependencies' => array(),
 393                      'version'      => $this->version,
 394                      'footer'       => false,
 395                  ),
 396                  'nouveau_register_scripts'
 397              );
 398  
 399              wp_register_script( $handle, $file, $data['dependencies'], $data['version'], $data['footer'] );
 400          }
 401      }
 402  
 403      /**
 404       * Enqueue the required JavaScript files
 405       *
 406       * @since 3.0.0
 407       */
 408  	public function enqueue_scripts() {
 409          wp_enqueue_script( 'bp-nouveau' );
 410  
 411          if ( bp_is_register_page() || bp_is_user_settings_general() ) {
 412              wp_enqueue_script( 'user-profile' );
 413          }
 414  
 415          if ( is_singular() && bp_is_blog_page() && get_option( 'thread_comments' ) ) {
 416              wp_enqueue_script( 'comment-reply' );
 417          }
 418  
 419          /**
 420           * Fires after all of the BuddyPress Nouveau scripts have been enqueued.
 421           *
 422           * @since 3.0.0
 423           */
 424          do_action( 'bp_nouveau_enqueue_scripts' );
 425      }
 426  
 427      /**
 428       * Adds the no-js class to the body tag.
 429       *
 430       * This function ensures that the <body> element will have the 'no-js' class by default. If you're
 431       * using JavaScript for some visual functionality in your theme, and you want to provide noscript
 432       * support, apply those styles to body.no-js.
 433       *
 434       * The no-js class is removed by the JavaScript created in buddypress.js.
 435       *
 436       * @since 3.0.0
 437       *
 438       * @param array $classes Array of classes to append to body tag.
 439       *
 440       * @return array $classes
 441       */
 442  	public function add_nojs_body_class( $classes ) {
 443          $classes[] = 'no-js';
 444          return array_unique( $classes );
 445      }
 446  
 447      /**
 448       * Load localizations for topic script.
 449       *
 450       * These localizations require information that may not be loaded even by init.
 451       *
 452       * @since 3.0.0
 453       */
 454  	public function localize_scripts() {
 455          $params = array(
 456              'ajaxurl'             => bp_core_ajax_url(),
 457              'confirm'             => __( 'Are you sure?', 'buddypress' ),
 458  
 459              /* translators: %s: number of activity comments */
 460              'show_x_comments'     => __( 'Show all %d comments', 'buddypress' ),
 461              'unsaved_changes'     => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
 462              'object_nav_parent'   => '#buddypress',
 463          );
 464  
 465          // If the Object/Item nav are in the sidebar.
 466          if ( bp_nouveau_is_object_nav_in_sidebar() ) {
 467              $params['object_nav_parent'] = '.buddypress_object_nav';
 468          }
 469  
 470          /**
 471           * Filters the supported BuddyPress Nouveau components.
 472           *
 473           * @since 3.0.0
 474           *
 475           * @param array $value Array of supported components.
 476           */
 477          $supported_objects = (array) apply_filters( 'bp_nouveau_supported_components', bp_core_get_packaged_component_ids() );
 478          $object_nonces     = array();
 479  
 480          foreach ( $supported_objects as $key_object => $object ) {
 481              if ( ! bp_is_active( $object ) || 'forums' === $object ) {
 482                  unset( $supported_objects[ $key_object ] );
 483                  continue;
 484              }
 485  
 486              $object_nonces[ $object ] = wp_create_nonce( 'bp_nouveau_' . $object );
 487          }
 488  
 489          // Groups require some additional objects.
 490          if ( bp_is_active( 'groups' ) ) {
 491              $supported_objects = array_merge( $supported_objects, array( 'group_members', 'group_requests' ) );
 492          }
 493  
 494          // Add components & nonces.
 495          $params['objects'] = $supported_objects;
 496          $params['nonces']  = $object_nonces;
 497  
 498          // Used to transport the settings inside the Ajax requests.
 499          if ( is_customize_preview() ) {
 500              $params['customizer_settings'] = bp_nouveau_get_temporary_setting( 'any' );
 501          }
 502  
 503          /**
 504           * Filters core JavaScript strings for internationalization before AJAX usage.
 505           *
 506           * @since 3.0.0
 507           *
 508           * @param array $params Array of key/value pairs for AJAX usage.
 509           */
 510          wp_localize_script( 'bp-nouveau', 'BP_Nouveau', apply_filters( 'bp_core_get_js_strings', $params ) );
 511      }
 512  
 513      /**
 514       * Filter the default theme compatibility root template hierarchy, and prepend
 515       * a page template to the front if it's set.
 516       *
 517       * @see https://buddypress.trac.wordpress.org/ticket/6065
 518       *
 519       * @since 3.0.0
 520       *
 521       * @param array $templates Array of templates.
 522       *
 523       * @return array
 524       */
 525  	public function theme_compat_page_templates( $templates = array() ) {
 526          /**
 527           * Filters whether or not we are looking at a directory to determine if to return early.
 528           *
 529           * @since 3.0.0
 530           *
 531           * @param bool $value Whether or not we are viewing a directory.
 532           */
 533          if ( true === (bool) apply_filters( 'bp_nouveau_theme_compat_page_templates_directory_only', ! bp_is_directory() ) ) {
 534              return $templates;
 535          }
 536  
 537          // No page ID yet.
 538          $page_id = 0;
 539  
 540          // Get the WordPress Page ID for the current view.
 541          foreach ( (array) buddypress()->pages as $component => $bp_page ) {
 542  
 543              // Handles the majority of components.
 544              if ( bp_is_current_component( $component ) ) {
 545                  $page_id = (int) $bp_page->id;
 546              }
 547  
 548              // Stop if not on a user page.
 549              if ( ! bp_is_user() && ! empty( $page_id ) ) {
 550                  break;
 551              }
 552  
 553              // The Members component requires an explicit check due to overlapping components.
 554              if ( bp_is_user() && ( 'members' === $component ) ) {
 555                  $page_id = (int) $bp_page->id;
 556                  break;
 557              }
 558          }
 559  
 560          // Bail if no directory page set.
 561          if ( 0 === $page_id ) {
 562              return $templates;
 563          }
 564  
 565          // Check for page template.
 566          $page_template = get_page_template_slug( $page_id );
 567  
 568          // Add it to the beginning of the templates array so it takes precedence over the default hierarchy.
 569          if ( ! empty( $page_template ) ) {
 570  
 571              /**
 572               * Check for existence of template before adding it to template
 573               * stack to avoid accidentally including an unintended file.
 574               *
 575               * @see https://buddypress.trac.wordpress.org/ticket/6190
 576               */
 577              if ( '' !== locate_template( $page_template ) ) {
 578                  array_unshift( $templates, $page_template );
 579              }
 580          }
 581  
 582          return $templates;
 583      }
 584  
 585      /**
 586       * Add our special 'buddypress' div wrapper to the theme compat template part.
 587       *
 588       * @since 3.0.0
 589       *
 590       * @see bp_buffer_template_part()
 591       *
 592       * @param string $retval Current template part contents.
 593       *
 594       * @return string
 595       */
 596  	public function theme_compat_wrapper( $retval ) {
 597          if ( false !== strpos( $retval, '<div id="buddypress"' ) ) {
 598              return $retval;
 599          }
 600  
 601          // Add our 'buddypress' div wrapper.
 602          return sprintf(
 603              '<div id="buddypress" class="%1$s">%2$s</div><!-- #buddypress -->%3$s',
 604              esc_attr( bp_nouveau_get_container_classes() ),
 605              $retval,  // Constructed HTML.
 606              "\n"
 607          );
 608      }
 609  
 610      /**
 611       * Define the directory nav items
 612       *
 613       * @since 3.0.0
 614       */
 615  	public function setup_directory_nav() {
 616          $nav_items = array();
 617  
 618          if ( bp_is_members_directory() ) {
 619              $nav_items = bp_nouveau_get_members_directory_nav_items();
 620          } elseif ( bp_is_activity_directory() ) {
 621              $nav_items = bp_nouveau_get_activity_directory_nav_items();
 622          } elseif ( bp_is_groups_directory() ) {
 623              $nav_items = bp_nouveau_get_groups_directory_nav_items();
 624          } elseif ( bp_is_blogs_directory() ) {
 625              $nav_items = bp_nouveau_get_blogs_directory_nav_items();
 626          }
 627  
 628          if ( empty( $nav_items ) ) {
 629              return;
 630          }
 631  
 632          foreach ( $nav_items as $nav_item ) {
 633              if ( empty( $nav_item['component'] ) || $nav_item['component'] !== bp_current_component() ) {
 634                  continue;
 635              }
 636  
 637              // Define the primary nav for the current component's directory.
 638              $this->directory_nav->add_nav( $nav_item );
 639          }
 640      }
 641  
 642      /**
 643       * We'll handle template notices from BP Nouveau.
 644       *
 645       * @since 3.0.0
 646       */
 647  	public function neutralize_core_template_notices() {
 648          remove_action( 'template_notices', 'bp_core_render_message' );
 649      }
 650  
 651      /**
 652       * Set the BP Uri for the customizer in case of Ajax requests.
 653       *
 654       * @since 3.0.0
 655       *
 656       * @param  string $path the BP Uri.
 657       * @return string       the BP Uri.
 658       */
 659  	public function customizer_set_uri( $path ) {
 660          if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
 661              return $path;
 662          }
 663  
 664          $uri = parse_url( $path );
 665  
 666          if ( false === strpos( $uri['path'], 'customize.php' ) ) {
 667              return $path;
 668          } else {
 669              $vars = bp_parse_args(
 670                  $uri['query'],
 671                  array(),
 672                  'customizer_set_uri'
 673              );
 674  
 675              if ( ! empty( $vars['url'] ) ) {
 676                  $path = str_replace( get_site_url(), '', urldecode( $vars['url'] ) );
 677              }
 678          }
 679  
 680          return $path;
 681      }
 682      /**
 683       * Modify "registration disabled" message in Nouveau template pack.
 684       * Modify welcome message in Nouveau template pack.
 685       *
 686       * @since 8.0.0
 687       *
 688       * @param array $messages The list of feedback messages.
 689       *
 690       * @return array $messages
 691       */
 692  	function filter_registration_messages( $messages ) {
 693          // Change the "registration is disabled" message.
 694          $disallowed_message = bp_members_invitations_get_modified_registration_disabled_message();
 695          if ( $disallowed_message ) {
 696              $messages['registration-disabled']['message'] = $disallowed_message;
 697          }
 698  
 699          // Add information about invitations to the welcome block.
 700          $welcome_message = bp_members_invitations_get_registration_welcome_message();
 701          if ( $welcome_message ) {
 702              $messages['request-details']['message'] = $welcome_message . ' ' . $messages['request-details']['message'];
 703          }
 704  
 705          return $messages;
 706      }
 707  }
 708  
 709  /**
 710   * Get a unique instance of BP Nouveau
 711   *
 712   * @since 3.0.0
 713   *
 714   * @return BP_Nouveau the main instance of the class
 715   */
 716  function bp_nouveau() {
 717      return BP_Nouveau::get_instance();
 718  }
 719  
 720  /**
 721   * Launch BP Nouveau!
 722   */
 723  bp_nouveau();


Generated: Mon Jul 26 01:01:36 2021 Cross-referenced by PHPXref 0.7.1