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


Generated: Sun Oct 24 01:00:54 2021 Cross-referenced by PHPXref 0.7.1