[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/classes/ -> class-bp-admin.php (source)

   1  <?php
   2  /**
   3   * Main BuddyPress Admin Class.
   4   *
   5   * @package BuddyPress
   6   * @subpackage CoreAdministration
   7   * @since 1.0.0
   8   */
   9  
  10  // Exit if accessed directly.
  11  defined( 'ABSPATH' ) || exit;
  12  
  13  if ( !class_exists( 'BP_Admin' ) ) :
  14  
  15  /**
  16   * Load BuddyPress plugin admin area.
  17   *
  18   * @todo Break this apart into each applicable Component.
  19   *
  20   * @since 1.6.0
  21   */
  22  class BP_Admin {
  23  
  24      /** Directory *************************************************************/
  25  
  26      /**
  27       * Path to the BuddyPress admin directory.
  28       *
  29       * @since 1.6.0
  30       * @var string $admin_dir
  31       */
  32      public $admin_dir = '';
  33  
  34      /** URLs ******************************************************************/
  35  
  36      /**
  37       * URL to the BuddyPress admin directory.
  38       *
  39       * @since 1.6.0
  40       * @var string $admin_url
  41       */
  42      public $admin_url = '';
  43  
  44      /**
  45       * URL to the BuddyPress images directory.
  46       *
  47       * @since 1.6.0
  48       * @var string $images_url
  49       */
  50      public $images_url = '';
  51  
  52      /**
  53       * URL to the BuddyPress admin CSS directory.
  54       *
  55       * @since 1.6.0
  56       * @var string $css_url
  57       */
  58      public $css_url = '';
  59  
  60      /**
  61       * URL to the BuddyPress admin JS directory.
  62       *
  63       * @since 1.6.0
  64       * @var string
  65       */
  66      public $js_url = '';
  67  
  68      /** Other *****************************************************************/
  69  
  70      /**
  71       * Notices used for user feedback, like saving settings.
  72       *
  73       * @since 1.9.0
  74       * @var array()
  75       */
  76      public $notices = array();
  77  
  78      /** Methods ***************************************************************/
  79  
  80      /**
  81       * The main BuddyPress admin loader.
  82       *
  83       * @since 1.6.0
  84       *
  85       */
  86  	public function __construct() {
  87          $this->setup_globals();
  88          $this->includes();
  89          $this->setup_actions();
  90      }
  91  
  92      /**
  93       * Set admin-related globals.
  94       *
  95       * @since 1.6.0
  96       */
  97  	private function setup_globals() {
  98          $bp = buddypress();
  99  
 100          // Paths and URLs
 101          $this->admin_dir  = trailingslashit( $bp->plugin_dir  . 'bp-core/admin' ); // Admin path.
 102          $this->admin_url  = trailingslashit( $bp->plugin_url  . 'bp-core/admin' ); // Admin url.
 103          $this->images_url = trailingslashit( $this->admin_url . 'images'        ); // Admin images URL.
 104          $this->css_url    = trailingslashit( $this->admin_url . 'css'           ); // Admin css URL.
 105          $this->js_url     = trailingslashit( $this->admin_url . 'js'            ); // Admin css URL.
 106  
 107          // Main settings page.
 108          $this->settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
 109  
 110          // Main capability.
 111          $this->capability = bp_core_do_network_admin() ? 'manage_network_options' : 'manage_options';
 112      }
 113  
 114      /**
 115       * Include required files.
 116       *
 117       * @since 1.6.0
 118       */
 119  	private function includes() {
 120          require( $this->admin_dir . 'bp-core-admin-actions.php'    );
 121          require( $this->admin_dir . 'bp-core-admin-settings.php'   );
 122          require( $this->admin_dir . 'bp-core-admin-functions.php'  );
 123          require( $this->admin_dir . 'bp-core-admin-components.php' );
 124          require( $this->admin_dir . 'bp-core-admin-slugs.php'      );
 125          require( $this->admin_dir . 'bp-core-admin-tools.php'      );
 126          require( $this->admin_dir . 'bp-core-admin-optouts.php'    );
 127      }
 128  
 129      /**
 130       * Set up the admin hooks, actions, and filters.
 131       *
 132       * @since 1.6.0
 133       *
 134       */
 135  	private function setup_actions() {
 136  
 137          /* General Actions ***************************************************/
 138  
 139          // Add some page specific output to the <head>.
 140          add_action( 'bp_admin_head',            array( $this, 'admin_head'  ), 999 );
 141  
 142          // Add menu item to settings menu.
 143          add_action( 'admin_menu',               array( $this, 'site_admin_menus' ), 5 );
 144          add_action( bp_core_admin_hook(),       array( $this, 'admin_menus' ), 5 );
 145  
 146          // Enqueue all admin JS and CSS.
 147          add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_styles' ), 1 );
 148          add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_scripts' ), 1 );
 149          add_action( 'bp_admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 150  
 151          /* BuddyPress Actions ************************************************/
 152  
 153          // Load the BuddyPress metabox in the WP Nav Menu Admin UI.
 154          add_action( 'load-nav-menus.php', 'bp_admin_wp_nav_menu_meta_box' );
 155  
 156          // Add settings.
 157          add_action( 'bp_register_admin_settings', array( $this, 'register_admin_settings' ) );
 158  
 159          // Add a link to BuddyPress Hello in the admin bar.
 160          add_action( 'admin_bar_menu', array( $this, 'admin_bar_about_link' ), 100 );
 161  
 162          // Add a description of new BuddyPress tools in the available tools page.
 163          add_action( 'tool_box',            'bp_core_admin_available_tools_intro' );
 164          add_action( 'bp_network_tool_box', 'bp_core_admin_available_tools_intro' );
 165  
 166          // On non-multisite, catch.
 167          add_action( 'load-users.php', 'bp_core_admin_user_manage_spammers' );
 168  
 169          // Emails.
 170          add_filter( 'manage_' . bp_get_email_post_type() . '_posts_columns',       array( $this, 'emails_register_situation_column' ) );
 171          add_action( 'manage_' . bp_get_email_post_type() . '_posts_custom_column', array( $this, 'emails_display_situation_column_data' ), 10, 2 );
 172  
 173          // Privacy Policy.
 174          add_action( 'bp_admin_init', array( $this, 'add_privacy_policy_content' ) );
 175  
 176          // BuddyPress Hello.
 177          add_action( 'admin_footer', array( $this, 'about_screen' ) );
 178  
 179          // BuddyPress Types administration.
 180          add_action( 'load-edit-tags.php', array( 'BP_Admin_Types', 'register_types_admin' ) );
 181  
 182          /* Filters ***********************************************************/
 183  
 184          // Add link to settings page.
 185          add_filter( 'plugin_action_links',               array( $this, 'modify_plugin_action_links' ), 10, 2 );
 186          add_filter( 'network_admin_plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 );
 187  
 188          // Add "Mark as Spam" row actions on users.php.
 189          add_filter( 'ms_user_row_actions', 'bp_core_admin_user_row_actions', 10, 2 );
 190          add_filter( 'user_row_actions',    'bp_core_admin_user_row_actions', 10, 2 );
 191  
 192          // Emails
 193          add_filter( 'bp_admin_menu_order', array( $this, 'emails_admin_menu_order' ), 20 );
 194      }
 195  
 196      /**
 197       * Register site- or network-admin nav menu elements.
 198       *
 199       * Contextually hooked to site or network-admin depending on current configuration.
 200       *
 201       * @since 1.6.0
 202       */
 203  	public function admin_menus() {
 204  
 205          // Bail if user cannot moderate.
 206          if ( ! bp_current_user_can( 'manage_options' ) ) {
 207              return;
 208          }
 209  
 210          $hooks = array();
 211  
 212          // Changed in BP 1.6 . See bp_core_admin_backpat_menu().
 213          $hooks[] = add_menu_page(
 214              __( 'BuddyPress', 'buddypress' ),
 215              __( 'BuddyPress', 'buddypress' ),
 216              $this->capability,
 217              'bp-general-settings',
 218              'bp_core_admin_backpat_menu',
 219              'div'
 220          );
 221  
 222          $hooks[] = add_submenu_page(
 223              'bp-general-settings',
 224              __( 'BuddyPress Help', 'buddypress' ),
 225              __( 'Help', 'buddypress' ),
 226              $this->capability,
 227              'bp-general-settings',
 228              'bp_core_admin_backpat_page'
 229          );
 230  
 231          // Add the option pages.
 232          $hooks[] = add_submenu_page(
 233              $this->settings_page,
 234              __( 'BuddyPress Components', 'buddypress' ),
 235              __( 'BuddyPress', 'buddypress' ),
 236              $this->capability,
 237              'bp-components',
 238              'bp_core_admin_components_settings'
 239          );
 240  
 241          $hooks[] = add_submenu_page(
 242              $this->settings_page,
 243              __( 'BuddyPress Pages', 'buddypress' ),
 244              __( 'BuddyPress Pages', 'buddypress' ),
 245              $this->capability,
 246              'bp-page-settings',
 247              'bp_core_admin_slugs_settings'
 248          );
 249  
 250          $hooks[] = add_submenu_page(
 251              $this->settings_page,
 252              __( 'BuddyPress Options', 'buddypress' ),
 253              __( 'BuddyPress Options', 'buddypress' ),
 254              $this->capability,
 255              'bp-settings',
 256              'bp_core_admin_settings'
 257          );
 258  
 259          // Credits.
 260          $hooks[] = add_submenu_page(
 261              $this->settings_page,
 262              __( 'BuddyPress Credits', 'buddypress' ),
 263              __( 'BuddyPress Credits', 'buddypress' ),
 264              $this->capability,
 265              'bp-credits',
 266              array( $this, 'credits_screen' )
 267          );
 268  
 269          // For consistency with non-Multisite, we add a Tools menu in
 270          // the Network Admin as a home for our Tools panel.
 271          if ( is_multisite() && bp_core_do_network_admin() ) {
 272              $tools_parent = 'network-tools';
 273  
 274              $hooks[] = add_menu_page(
 275                  __( 'Tools', 'buddypress' ),
 276                  __( 'Tools', 'buddypress' ),
 277                  $this->capability,
 278                  $tools_parent,
 279                  'bp_core_tools_top_level_item',
 280                  '',
 281                  24 // Just above Settings.
 282              );
 283  
 284              $hooks[] = add_submenu_page(
 285                  $tools_parent,
 286                  __( 'Available Tools', 'buddypress' ),
 287                  __( 'Available Tools', 'buddypress' ),
 288                  $this->capability,
 289                  'available-tools',
 290                  'bp_core_admin_available_tools_page'
 291              );
 292          } else {
 293              $tools_parent = 'tools.php';
 294          }
 295  
 296          $hooks[] = add_submenu_page(
 297              $tools_parent,
 298              __( 'BuddyPress Tools', 'buddypress' ),
 299              __( 'BuddyPress', 'buddypress' ),
 300              $this->capability,
 301              'bp-tools',
 302              'bp_core_admin_tools'
 303          );
 304  
 305          $hooks[] = add_submenu_page(
 306              $tools_parent,
 307              __( 'Manage Opt-outs', 'buddypress' ),
 308              __( 'Manage Opt-outs', 'buddypress' ),
 309              $this->capability,
 310              'bp-optouts',
 311              'bp_core_optouts_admin'
 312          );
 313  
 314          // For network-wide configs, add a link to (the root site's) Emails screen.
 315          if ( is_network_admin() && bp_is_network_activated() ) {
 316              $email_labels = bp_get_email_post_type_labels();
 317              $email_url    = get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() );
 318  
 319              $hooks[] = add_menu_page(
 320                  $email_labels['name'],
 321                  $email_labels['menu_name'],
 322                  $this->capability,
 323                  '',
 324                  '',
 325                  'dashicons-email',
 326                  26
 327              );
 328  
 329              // Hack: change the link to point to the root site's admin, not the network admin.
 330              $GLOBALS['menu'][26][2] = esc_url_raw( $email_url );
 331          }
 332  
 333          foreach( $hooks as $hook ) {
 334              add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
 335          }
 336      }
 337  
 338      /**
 339       * Register site-admin nav menu elements.
 340       *
 341       * @since 2.5.0
 342       */
 343  	public function site_admin_menus() {
 344          if ( ! bp_current_user_can( 'manage_options' ) ) {
 345              return;
 346          }
 347  
 348          $hooks = array();
 349  
 350          // Appearance > Emails.
 351          $hooks[] = add_theme_page(
 352              _x( 'Emails', 'screen heading', 'buddypress' ),
 353              _x( 'Emails', 'screen heading', 'buddypress' ),
 354              $this->capability,
 355              'bp-emails-customizer-redirect',
 356              'bp_email_redirect_to_customizer'
 357          );
 358  
 359          // Emails > Customize.
 360          $hooks[] = add_submenu_page(
 361              'edit.php?post_type=' . bp_get_email_post_type(),
 362              _x( 'Customize', 'email menu label', 'buddypress' ),
 363              _x( 'Customize', 'email menu label', 'buddypress' ),
 364              $this->capability,
 365              'bp-emails-customizer-redirect',
 366              'bp_email_redirect_to_customizer'
 367          );
 368  
 369          foreach( $hooks as $hook ) {
 370              add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
 371          }
 372      }
 373  
 374      /**
 375       * Register the settings.
 376       *
 377       * @since 1.6.0
 378       *
 379       */
 380  	public function register_admin_settings() {
 381  
 382          /* Main Section ******************************************************/
 383  
 384          // Add the main section.
 385          add_settings_section( 'bp_main', __( 'Main Settings', 'buddypress' ), 'bp_admin_setting_callback_main_section', 'buddypress' );
 386  
 387          // Hide toolbar for logged out users setting.
 388          add_settings_field( 'hide-loggedout-adminbar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main' );
 389          register_setting( 'buddypress', 'hide-loggedout-adminbar', 'intval' );
 390  
 391          // Allow account deletion.
 392          add_settings_field( 'bp-disable-account-deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main' );
 393          register_setting( 'buddypress', 'bp-disable-account-deletion', 'intval' );
 394  
 395          // Template pack picker.
 396          add_settings_field( '_bp_theme_package_id', __( 'Template Pack', 'buddypress' ), 'bp_admin_setting_callback_theme_package_id', 'buddypress', 'bp_main', array( 'label_for' => '_bp_theme_package_id' ) );
 397          register_setting( 'buddypress', '_bp_theme_package_id', 'sanitize_text_field' );
 398  
 399          /* Members Section  **************************************************/
 400  
 401          // Add the main section.
 402          add_settings_section( 'bp_members', _x( 'Members Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_members_section', 'buddypress' );
 403  
 404          // Avatars.
 405          add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_members' );
 406          register_setting( 'buddypress', 'bp-disable-avatar-uploads', 'intval' );
 407  
 408          // Cover images.
 409          if ( bp_is_active( 'members', 'cover_image' ) ) {
 410              add_settings_field( 'bp-disable-cover-image-uploads', __( 'Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_cover_image_uploads', 'buddypress', 'bp_members' );
 411              register_setting( 'buddypress', 'bp-disable-cover-image-uploads', 'intval' );
 412          }
 413  
 414          // Community Invitations.
 415          if ( bp_is_active( 'members', 'invitations' ) ) {
 416              add_settings_field( 'bp-enable-members-invitations', __( 'Invitations', 'buddypress' ), 'bp_admin_setting_callback_members_invitations', 'buddypress', 'bp_members' );
 417              register_setting( 'buddypress', 'bp-enable-members-invitations', 'intval' );
 418          }
 419  
 420          /* XProfile Section **************************************************/
 421  
 422          if ( bp_is_active( 'xprofile' ) ) {
 423  
 424              // Add the main section.
 425              add_settings_section( 'bp_xprofile', _x( 'Profile Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' );
 426  
 427              // Profile sync setting.
 428              add_settings_field( 'bp-disable-profile-sync',   __( 'Profile Syncing',  'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile' );
 429              register_setting  ( 'buddypress', 'bp-disable-profile-sync', 'intval' );
 430          }
 431  
 432          /* Groups Section ****************************************************/
 433  
 434          if ( bp_is_active( 'groups' ) ) {
 435  
 436              // Add the main section.
 437              add_settings_section( 'bp_groups', __( 'Groups Settings',  'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
 438  
 439              // Allow subscriptions setting.
 440              add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation',   'buddypress', 'bp_groups' );
 441              register_setting( 'buddypress', 'bp_restrict_group_creation', 'intval' );
 442  
 443              // Allow group avatars.
 444              add_settings_field( 'bp-disable-group-avatar-uploads', __( 'Group Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_avatar_uploads', 'buddypress', 'bp_groups' );
 445              register_setting( 'buddypress', 'bp-disable-group-avatar-uploads', 'intval' );
 446  
 447              // Allow group cover images.
 448              if ( bp_is_active( 'groups', 'cover_image' ) ) {
 449                  add_settings_field( 'bp-disable-group-cover-image-uploads', __( 'Group Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_cover_image_uploads', 'buddypress', 'bp_groups' );
 450                  register_setting( 'buddypress', 'bp-disable-group-cover-image-uploads', 'intval' );
 451              }
 452          }
 453  
 454          /* Activity Section **************************************************/
 455  
 456          if ( bp_is_active( 'activity' ) ) {
 457  
 458              // Add the main section.
 459              add_settings_section( 'bp_activity', __( 'Activity Settings', 'buddypress' ), 'bp_admin_setting_callback_activity_section', 'buddypress' );
 460  
 461              // Activity commenting on post and comments.
 462              add_settings_field( 'bp-disable-blogforum-comments', __( 'Post Comments', 'buddypress' ), 'bp_admin_setting_callback_blogforum_comments', 'buddypress', 'bp_activity' );
 463              register_setting( 'buddypress', 'bp-disable-blogforum-comments', 'bp_admin_sanitize_callback_blogforum_comments' );
 464  
 465              // Activity Heartbeat refresh.
 466              add_settings_field( '_bp_enable_heartbeat_refresh', __( 'Activity auto-refresh', 'buddypress' ), 'bp_admin_setting_callback_heartbeat', 'buddypress', 'bp_activity' );
 467              register_setting( 'buddypress', '_bp_enable_heartbeat_refresh', 'intval' );
 468  
 469              // Allow activity akismet.
 470              if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) {
 471                  add_settings_field( '_bp_enable_akismet', __( 'Akismet', 'buddypress' ), 'bp_admin_setting_callback_activity_akismet', 'buddypress', 'bp_activity' );
 472                  register_setting( 'buddypress', '_bp_enable_akismet', 'intval' );
 473              }
 474          }
 475      }
 476  
 477      /**
 478       * Add a link to BuddyPress Hello to the admin bar.
 479       *
 480       * @since 1.9.0
 481       * @since 3.0.0 Hooked at priority 100 (was 15).
 482       *
 483       * @param WP_Admin_Bar $wp_admin_bar
 484       */
 485  	public function admin_bar_about_link( $wp_admin_bar ) {
 486          if ( ! is_user_logged_in() ) {
 487              return;
 488          }
 489  
 490          $wp_admin_bar->add_node( array(
 491              'parent' => 'wp-logo',
 492              'id'     => 'bp-about',
 493              'title'  => esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ),
 494              'href'   => bp_get_admin_url( '?hello=buddypress' ),
 495              'meta'   => array(
 496                  'class' => 'say-hello-buddypress',
 497              ),
 498          ) );
 499      }
 500  
 501      /**
 502       * Add Settings link to plugins area.
 503       *
 504       * @since 1.6.0
 505       *
 506       * @param array  $links Links array in which we would prepend our link.
 507       * @param string $file  Current plugin basename.
 508       * @return array Processed links.
 509       */
 510  	public function modify_plugin_action_links( $links, $file ) {
 511  
 512          // Return normal links if not BuddyPress.
 513          if ( plugin_basename( buddypress()->basename ) != $file ) {
 514              return $links;
 515          }
 516  
 517          // Add a few links to the existing links array.
 518          return array_merge( $links, array(
 519              'settings' => '<a href="' . esc_url( add_query_arg( array( 'page' => 'bp-components' ), bp_get_admin_url( $this->settings_page ) ) ) . '">' . esc_html__( 'Settings', 'buddypress' ) . '</a>',
 520              'about'    => '<a href="' . esc_url( bp_get_admin_url( '?hello=buddypress' ) ) . '">' . esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ) . '</a>'
 521          ) );
 522      }
 523  
 524      /**
 525       * Add some general styling to the admin area.
 526       *
 527       * @since 1.6.0
 528       */
 529  	public function admin_head() {
 530  
 531          // Settings pages.
 532          remove_submenu_page( $this->settings_page, 'bp-page-settings' );
 533          remove_submenu_page( $this->settings_page, 'bp-settings'      );
 534          remove_submenu_page( $this->settings_page, 'bp-credits'       );
 535  
 536          // Network Admin Tools.
 537          remove_submenu_page( 'network-tools', 'network-tools' );
 538  
 539          // About and Credits pages.
 540          remove_submenu_page( 'index.php', 'bp-about'   );
 541          remove_submenu_page( 'index.php', 'bp-credits' );
 542  
 543          // Nonmembers Opt-outs page.
 544          if ( is_network_admin() ) {
 545              remove_submenu_page( 'network-tools', 'bp-optouts' );
 546          } else {
 547              remove_submenu_page( 'tools.php', 'bp-optouts' );
 548          }
 549      }
 550  
 551      /**
 552       * Add some general styling to the admin area.
 553       *
 554       * @since 1.6.0
 555       */
 556  	public function enqueue_scripts() {
 557          wp_enqueue_style( 'bp-admin-common-css' );
 558  
 559          // BuddyPress Hello.
 560          if ( 0 === strpos( get_current_screen()->id, 'dashboard' ) && ! empty( $_GET['hello'] ) && $_GET['hello'] === 'buddypress' ) {
 561              wp_enqueue_style( 'bp-hello-css' );
 562              wp_enqueue_script( 'bp-hello-js' );
 563              wp_localize_script( 'bp-hello-js', 'bpHelloStrings', array(
 564                  'pageNotFound' => __( 'Sorry, the page you requested was not found.', 'buddypress' ),
 565                  'modalLabel'   => __( 'Hello BuddyPress', 'buddypress' ),
 566              ) );
 567          }
 568      }
 569  
 570      /**
 571       * Registers BuddyPress's suggested privacy policy language.
 572       *
 573       * @since 4.0.0
 574       */
 575  	public function add_privacy_policy_content() {
 576          // Nothing to do if we're running < WP 4.9.6.
 577          if ( bp_is_running_wp( '4.9.6', '<' ) ) {
 578              return;
 579          }
 580  
 581          $suggested_text = '<strong class="privacy-policy-tutorial">' . esc_html__( 'Suggested text:', 'buddypress' ) . ' </strong>';
 582          $content = '';
 583  
 584          $content .= '<div class="wp-suggested-text">';
 585  
 586          $content .= '<h2>' . esc_html__( 'What personal data we collect and why we collect it', 'buddypress' ) . '</h2>';
 587          $content .= '<p class="privacy-policy-tutorial">' . esc_html__( 'Sites powered by BuddyPress rely heavily on user-provided data. In this section, you should note what data you collect, from both registered users and anonymous visitors.', 'buddypress' ) . '</p>';
 588  
 589          if ( bp_is_active( 'xprofile' ) ) {
 590              $content .= '<h3>' . esc_html__( 'Profile Data', 'buddypress' ) . '</h3>';
 591              $content .= '<p class="privacy-policy-tutorial">' . esc_html__( 'In this section you should note what information is collected on user profiles. The suggested text gives an overview of the kinds of profile data collected by BuddyPress.', 'buddypress' ) . '</p>';
 592  
 593              $content .= '<p>' . $suggested_text . esc_html__( 'When you register for the site, you may be asked to provide certain personal data for display on your profile. The "Name" field is required as well as public, and user profiles are visible to any site visitor. Other profile information may be required or optional, as configured by the site administrator.', 'buddypress' ) . '</p>';
 594              $content .= '<p>' . esc_html__( 'User information provided during account registration can be modified or removed on the Profile > Edit panel. In most cases, users also have control over who is able to view a particular piece of profile content, limiting visibility on a field-by-field basis to friends, logged-in users, or administrators only. Site administrators can read and edit all profile data for all users.', 'buddypress' ) . '</p>';
 595          }
 596  
 597          if ( bp_is_active( 'activity' ) ) {
 598              $content .= '<h3>' . esc_html__( 'Activity', 'buddypress' ) . '</h3>';
 599              $content .= '<p class="privacy-policy-tutorial">' . esc_html__( 'In this section you should describe the kinds of information collected in the activity stream, how and whether it can be edited or deleted, and to whom the activity is visible.', 'buddypress' ) . '</p>';
 600  
 601              $content .= '<p>' . $suggested_text . esc_html__( 'This site records certain user actions, in the form of "activity" data. Activity includes updates and comments posted directly to activity streams, as well as descriptions of other actions performed while using the site, such as new friendships, newly joined groups, and profile updates.', 'buddypress' ) . '</p>';
 602              $content .= '<p>' . esc_html__( 'The content of activity items obey the same privacy rules as the contexts in which the activity items are created. For example, activity updates created in a user\'s profile is publicly visible, while activity items generated in a private group are visible only to members of that group. Site administrators can view all activity items, regardless of context.', 'buddypress' ) . '</p>';
 603              $content .= '<p>' . esc_html__( 'Activity items may be deleted at any time by users who created them. Site administrators can edit all activity items.', 'buddypress' ) . '</p>';
 604          }
 605  
 606          if ( bp_is_active( 'messages' ) ) {
 607              $content .= '<h3>' . esc_html__( 'Messages', 'buddypress' ) . '</h3>';
 608              $content .= '<p class="privacy-policy-tutorial">' . esc_html__( 'In this section you should describe any personal data related to private messages.', 'buddypress' ) . '</p>';
 609  
 610              $content .= '<p>' . $suggested_text . esc_html__( 'The content of private messages is visible only to the sender and the recipients of the message. With the exception of site administrators, who can read all private messages, private message content is never visible to other users or site visitors. Site administrators may delete the content of any message.', 'buddypress' ) . '</p>';
 611          }
 612  
 613          $content .= '<h3>' . esc_html__( 'Cookies', 'buddypress' ) . '</h3>';
 614          $content .= '<p class="privacy-policy-tutorial">' . esc_html__( 'In this section you should describe the BuddyPress-specific cookies that your site collects. The suggested text describes the default cookies.', 'buddypress' ) . '</p>';
 615  
 616          $content .= '<p>' . $suggested_text . esc_html__( 'We use a cookie to show success and failure messages to logged-in users, in response to certain actions, like joining a group. These cookies contain no personal data, and are deleted immediately after the next page load.', 'buddypress' ) . '</p>';
 617  
 618          $content .= '<p>' . esc_html__( 'We use cookies on group, member, and activity directories to keep track of a user\'s browsing preferences. These preferences include the last-selected values of the sort and filter dropdowns, as well as pagination information. These cookies contain no personal data, and are deleted after 24 hours.', 'buddypress' ) . '</p>';
 619  
 620          if ( bp_is_active( 'groups' ) ) {
 621              $content .= '<p>' . esc_html__( 'When a logged-in user creates a new group, we use a number of cookies to keep track of the group creation process. These cookies contain no personal data, and are deleted either upon the successful creation of the group or after 24 hours.', 'buddypress' ) . '</p>';
 622          }
 623  
 624          $content .= '</div><!-- .wp-suggested-text -->';
 625  
 626          wp_add_privacy_policy_content(
 627              'BuddyPress',
 628              wp_kses_post( wpautop( $content, false ) )
 629          );
 630      }
 631  
 632      /** About *****************************************************************/
 633  
 634      /**
 635       * Output the BuddyPress Hello template.
 636       *
 637       * @since 1.7.0 Screen content.
 638       * @since 3.0.0 Now outputs BuddyPress Hello template.
 639       */
 640  	public function about_screen() {
 641          if ( 0 !== strpos( get_current_screen()->id, 'dashboard' ) || empty( $_GET['hello'] ) || $_GET['hello'] !== 'buddypress' ) {
 642              return;
 643          }
 644  
 645          // Get BuddyPress stable version.
 646          $version      =  self::display_version();
 647          $version_slug = 'version-' . str_replace( '.', '-', $version );
 648      ?>
 649  
 650          <div id="bp-hello-container">
 651              <div id="plugin-information-scrollable" role="document">
 652                  <div id='plugin-information-title' class="with-banner">
 653                      <div class='vignette'></div>
 654                      <h1>
 655                          <?php printf(
 656                              /* translators: %s is the placeholder for the BuddyPress version number. */
 657                              esc_html__( 'BuddyPress %s', 'buddypress' ),
 658                              $version
 659                          ); ?>
 660                      </h1>
 661                  </div>
 662                  <div id="plugin-information-tabs">
 663                      <a name="whats-new" href="#whats-new" class="current"><?php esc_html_e( 'What\'s new?', 'buddypress' ); ?></a>
 664                      <a name="changelog" href="#changelog" class="dynamic" data-slug="<?php echo esc_attr( $version_slug ); ?>" data-endpoint="https://codex.buddypress.org/wp-json/wp/v2/pages"><?php esc_html_e( 'Changelog', 'buddypress' ); ?></a>
 665                      <a name="get-involved" href="#get-involved" class="dynamic" data-slug="participate-and-contribute" data-endpoint="https://codex.buddypress.org/wp-json/wp/v2/pages"><?php esc_html_e( 'Get involved', 'buddypress' ); ?></a>
 666                  </div>
 667  
 668                  <div class="bp-hello-content">
 669                      <div id="dynamic-content"></div>
 670                      <div id="top-features">
 671                          <h2><?php esc_html_e( 'It’s all about Widget Blocks!', 'buddypress' ); ?></h2>
 672                          <figure class="bp-hello-aligncenter">
 673                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/latest-activities.jpg' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Latest Activities Widget Block.', 'buddypress' ); ?>" />
 674                          </figure>
 675                          <p>
 676                              <?php esc_html_e( 'WordPress 5.8 is right around the corner and debuts a brand new way to manage widgets: the Widget Block Editor. With BuddyPress 9.0.0, we have introduced 10 new BuddyPress Blocks, so you can continue to use your favorite BP Widgets with the new WP Block approach.', 'buddypress' ); ?>
 677                          </p>
 678                          <p>
 679                              <?php esc_html_e( 'The new BP Widget Blocks are simply Legacy Widgets we’ve rebuilt as BP Blocks, which means you can also access them in the Block Editor for use in your posts or pages!', 'buddypress' ); ?>
 680                          </p>
 681                          <figure class="bp-hello-aligncenter">
 682                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-widget-blocks.jpg' ); ?>" alt="<?php esc_attr_e( 'Illustration showing BP Blocks collection.', 'buddypress' ); ?>" />
 683                          </figure>
 684                          <p>
 685                              <em><?php esc_html_e( 'PS: Have you noticed that the icons for BuddyPress Blocks are now bright red?', 'buddypress' ); ?></em>
 686                          </p>
 687                          <h3>
 688                              <?php
 689                              printf(
 690                                  /* Translators: %s is a smiling face with sunglasses emoji. */
 691                                  esc_html__( 'Convert a Legacy Widget into a Block Widget in two clicks %s', 'buddypress' ),
 692                                  wp_staticize_emoji( '😎' )
 693                              );
 694                              ?>
 695                          </h3>
 696                          <figure class="bp-hello-aligncenter">
 697                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/legacy-widget-to-block.jpg' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Legacy Widget to Widget Block transformation.', 'buddypress' ); ?>" />
 698                          </figure>
 699                          <p>
 700                              <?php esc_html_e( 'As shown in the image above, it’s very easy to transform a Widget into a Block. Your existing Widget settings will automagically be imported into your shiny, new BP Block.', 'buddypress' ); ?>
 701                          </p>
 702                          <p>
 703                              <?php esc_html_e( 'NB: Creating a BP Block for each existing BP Legacy Widget marks the first step toward the progressive retirement of these tiny pieces of BuddyPress content.', 'buddypress' ); ?>
 704                          </p>
 705  
 706                          <hr class="bp-hello-divider"/>
 707  
 708                          <h2><?php esc_html_e( 'The BP REST API:  Improved endpoints and a new one!', 'buddypress' ); ?></h2>
 709                          <p>
 710                              <?php esc_html_e( 'This BuddyPress release was built in a short time frame to be ready for the release of WordPress 5.8.', 'buddypress' ); ?>
 711                          </p>
 712                          <p>
 713                              <?php esc_html_e( 'While doing the work on BP Widget Blocks, we’ve also manipulated many of our REST API endpoints and took this opportunity to improve several of them. We’re also introducing a new Sitewide Notices endpoint to allow site admins to create, edit, or delete notices and let all of your users fetch the active notice.', 'buddypress' ); ?>
 714                          </p>
 715  
 716                          <hr class="bp-hello-divider"/>
 717  
 718                          <h2><?php esc_html_e( 'Under the hood', 'buddypress' ); ?></h2>
 719                          <p>
 720                              <?php esc_html_e( '9.0.0 comes with fewer changes than most of our releases but includes fixes for issues which appeared in 8.0.0 and BP Nouveau Template Pack improvements.', 'buddypress' ); ?>
 721                              <?php esc_html_e( 'Click on the "Changelog" tab to discover them all!', 'buddypress' ); ?>
 722                          </p>
 723                          <figure class="bp-hello-aligncenter">
 724                              <div class="dashicons dashicons-buddicons-buddypress-logo big"></div>
 725                          </figure>
 726  
 727                          <hr class="bp-hello-divider"/>
 728  
 729                          <h2><?php echo esc_html( _x( 'Your feedback', 'screen heading', 'buddypress' ) ); ?></h2>
 730                          <p>
 731                              <?php esc_html_e( 'How are you using BuddyPress? Receiving your feedback and suggestions for future versions of BuddyPress genuinely motivates and encourages our contributors.', 'buddypress' ); ?>
 732                              <?php
 733                              printf(
 734                                  /* translators: %s is the placeholder for the link to BuddyPress support forums. */
 735                                  esc_html__( 'Please %s about this version of BuddyPress on our website.', 'buddypress' ),
 736                                  sprintf(
 737                                      '<a href="%1$s">%2$s</a>',
 738                                      esc_url( 'https://buddypress.org/support/' ),
 739                                      esc_html__( 'share your feedback', 'buddypress' )
 740                                  )
 741                              );
 742                              ?>
 743                          </p>
 744                          <p>
 745                              <?php
 746                                  printf(
 747                                      /* Translators: %s is a hugging face emoji. */
 748                                      esc_html__( 'Thank you for using BuddyPress! %s', 'buddypress' ),
 749                                      wp_staticize_emoji( '🤗' )
 750                                  );
 751                              ?>
 752                          </p>
 753  
 754                          <br /><br />
 755                      </div>
 756                  </div>
 757              </div>
 758              <div id="plugin-information-footer">
 759                  <div class="bp-hello-social-cta">
 760                      <p>
 761                          <?php
 762                          printf(
 763                              /* translators: 1: heart dashicons. 2: BP Credits screen url. 3: number of BuddyPress contributors to this version. */
 764                              _n( 'Built with %1$s by <a href="%2$s">%3$d volunteer</a>.', 'Built with %1$s by <a href="%2$s">%3$d volunteers</a>.', 24, 'buddypress' ),
 765                              '<span class="dashicons dashicons-heart"></span>',
 766                              esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
 767                              number_format_i18n( 24 )
 768                          );
 769                          ?>
 770                      </p>
 771                  </div>
 772  
 773                  <div class="bp-hello-social-links">
 774                      <ul class="bp-hello-social">
 775                          <li>
 776                              <?php
 777                              printf(
 778                                  '<a class="twitter bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 779                                  esc_attr__( 'Follow BuddyPress on Twitter', 'buddypress' ),
 780                                  esc_url( 'https://twitter.com/buddypress' ),
 781                                  esc_html__( 'Follow BuddyPress on Twitter', 'buddypress' )
 782                              );
 783                              ?>
 784                          </li>
 785  
 786                          <li>
 787                              <?php
 788                              printf(
 789                                  '<a class="support bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 790                                  esc_attr__( 'Visit the Support Forums', 'buddypress' ),
 791                                  esc_url( 'https://buddypress.org/support/' ),
 792                                  esc_html__( 'Visit the Support Forums', 'buddypress' )
 793                              );
 794                              ?>
 795                          </li>
 796                      </ul>
 797                  </div>
 798              </div>
 799          </div>
 800  
 801          <?php
 802      }
 803  
 804      /**
 805       * Output the credits screen.
 806       *
 807       * Hardcoding this in here is pretty janky. It's fine for now, but we'll
 808       * want to leverage api.wordpress.org eventually.
 809       *
 810       * @since 1.7.0
 811       */
 812  	public function credits_screen() {
 813      ?>
 814  
 815          <div class="wrap bp-about-wrap">
 816  
 817          <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?></h1>
 818          <hr class="wp-header-end">
 819  
 820          <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Credits', 'buddypress' ) ); ?></h2>
 821  
 822              <p class="about-description"><?php esc_html_e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p>
 823  
 824              <h3 class="wp-people-group"><?php esc_html_e( 'Project Leaders', 'buddypress' ); ?></h3>
 825              <ul class="wp-people-group " id="wp-people-group-project-leaders">
 826                  <li class="wp-person" id="wp-person-johnjamesjacoby">
 827                      <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7a2644fb53ae2f7bfd7143b504af396c?s=120">
 828                      John James Jacoby</a>
 829                      <span class="title"><?php esc_html_e( 'Project Lead', 'buddypress' ); ?></span>
 830                  </li>
 831                  <li class="wp-person" id="wp-person-boonebgorges">
 832                      <a class="web" href="https://profiles.wordpress.org/boonebgorges"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=120">
 833                      Boone B. Gorges</a>
 834                      <span class="title"><?php esc_html_e( 'Lead Developer', 'buddypress' ); ?></span>
 835                  </li>
 836                  <li class="wp-person" id="wp-person-djpaul">
 837                      <a class="web" href="https://profiles.wordpress.org/djpaul"><img alt="" class="gravatar" src="https://avatars2.githubusercontent.com/u/1275914?s=120">
 838                      Paul Gibbs</a>
 839                      <span class="title"><?php esc_html_e( 'Lead Developer', 'buddypress' ); ?></span>
 840                  </li>
 841                  <li class="wp-person" id="wp-person-r-a-y">
 842                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3bfa556a62b5bfac1012b6ba5f42ebfa?s=120">
 843                      Ray</a>
 844                      <span class="title"><?php esc_html_e( 'Lead Developer', 'buddypress' ); ?></span>
 845                  </li>
 846                  <li class="wp-person" id="wp-person-imath">
 847                      <a class="web" href="https://profiles.wordpress.org/imath"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8b208ca408dad63888253ee1800d6a03?s=120">
 848                      Mathieu Viet</a>
 849                      <span class="title"><?php esc_html_e( 'Lead Developer', 'buddypress' ); ?></span>
 850                  </li>
 851                  <li class="wp-person" id="wp-person-mercime">
 852                      <a class="web" href="https://profiles.wordpress.org/mercime"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/fae451be6708241627983570a1a1817a?s=120">
 853                      Mercime</a>
 854                      <span class="title"><?php esc_html_e( 'Lead Developer', 'buddypress' ); ?></span>
 855                  </li>
 856              </ul>
 857  
 858              <h3 class="wp-people-group"><?php esc_html_e( 'BuddyPress Team', 'buddypress' ); ?></h3>
 859              <ul class="wp-people-group " id="wp-people-group-core-team">
 860                  <li class="wp-person" id="wp-person-hnla">
 861                      <a class="web" href="https://profiles.wordpress.org/hnla"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3860c955aa3f79f13b92826ae47d07fe?s=120">
 862                      Hugo Ashmore</a>
 863                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 864                  </li>
 865                  <li class="wp-person" id="wp-person-dcavins">
 866                      <a class="web" href="https://profiles.wordpress.org/dcavins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5fa7e83d59cb45ebb616235a176595a?s=120">
 867                      David Cavins</a>
 868                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 869                  </li>
 870                  <li class="wp-person" id="wp-person-tw2113">
 871                      <a class="web" href="https://profiles.wordpress.org/tw2113"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5d7c934621fa1c025b83ee79bc62366?s=120">
 872                      Michael Beckwith</a>
 873                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 874                  </li>
 875                  <li class="wp-person" id="wp-person-henry-wright">
 876                      <a class="web" href="https://profiles.wordpress.org/henry.wright"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0da2f1a9340d6af196b870f6c107a248?s=120">
 877                      Henry Wright</a>
 878                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 879                  </li>
 880                  <li class="wp-person" id="wp-person-danbp">
 881                      <a class="web" href="https://profiles.wordpress.org/danbp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0deae2e7003027fbf153500cd3fa5501?s=120">
 882                      danbp</a>
 883                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 884                  </li>
 885                  <li class="wp-person" id="wp-person-shanebp">
 886                      <a class="web" href="https://profiles.wordpress.org/shanebp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ffd294ab5833ba14aaf175f9acc71cc4?s=120">
 887                      shanebp</a>
 888                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 889                  </li>
 890                  <li class="wp-person" id="wp-person-slaffik">
 891                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/61fb07ede3247b63f19015f200b3eb2c?s=120">
 892                      Slava Abakumov</a>
 893                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 894                  </li>
 895                  <li class="wp-person" id="wp-person-offereins">
 896                      <a class="web" href="https://profiles.wordpress.org/Offereins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/2404ed0a35bb41aedefd42b0a7be61c1?s=120">
 897                      Laurens Offereins</a>
 898                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 899                  </li>
 900                  <li class="wp-person" id="wp-person-netweb">
 901                      <a class="web" href="https://profiles.wordpress.org/netweb"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=120">
 902                      Stephen Edgar</a>
 903                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 904                  </li>
 905                  <li class="wp-person" id="wp-person-espellcaste">
 906                      <a class="web" href="https://profiles.wordpress.org/espellcaste"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/b691e67be0ba5cad6373770656686bc3?s=120">
 907                      Renato Alves</a>
 908                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 909                  </li>
 910                  <li class="wp-person" id="wp-person-venutius">
 911                      <a class="web" href="https://profiles.wordpress.org/venutius"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/6a7c42a77fd94b82b217a7a97afdddbc?s=120">
 912                      Venutius</a>
 913                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 914                  </li>
 915              </ul>
 916  
 917              <h3 class="wp-people-group">
 918                  <?php
 919                  printf(
 920                      /* translators: %s: BuddyPress version number */
 921                      esc_html__( 'Noteworthy Contributors to %s', 'buddypress' ),
 922                      self::display_version()
 923                  );
 924                  ?>
 925              </h3>
 926              <ul class="wp-people-group " id="wp-people-group-noteworthy">
 927                  <li class="wp-person" id="wp-person-vapvarun">
 928                      <a class="web" href="https://profiles.wordpress.org/vapvarun"><img alt="" class="gravatar" src="//gravatar.com/avatar/78a3bf7eb3a1132fc667f96f2631e448?s=120">
 929                      Varun Dubey</a>
 930                  </li>
 931                  <li class="wp-person" id="wp-person-sbrajesh">
 932                      <a class="web" href="https://profiles.wordpress.org/sbrajesh/"><img alt="" class="gravatar" src="//gravatar.com/avatar/2106622ee90d53d15ac1402806616aca?s=120">
 933                      Brajesh Singh</a>
 934                  </li>
 935              </ul>
 936  
 937              <h3 class="wp-people-group">
 938                  <?php
 939                  printf(
 940                      /* translators: %s: BuddyPress version number */
 941                      esc_html__( 'All Contributors to BuddyPress %s', 'buddypress' ),
 942                      self::display_version()
 943                  );
 944                  ?>
 945              </h3>
 946              <p class="wp-credits-list">
 947                  <a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
 948                  <a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
 949                  <a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
 950                  <a href="https://profiles.wordpress.org/dancaragea/">Dan Caragea (dancaragea)</a>,
 951                  <a href="https://profiles.wordpress.org/ianbarnes/">Ian Barnes (ianbarnes)</a>,
 952                  <a href="https://profiles.wordpress.org/nobnob/">Javier Esteban (nobnob)</a>,
 953                  <a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
 954                  <a href="https://profiles.wordpress.org/leahkoerper/">leahkoerper</a>,
 955                  <a href="https://profiles.wordpress.org/marbaque/">marbaque</a>,
 956                  <a href="https://profiles.wordpress.org/markscottrobson/">Mark Robson (markscottrobson)</a>,
 957                  <a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
 958                  <a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
 959                  <a href="https://profiles.wordpress.org/niftythree/">Nifty (niftythree)</a>,
 960                  <a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
 961                  <a href="https://profiles.wordpress.org/nekojonez/">Pieterjan Deneys (nekojonez)</a>,
 962                  <a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
 963                  <a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
 964                  <a href="https://profiles.wordpress.org/shanebp">shanebp</a>,
 965                  <a href="https://profiles.wordpress.org/shawfactor/">shawfactor</a>,
 966                  <a href="https://profiles.wordpress.org/slaffik/">Slava Abakumov (slaffik)</a>,
 967                  <a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
 968                  <a href="https://profiles.wordpress.org/tamarazambrana/">tamarazambrana</a>,
 969                  <a href="https://github.com/tkserver">TKServer</a>,
 970                  <a href="https://profiles.wordpress.org/vapvarun/">Varun Dubey (vapvarun)</a>.
 971              </p>
 972  
 973              <h3 class="wp-people-group"><?php esc_html_e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
 974              <p class="wp-credits-list">
 975                  <a href="https://github.com/ichord/At.js">At.js</a>,
 976                  <a href="https://bbpress.org">bbPress</a>,
 977                  <a href="https://github.com/ichord/Caret.js">Caret.js</a>,
 978                  <a href="https://tedgoas.github.io/Cerberus/">Cerberus</a>,
 979                  <a href="https://ionicons.com/">Ionicons</a>,
 980                  <a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
 981                  <a href="https://mattbradley.github.io/livestampjs/">Livestamp.js</a>,
 982                  <a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
 983                  <a href="https://momentjs.com/">Moment.js</a>,
 984                  <a href="https://wordpress.org">WordPress</a>.
 985              </p>
 986  
 987              <h3 class="wp-people-group"><?php esc_html_e( 'Contributor Emeriti', 'buddypress' ); ?></h3>
 988              <ul class="wp-people-group " id="wp-people-group-emeriti">
 989                  <li class="wp-person" id="wp-person-apeatling">
 990                      <a class="web" href="https://profiles.wordpress.org/apeatling/"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=120">
 991                      Andy Peatling</a>
 992                      <span class="title"><?php esc_html_e( 'Project Founder', 'buddypress' ); ?></span>
 993                  </li>
 994                  <li class="wp-person" id="wp-person-burtadsit">
 995                      <a class="web" href="https://profiles.wordpress.org/burtadsit"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/185e1d3e2d653af9d49a4e8e4fc379df?s=120">
 996                      Burt Adsit</a>
 997                  </li>
 998                  <li class="wp-person" id="wp-person-dimensionmedia">
 999                      <a class="web" href="https://profiles.wordpress.org/dimensionmedia"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7735aada1ec39d0c1118bd92ed4551f1?s=120">
1000                      David Bisset</a>
1001                  </li>
1002                  <li class="wp-person" id="wp-person-jeffsayre">
1003                      <a class="web" href="https://profiles.wordpress.org/jeffsayre"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8e009a84ff5d245c22a69c7df6ab45f7?s=120">
1004                      Jeff Sayre</a>
1005                  </li>
1006                  <li class="wp-person" id="wp-person-karmatosed">
1007                      <a class="web" href="https://profiles.wordpress.org/karmatosed"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ca7d4273a689cdbf524d8332771bb1ca?s=120">
1008                      Tammie Lister</a>
1009                  </li>
1010                  <li class="wp-person" id="wp-person-modemlooper">
1011                      <a class="web" href="https://profiles.wordpress.org/modemlooper"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/1c07be1016e845de514931477c939307?s=120">
1012                      modemlooper</a>
1013                  </li>
1014              </ul>
1015          </div>
1016  
1017          <?php
1018      }
1019  
1020      /** Emails ****************************************************************/
1021  
1022      /**
1023       * Registers 'Situations' column on Emails dashboard page.
1024       *
1025       * @since 2.6.0
1026       *
1027       * @param array $columns Current column data.
1028       * @return array
1029       */
1030  	public function emails_register_situation_column( $columns = array() ) {
1031          $situation = array(
1032              'situation' => _x( 'Situations', 'Email post type', 'buddypress' )
1033          );
1034  
1035          // Inject our 'Situations' column just before the last 'Date' column.
1036          return array_slice( $columns, 0, -1, true ) + $situation + array_slice( $columns, -1, null, true );
1037      }
1038  
1039      /**
1040       * Output column data for our custom 'Situations' column.
1041       *
1042       * @since 2.6.0
1043       *
1044       * @param string $column  Current column name.
1045       * @param int    $post_id Current post ID.
1046       */
1047  	public function emails_display_situation_column_data( $column = '', $post_id = 0 ) {
1048          if ( 'situation' !== $column ) {
1049              return;
1050          }
1051  
1052          // Grab email situations for the current post.
1053          $situations = wp_list_pluck( get_the_terms( $post_id, bp_get_email_tax_type() ), 'description' );
1054  
1055          // Output each situation as a list item.
1056          echo '<ul><li>';
1057          echo implode( '</li><li>', $situations );
1058          echo '</li></ul>';
1059      }
1060  
1061      /** Helpers ***************************************************************/
1062  
1063      /**
1064       * Return true/false based on whether a query argument is set.
1065       *
1066       * @see bp_do_activation_redirect()
1067       *
1068       * @since 2.2.0
1069       *
1070       * @return bool
1071       */
1072  	public static function is_new_install() {
1073          return (bool) isset( $_GET['is_new_install'] );
1074      }
1075  
1076      /**
1077       * Return a user-friendly version-number string, for use in translations.
1078       *
1079       * @since 2.2.0
1080       *
1081       * @return string
1082       */
1083  	public static function display_version() {
1084  
1085          // Use static variable to prevent recalculations.
1086          static $display = '';
1087  
1088          // Only calculate on first run.
1089          if ( '' === $display ) {
1090  
1091              // Get current version.
1092              $version = bp_get_version();
1093  
1094              // Check for prerelease hyphen.
1095              $pre     = strpos( $version, '-' );
1096  
1097              // Strip prerelease suffix.
1098              $display = ( false !== $pre )
1099                  ? substr( $version, 0, $pre )
1100                  : $version;
1101          }
1102  
1103          // Done!
1104          return $display;
1105      }
1106  
1107      /**
1108       * Add Emails menu item to custom menus array.
1109       *
1110       * Several BuddyPress components have top-level menu items in the Dashboard,
1111       * which all appear together in the middle of the Dashboard menu. This function
1112       * adds the Emails screen to the array of these menu items.
1113       *
1114       * @since 2.4.0
1115       *
1116       * @param array $custom_menus The list of top-level BP menu items.
1117       * @return array $custom_menus List of top-level BP menu items, with Emails added.
1118       */
1119  	public function emails_admin_menu_order( $custom_menus = array() ) {
1120          array_push( $custom_menus, 'edit.php?post_type=' . bp_get_email_post_type() );
1121  
1122          if ( is_network_admin() && bp_is_network_activated() ) {
1123              array_push(
1124                  $custom_menus,
1125                  get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() )
1126              );
1127          }
1128  
1129          return $custom_menus;
1130      }
1131  
1132      /**
1133       * Register styles commonly used by BuddyPress wp-admin screens.
1134       *
1135       * @since 2.5.0
1136       */
1137  	public function admin_register_styles() {
1138          $min = bp_core_get_minified_asset_suffix();
1139          $url = $this->css_url;
1140  
1141          /**
1142           * Filters the BuddyPress Core Admin CSS file path.
1143           *
1144           * @since 1.6.0
1145           *
1146           * @param string $file File path for the admin CSS.
1147           */
1148          $common_css = apply_filters( 'bp_core_admin_common_css', "{$url}common{$min}.css" );
1149  
1150          /**
1151           * Filters the BuddyPress admin stylesheet files to register.
1152           *
1153           * @since 2.5.0
1154           *
1155           * @param array $value Array of admin stylesheet file information to register.
1156           */
1157          $styles = apply_filters( 'bp_core_admin_register_styles', array(
1158              // Legacy.
1159              'bp-admin-common-css' => array(
1160                  'file'         => $common_css,
1161                  'dependencies' => array(),
1162              ),
1163  
1164              // 2.5
1165              'bp-customizer-controls' => array(
1166                  'file'         => "{$url}customizer-controls{$min}.css",
1167                  'dependencies' => array(),
1168              ),
1169  
1170              // 3.0
1171              'bp-hello-css' => array(
1172                  'file'         => "{$url}hello{$min}.css",
1173                  'dependencies' => array( 'bp-admin-common-css', 'thickbox' ),
1174              ),
1175          ) );
1176  
1177          $version = bp_get_version();
1178  
1179          foreach ( $styles as $id => $style ) {
1180              wp_register_style( $id, $style['file'], $style['dependencies'], $version );
1181              wp_style_add_data( $id, 'rtl', 'replace' );
1182  
1183              if ( $min ) {
1184                  wp_style_add_data( $id, 'suffix', $min );
1185              }
1186          }
1187      }
1188  
1189      /**
1190       * Register JS commonly used by BuddyPress wp-admin screens.
1191       *
1192       * @since 2.5.0
1193       */
1194  	public function admin_register_scripts() {
1195          $min = bp_core_get_minified_asset_suffix();
1196          $url = $this->js_url;
1197  
1198          /**
1199           * Filters the BuddyPress admin JS files to register.
1200           *
1201           * @since 2.5.0
1202           *
1203           * @param array $value Array of admin JS file information to register.
1204           */
1205          $scripts = apply_filters( 'bp_core_admin_register_scripts', array(
1206              // 2.5
1207              'bp-customizer-controls' => array(
1208                  'file'         => "{$url}customizer-controls{$min}.js",
1209                  'dependencies' => array( 'jquery' ),
1210                  'footer'       => true,
1211              ),
1212  
1213              // 3.0
1214              'bp-hello-js' => array(
1215                  'file'         => "{$url}hello{$min}.js",
1216                  'dependencies' => array( 'thickbox', 'bp-api-request' ),
1217                  'footer'       => true,
1218              ),
1219          ) );
1220  
1221          $version = bp_get_version();
1222  
1223          foreach ( $scripts as $id => $script ) {
1224              wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
1225          }
1226      }
1227  }
1228  endif; // End class_exists check.


Generated: Sun Sep 19 01:01:40 2021 Cross-referenced by PHPXref 0.7.1