[ 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      }
 127  
 128      /**
 129       * Set up the admin hooks, actions, and filters.
 130       *
 131       * @since 1.6.0
 132       *
 133       */
 134  	private function setup_actions() {
 135  
 136          /* General Actions ***************************************************/
 137  
 138          // Add some page specific output to the <head>.
 139          add_action( 'bp_admin_head',            array( $this, 'admin_head'  ), 999 );
 140  
 141          // Add menu item to settings menu.
 142          add_action( 'admin_menu',               array( $this, 'site_admin_menus' ), 5 );
 143          add_action( bp_core_admin_hook(),       array( $this, 'admin_menus' ), 5 );
 144  
 145          // Enqueue all admin JS and CSS.
 146          add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_styles' ), 1 );
 147          add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_scripts' ), 1 );
 148          add_action( 'bp_admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 149  
 150          /* BuddyPress Actions ************************************************/
 151  
 152          // Load the BuddyPress metabox in the WP Nav Menu Admin UI.
 153          add_action( 'load-nav-menus.php', 'bp_admin_wp_nav_menu_meta_box' );
 154  
 155          // Add settings.
 156          add_action( 'bp_register_admin_settings', array( $this, 'register_admin_settings' ) );
 157  
 158          // Add a link to BuddyPress Hello in the admin bar.
 159          add_action( 'admin_bar_menu', array( $this, 'admin_bar_about_link' ), 100 );
 160  
 161          // Add a description of new BuddyPress tools in the available tools page.
 162          add_action( 'tool_box',            'bp_core_admin_available_tools_intro' );
 163          add_action( 'bp_network_tool_box', 'bp_core_admin_available_tools_intro' );
 164  
 165          // On non-multisite, catch.
 166          add_action( 'load-users.php', 'bp_core_admin_user_manage_spammers' );
 167  
 168          // Emails.
 169          add_filter( 'manage_' . bp_get_email_post_type() . '_posts_columns',       array( $this, 'emails_register_situation_column' ) );
 170          add_action( 'manage_' . bp_get_email_post_type() . '_posts_custom_column', array( $this, 'emails_display_situation_column_data' ), 10, 2 );
 171  
 172          // Privacy Policy.
 173          add_action( 'bp_admin_init', array( $this, 'add_privacy_policy_content' ) );
 174  
 175          // BuddyPress Hello.
 176          add_action( 'admin_footer', array( $this, 'about_screen' ) );
 177  
 178          /* Filters ***********************************************************/
 179  
 180          // Add link to settings page.
 181          add_filter( 'plugin_action_links',               array( $this, 'modify_plugin_action_links' ), 10, 2 );
 182          add_filter( 'network_admin_plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 );
 183  
 184          // Add "Mark as Spam" row actions on users.php.
 185          add_filter( 'ms_user_row_actions', 'bp_core_admin_user_row_actions', 10, 2 );
 186          add_filter( 'user_row_actions',    'bp_core_admin_user_row_actions', 10, 2 );
 187  
 188          // Emails
 189          add_filter( 'bp_admin_menu_order', array( $this, 'emails_admin_menu_order' ), 20 );
 190      }
 191  
 192      /**
 193       * Register site- or network-admin nav menu elements.
 194       *
 195       * Contextually hooked to site or network-admin depending on current configuration.
 196       *
 197       * @since 1.6.0
 198       */
 199  	public function admin_menus() {
 200  
 201          // Bail if user cannot moderate.
 202          if ( ! bp_current_user_can( 'manage_options' ) ) {
 203              return;
 204          }
 205  
 206          $hooks = array();
 207  
 208          // Changed in BP 1.6 . See bp_core_admin_backpat_menu().
 209          $hooks[] = add_menu_page(
 210              __( 'BuddyPress', 'buddypress' ),
 211              __( 'BuddyPress', 'buddypress' ),
 212              $this->capability,
 213              'bp-general-settings',
 214              'bp_core_admin_backpat_menu',
 215              'div'
 216          );
 217  
 218          $hooks[] = add_submenu_page(
 219              'bp-general-settings',
 220              __( 'BuddyPress Help', 'buddypress' ),
 221              __( 'Help', 'buddypress' ),
 222              $this->capability,
 223              'bp-general-settings',
 224              'bp_core_admin_backpat_page'
 225          );
 226  
 227          // Add the option pages.
 228          $hooks[] = add_submenu_page(
 229              $this->settings_page,
 230              __( 'BuddyPress Components', 'buddypress' ),
 231              __( 'BuddyPress', 'buddypress' ),
 232              $this->capability,
 233              'bp-components',
 234              'bp_core_admin_components_settings'
 235          );
 236  
 237          $hooks[] = add_submenu_page(
 238              $this->settings_page,
 239              __( 'BuddyPress Pages', 'buddypress' ),
 240              __( 'BuddyPress Pages', 'buddypress' ),
 241              $this->capability,
 242              'bp-page-settings',
 243              'bp_core_admin_slugs_settings'
 244          );
 245  
 246          $hooks[] = add_submenu_page(
 247              $this->settings_page,
 248              __( 'BuddyPress Options', 'buddypress' ),
 249              __( 'BuddyPress Options', 'buddypress' ),
 250              $this->capability,
 251              'bp-settings',
 252              'bp_core_admin_settings'
 253          );
 254  
 255          // Credits.
 256          $hooks[] = add_submenu_page(
 257              $this->settings_page,
 258              __( 'BuddyPress Credits', 'buddypress' ),
 259              __( 'BuddyPress Credits', 'buddypress' ),
 260              $this->capability,
 261              'bp-credits',
 262              array( $this, 'credits_screen' )
 263          );
 264  
 265          // For consistency with non-Multisite, we add a Tools menu in
 266          // the Network Admin as a home for our Tools panel.
 267          if ( is_multisite() && bp_core_do_network_admin() ) {
 268              $tools_parent = 'network-tools';
 269  
 270              $hooks[] = add_menu_page(
 271                  __( 'Tools', 'buddypress' ),
 272                  __( 'Tools', 'buddypress' ),
 273                  $this->capability,
 274                  $tools_parent,
 275                  'bp_core_tools_top_level_item',
 276                  '',
 277                  24 // Just above Settings.
 278              );
 279  
 280              $hooks[] = add_submenu_page(
 281                  $tools_parent,
 282                  __( 'Available Tools', 'buddypress' ),
 283                  __( 'Available Tools', 'buddypress' ),
 284                  $this->capability,
 285                  'available-tools',
 286                  'bp_core_admin_available_tools_page'
 287              );
 288          } else {
 289              $tools_parent = 'tools.php';
 290          }
 291  
 292          $hooks[] = add_submenu_page(
 293              $tools_parent,
 294              __( 'BuddyPress Tools', 'buddypress' ),
 295              __( 'BuddyPress', 'buddypress' ),
 296              $this->capability,
 297              'bp-tools',
 298              'bp_core_admin_tools'
 299          );
 300  
 301          // For network-wide configs, add a link to (the root site's) Emails screen.
 302          if ( is_network_admin() && bp_is_network_activated() ) {
 303              $email_labels = bp_get_email_post_type_labels();
 304              $email_url    = get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() );
 305  
 306              $hooks[] = add_menu_page(
 307                  $email_labels['name'],
 308                  $email_labels['menu_name'],
 309                  $this->capability,
 310                  '',
 311                  '',
 312                  'dashicons-email',
 313                  26
 314              );
 315  
 316              // Hack: change the link to point to the root site's admin, not the network admin.
 317              $GLOBALS['menu'][26][2] = esc_url_raw( $email_url );
 318          }
 319  
 320          foreach( $hooks as $hook ) {
 321              add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
 322          }
 323      }
 324  
 325      /**
 326       * Register site-admin nav menu elements.
 327       *
 328       * @since 2.5.0
 329       */
 330  	public function site_admin_menus() {
 331          if ( ! bp_current_user_can( 'manage_options' ) ) {
 332              return;
 333          }
 334  
 335          $hooks = array();
 336  
 337          // Appearance > Emails.
 338          $hooks[] = add_theme_page(
 339              _x( 'Emails', 'screen heading', 'buddypress' ),
 340              _x( 'Emails', 'screen heading', 'buddypress' ),
 341              $this->capability,
 342              'bp-emails-customizer-redirect',
 343              'bp_email_redirect_to_customizer'
 344          );
 345  
 346          // Emails > Customize.
 347          $hooks[] = add_submenu_page(
 348              'edit.php?post_type=' . bp_get_email_post_type(),
 349              _x( 'Customize', 'email menu label', 'buddypress' ),
 350              _x( 'Customize', 'email menu label', 'buddypress' ),
 351              $this->capability,
 352              'bp-emails-customizer-redirect',
 353              'bp_email_redirect_to_customizer'
 354          );
 355  
 356          foreach( $hooks as $hook ) {
 357              add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
 358          }
 359      }
 360  
 361      /**
 362       * Register the settings.
 363       *
 364       * @since 1.6.0
 365       *
 366       */
 367  	public function register_admin_settings() {
 368  
 369          /* Main Section ******************************************************/
 370  
 371          // Add the main section.
 372          add_settings_section( 'bp_main', __( 'Main Settings', 'buddypress' ), 'bp_admin_setting_callback_main_section', 'buddypress' );
 373  
 374          // Hide toolbar for logged out users setting.
 375          add_settings_field( 'hide-loggedout-adminbar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main' );
 376          register_setting( 'buddypress', 'hide-loggedout-adminbar', 'intval' );
 377  
 378          // Only show 'switch to Toolbar' option if the user chose to retain the BuddyBar during the 1.6 upgrade.
 379          if ( (bool) bp_get_option( '_bp_force_buddybar', false ) ) {
 380              // Load deprecated code if not available.
 381              if ( ! function_exists( 'bp_admin_setting_callback_force_buddybar' ) ) {
 382                  require buddypress()->plugin_dir . 'bp-core/deprecated/2.1.php';
 383              }
 384  
 385              add_settings_field( '_bp_force_buddybar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_force_buddybar', 'buddypress', 'bp_main' );
 386              register_setting( 'buddypress', '_bp_force_buddybar', 'bp_admin_sanitize_callback_force_buddybar' );
 387          }
 388  
 389          // Allow account deletion.
 390          add_settings_field( 'bp-disable-account-deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main' );
 391          register_setting( 'buddypress', 'bp-disable-account-deletion', 'intval' );
 392  
 393          // Template pack picker.
 394          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' ) );
 395          register_setting( 'buddypress', '_bp_theme_package_id', 'sanitize_text_field' );
 396  
 397          /* Members Section  **************************************************/
 398  
 399          // Add the main section.
 400          add_settings_section( 'bp_members', _x( 'Members Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_members_section', 'buddypress' );
 401  
 402          // Avatars.
 403          add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_members' );
 404          register_setting( 'buddypress', 'bp-disable-avatar-uploads', 'intval' );
 405  
 406          // Cover images.
 407          if ( bp_is_active( 'members', 'cover_image' ) ) {
 408              add_settings_field( 'bp-disable-cover-image-uploads', __( 'Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_cover_image_uploads', 'buddypress', 'bp_members' );
 409              register_setting( 'buddypress', 'bp-disable-cover-image-uploads', 'intval' );
 410          }
 411  
 412          /* XProfile Section **************************************************/
 413  
 414          if ( bp_is_active( 'xprofile' ) ) {
 415  
 416              // Add the main section.
 417              add_settings_section( 'bp_xprofile', _x( 'Profile Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' );
 418  
 419              // Profile sync setting.
 420              add_settings_field( 'bp-disable-profile-sync',   __( 'Profile Syncing',  'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile' );
 421              register_setting  ( 'buddypress', 'bp-disable-profile-sync', 'intval' );
 422          }
 423  
 424          /* Groups Section ****************************************************/
 425  
 426          if ( bp_is_active( 'groups' ) ) {
 427  
 428              // Add the main section.
 429              add_settings_section( 'bp_groups', __( 'Groups Settings',  'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
 430  
 431              // Allow subscriptions setting.
 432              add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation',   'buddypress', 'bp_groups' );
 433              register_setting( 'buddypress', 'bp_restrict_group_creation', 'intval' );
 434  
 435              // Allow group avatars.
 436              add_settings_field( 'bp-disable-group-avatar-uploads', __( 'Group Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_avatar_uploads', 'buddypress', 'bp_groups' );
 437              register_setting( 'buddypress', 'bp-disable-group-avatar-uploads', 'intval' );
 438  
 439              // Allow group cover images.
 440              if ( bp_is_active( 'groups', 'cover_image' ) ) {
 441                  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' );
 442                  register_setting( 'buddypress', 'bp-disable-group-cover-image-uploads', 'intval' );
 443              }
 444          }
 445  
 446          /* Activity Section **************************************************/
 447  
 448          if ( bp_is_active( 'activity' ) ) {
 449  
 450              // Add the main section.
 451              add_settings_section( 'bp_activity', __( 'Activity Settings', 'buddypress' ), 'bp_admin_setting_callback_activity_section', 'buddypress' );
 452  
 453              // Activity commenting on post and comments.
 454              add_settings_field( 'bp-disable-blogforum-comments', __( 'Post Comments', 'buddypress' ), 'bp_admin_setting_callback_blogforum_comments', 'buddypress', 'bp_activity' );
 455              register_setting( 'buddypress', 'bp-disable-blogforum-comments', 'bp_admin_sanitize_callback_blogforum_comments' );
 456  
 457              // Activity Heartbeat refresh.
 458              add_settings_field( '_bp_enable_heartbeat_refresh', __( 'Activity auto-refresh', 'buddypress' ), 'bp_admin_setting_callback_heartbeat', 'buddypress', 'bp_activity' );
 459              register_setting( 'buddypress', '_bp_enable_heartbeat_refresh', 'intval' );
 460  
 461              // Allow activity akismet.
 462              if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) {
 463                  add_settings_field( '_bp_enable_akismet', __( 'Akismet', 'buddypress' ), 'bp_admin_setting_callback_activity_akismet', 'buddypress', 'bp_activity' );
 464                  register_setting( 'buddypress', '_bp_enable_akismet', 'intval' );
 465              }
 466          }
 467      }
 468  
 469      /**
 470       * Add a link to BuddyPress Hello to the admin bar.
 471       *
 472       * @since 1.9.0
 473       * @since 3.0.0 Hooked at priority 100 (was 15).
 474       *
 475       * @param WP_Admin_Bar $wp_admin_bar
 476       */
 477  	public function admin_bar_about_link( $wp_admin_bar ) {
 478          if ( ! is_user_logged_in() ) {
 479              return;
 480          }
 481  
 482          $wp_admin_bar->add_node( array(
 483              'parent' => 'wp-logo',
 484              'id'     => 'bp-about',
 485              'title'  => esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ),
 486              'href'   => bp_get_admin_url( '?hello=buddypress' ),
 487              'meta'   => array(
 488                  'class' => 'say-hello-buddypress',
 489              ),
 490          ) );
 491      }
 492  
 493      /**
 494       * Add Settings link to plugins area.
 495       *
 496       * @since 1.6.0
 497       *
 498       * @param array  $links Links array in which we would prepend our link.
 499       * @param string $file  Current plugin basename.
 500       * @return array Processed links.
 501       */
 502  	public function modify_plugin_action_links( $links, $file ) {
 503  
 504          // Return normal links if not BuddyPress.
 505          if ( plugin_basename( buddypress()->basename ) != $file ) {
 506              return $links;
 507          }
 508  
 509          // Add a few links to the existing links array.
 510          return array_merge( $links, array(
 511              'settings' => '<a href="' . esc_url( add_query_arg( array( 'page' => 'bp-components' ), bp_get_admin_url( $this->settings_page ) ) ) . '">' . esc_html__( 'Settings', 'buddypress' ) . '</a>',
 512              'about'    => '<a href="' . esc_url( bp_get_admin_url( '?hello=buddypress' ) ) . '">' . esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ) . '</a>'
 513          ) );
 514      }
 515  
 516      /**
 517       * Add some general styling to the admin area.
 518       *
 519       * @since 1.6.0
 520       */
 521  	public function admin_head() {
 522  
 523          // Settings pages.
 524          remove_submenu_page( $this->settings_page, 'bp-page-settings' );
 525          remove_submenu_page( $this->settings_page, 'bp-settings'      );
 526          remove_submenu_page( $this->settings_page, 'bp-credits'       );
 527  
 528          // Network Admin Tools.
 529          remove_submenu_page( 'network-tools', 'network-tools' );
 530  
 531          // About and Credits pages.
 532          remove_submenu_page( 'index.php', 'bp-about'   );
 533          remove_submenu_page( 'index.php', 'bp-credits' );
 534      }
 535  
 536      /**
 537       * Add some general styling to the admin area.
 538       *
 539       * @since 1.6.0
 540       */
 541  	public function enqueue_scripts() {
 542          wp_enqueue_style( 'bp-admin-common-css' );
 543  
 544          // BuddyPress Hello.
 545          if ( 0 === strpos( get_current_screen()->id, 'dashboard' ) && ! empty( $_GET['hello'] ) && $_GET['hello'] === 'buddypress' ) {
 546              wp_enqueue_style( 'bp-hello-css' );
 547              wp_enqueue_script( 'bp-hello-js' );
 548              wp_localize_script( 'bp-hello-js', 'bpHelloStrings', array(
 549                  'pageNotFound' => __( 'Sorry, the page you requested was not found.', 'buddypress' ),
 550                  'modalLabel'   => __( 'Hello BuddyPress', 'buddypress' ),
 551              ) );
 552          }
 553      }
 554  
 555      /**
 556       * Registers BuddyPress's suggested privacy policy language.
 557       *
 558       * @since 4.0.0
 559       */
 560  	public function add_privacy_policy_content() {
 561          // Nothing to do if we're running < WP 4.9.6.
 562          if ( version_compare( $GLOBALS['wp_version'], '4.9.6', '<' ) ) {
 563              return;
 564          }
 565  
 566          $suggested_text = '<strong class="privacy-policy-tutorial">' . esc_html__( 'Suggested text:', 'buddypress' ) . ' </strong>';
 567          $content = '';
 568  
 569          $content .= '<div class="wp-suggested-text">';
 570  
 571          $content .= '<h2>' . esc_html__( 'What personal data we collect and why we collect it', 'buddypress' ) . '</h2>';
 572          $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>';
 573  
 574          if ( bp_is_active( 'xprofile' ) ) {
 575              $content .= '<h3>' . esc_html__( 'Profile Data', 'buddypress' ) . '</h3>';
 576              $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>';
 577  
 578              $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>';
 579              $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>';
 580          }
 581  
 582          if ( bp_is_active( 'activity' ) ) {
 583              $content .= '<h3>' . esc_html__( 'Activity', 'buddypress' ) . '</h3>';
 584              $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>';
 585  
 586              $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>';
 587              $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>';
 588              $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>';
 589          }
 590  
 591          if ( bp_is_active( 'messages' ) ) {
 592              $content .= '<h3>' . esc_html__( 'Messages', 'buddypress' ) . '</h3>';
 593              $content .= '<p class="privacy-policy-tutorial">' . esc_html__( 'In this section you should describe any personal data related to private messages.', 'buddypress' ) . '</p>';
 594  
 595              $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>';
 596          }
 597  
 598          $content .= '<h3>' . esc_html__( 'Cookies', 'buddypress' ) . '</h3>';
 599          $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>';
 600  
 601          $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>';
 602  
 603          $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>';
 604  
 605          if ( bp_is_active( 'groups' ) ) {
 606              $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>';
 607          }
 608  
 609          $content .= '</div><!-- .wp-suggested-text -->';
 610  
 611          wp_add_privacy_policy_content(
 612              'BuddyPress',
 613              wp_kses_post( wpautop( $content, false ) )
 614          );
 615      }
 616  
 617      /** About *****************************************************************/
 618  
 619      /**
 620       * Output the BuddyPress Hello template.
 621       *
 622       * @since 1.7.0 Screen content.
 623       * @since 3.0.0 Now outputs BuddyPress Hello template.
 624       */
 625  	public function about_screen() {
 626          if ( 0 !== strpos( get_current_screen()->id, 'dashboard' ) || empty( $_GET['hello'] ) || $_GET['hello'] !== 'buddypress' ) {
 627              return;
 628          }
 629  
 630          // Get BuddyPress stable version.
 631          $version      =  self::display_version();
 632          $version_slug = 'version-' . str_replace( '.', '-', $version );
 633      ?>
 634  
 635          <div id="bp-hello-container">
 636              <div id="plugin-information-scrollable" role="document">
 637                  <div id='plugin-information-title' class="with-banner">
 638                      <div class='vignette'></div>
 639                      <h1>
 640                          <?php printf(
 641                              /* translators: %s is the placeholder for the BuddyPress version number. */
 642                              esc_html__( 'BuddyPress %s', 'buddypress' ),
 643                              $version
 644                          ); ?>
 645                      </h1>
 646                  </div>
 647                  <div id="plugin-information-tabs">
 648                      <a name="whats-new" href="#whats-new" class="current"><?php esc_html_e( 'What\'s new?', 'buddypress' ); ?></a>
 649                      <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>
 650                      <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>
 651                  </div>
 652  
 653                  <div class="bp-hello-content">
 654                      <div id="dynamic-content"></div>
 655                      <div id="top-features">
 656                          <h2><?php esc_html_e( 'Say hello to the first two BuddyPress blocks!', 'buddypress' ); ?></h2>
 657                          <figure class="bp-hello-aligncenter">
 658                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-blocks.gif' ); ?>" alt="<?php esc_attr_e( 'Gif Animation showing how to insert the BuddyPress Group Block.', 'buddypress' ); ?>" />
 659                          </figure>
 660                          <p>
 661                              <?php esc_html_e( 'BuddyPress 6.0.0 comes with two awesome blocks for your WordPress Editor: the BP Member and BP Group Blocks.', 'buddypress' ); ?>
 662                              <?php esc_html_e( 'Available from the BuddyPress blocks category of your WordPress Block menu, these lovely blocks let you insert a rich content block featuring a specific member or group from your community site in a WordPress post or page.', 'buddypress' ); ?>
 663                              <br/>
 664                              <?php printf(
 665                                  /* translators: %s is the placeholder for the link to the Advanced section of the BP Blocks development note. */
 666                                  esc_html__( 'If you\'re an Advanced BuddyPresser and wish to fine tune the BuddyPress blocks for your community site, learn more in %s about the new BP Blocks.', 'buddypress' ),
 667                                  sprintf(
 668                                      '<a href="%1$s">%2$s</a>',
 669                                      esc_url( 'https://bpdevel.wordpress.com/2020/03/30/welcome-to-the-first-buddypress-blocks/#advanced-customizations' ),
 670                                      esc_html__( 'this section of our development note', 'buddypress' )
 671                                  )
 672                              ); ?>
 673                          </p>
 674  
 675                          <hr class="bp-hello-divider"/>
 676  
 677                          <h2><?php esc_html_e( 'The BP REST API is now completed!', 'buddypress' ); ?></h2>
 678                          <figure class="bp-hello-alignright">
 679                              <div class="dashicons dashicons-rest-api big"></div>
 680                          </figure>
 681                          <p>
 682                              <?php printf(
 683                                  /* translators: %s is the placeholder for the link to the BP REST API documentation. */
 684                                  esc_html__( 'In 5.0.0, we introduced the first endpoints and provided %s for them.', 'buddypress' ),
 685                                  sprintf(
 686                                      '<a href="%1$s">%2$s</a>',
 687                                      esc_url( 'https://developer.buddypress.org/bp-rest-api/' ),
 688                                      esc_html__( 'reference documentation', 'buddypress' )
 689                                  )
 690                              ); ?>
 691                              <?php esc_html_e( 'In 6.0.0, we are adding the 6 remaining endpoints you were waiting for: Blogs, Blog avatar, Friends, Group Cover Image, Member Cover Image and User Signups. You can now build full-featured BuddyPress Apps!', 'buddypress' ); ?>
 692                          </p>
 693  
 694                          <hr class="bp-hello-divider"/>
 695  
 696                          <h2><?php esc_html_e( 'BP Nouveau has been improved', 'buddypress' ); ?></h2>
 697                          <p>
 698                              <?php esc_html_e( 'Your active theme supports wide layouts? Awesome! BP Nouveau now supports wide (and really, really wide) content areas, too!', 'buddypress' ); ?>
 699                          </p>
 700                          <figure class="bp-hello-aligncenter">
 701                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-nouveau-wide-aligns.png' ); ?>" alt="<?php esc_attr_e( 'Screenshot of the BP Nouveau customizer setting to take advantage of wide layouts', 'buddypress' ); ?>" />
 702                          </figure>
 703                          <p>
 704                              <?php esc_html_e( 'This is the first of the many improvements we are bringing to our default Template Pack. It never looked so beautiful in your theme.', 'buddypress' ); ?>
 705                          </p>
 706  
 707                          <hr class="bp-hello-divider"/>
 708  
 709                          <h2><?php esc_html_e( 'Under the hood', 'buddypress' ); ?></h2>
 710                          <figure class="bp-hello-alignright">
 711                              <div class="dashicons dashicons-buddicons-buddypress-logo big"></div>
 712                          </figure>
 713                          <p>
 714                              <?php esc_html_e( '6.0.0 includes more than 80 changes to improve your BuddyPress experience as users, as contributors to our code and as contributors to our translations.', 'buddypress' ); ?>
 715                          </p>
 716                          <p>
 717                              <?php printf(
 718                                  /* translators: %s is the placeholder for the link to the Avatar changes development note. */
 719                                  esc_html__( 'The biggest change moves local avatar management to the Members component. Read more about it in %s.', 'buddypress' ),
 720                                  sprintf(
 721                                      '<a href="%1$s">%2$s</a>',
 722                                      esc_url( 'https://bpdevel.wordpress.com/2020/03/01/the-profile-photo-cover-image-features-belong-to-members/' ),
 723                                      esc_html__( 'this development note', 'buddypress' )
 724                                  )
 725                              ); ?>
 726                          </p>
 727  
 728                          <hr class="bp-hello-divider"/>
 729  
 730                          <h2><?php esc_html_e( 'We want to hear your voice', 'buddypress' ); ?></h2>
 731                          <figure class="bp-hello-alignleft">
 732                              <div class="dashicons dashicons-microphone big"></div>
 733                          </figure>
 734                          <p class="aligncenter">
 735                              <strong><?php printf(
 736                                  /* translators: %s is the placeholder for the link to the 2020 BuddyPress survey. */
 737                                  esc_html__( 'Take the %s.', 'buddypress' ),
 738                                  sprintf(
 739                                      '<a href="%1$s">%2$s</a>',
 740                                      esc_url( 'https://mercime.survey.fm/2020-buddypress-survey' ),
 741                                      esc_html__( '2020 BuddyPress Survey', 'buddypress' )
 742                                  )
 743                              ); ?></strong>
 744                          </p>
 745                          <p>
 746                              <?php esc_html_e( 'Knowing how you use BuddyPress and getting your point of view about future BuddyPress development is very important to us.', 'buddypress' ); ?>
 747                              <?php esc_html_e( 'Please, take some time to help us decide what\'s best for the BuddyPress project.', 'buddypress' ); ?>
 748                          </p>
 749  
 750                          <hr class="bp-hello-divider"/>
 751  
 752                          <h2><?php echo esc_html( _x( 'Your feedback', 'screen heading', 'buddypress' ) ); ?></h2>
 753                          <p>
 754                              <?php
 755                              printf(
 756                                  /* translators: %s is the placeholder for the link to BuddyPress support forums. */
 757                                  esc_html__( ' How are you using BuddyPress? Receiving your feedback and suggestions for future versions of BuddyPress genuinely motivates and encourages our contributors. Please %s about this version of BuddyPress on our website. ', 'buddypress' ),
 758                                  sprintf(
 759                                      '<a href="%1$s">%2$s</a>',
 760                                      esc_url( 'https://buddypress.org/support/' ),
 761                                      esc_html__( 'share your feedback', 'buddypress' )
 762                                  )
 763                              );
 764                              ?>
 765                          </p>
 766                          <p><?php esc_html_e( 'Thank you for using BuddyPress! 😊', 'buddypress' ); ?></p>
 767  
 768                          <br /><br />
 769                      </div>
 770                  </div>
 771              </div>
 772              <div id="plugin-information-footer">
 773                  <div class="bp-hello-social-cta">
 774                      <p>
 775                          <?php
 776                          printf(
 777                              /* translators: 1: heart dashicons. 2: BP Credits screen url. 3: number of BuddyPress contributors to this version. */
 778                              _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>.', 42, 'buddypress' ),
 779                              '<span class="dashicons dashicons-heart"></span>',
 780                              esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
 781                              number_format_i18n( 42 )
 782                          );
 783                          ?>
 784                      </p>
 785                  </div>
 786  
 787                  <div class="bp-hello-social-links">
 788                      <ul class="bp-hello-social">
 789                          <li>
 790                              <?php
 791                              printf(
 792                                  '<a class="twitter bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 793                                  esc_attr__( 'Follow BuddyPress on Twitter', 'buddypress' ),
 794                                  esc_url( 'https://twitter.com/buddypress' ),
 795                                  esc_html__( 'Follow BuddyPress on Twitter', 'buddypress' )
 796                              );
 797                              ?>
 798                          </li>
 799  
 800                          <li>
 801                              <?php
 802                              printf(
 803                                  '<a class="support bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 804                                  esc_attr__( 'Visit the Support Forums', 'buddypress' ),
 805                                  esc_url( 'https://buddypress.org/support/' ),
 806                                  esc_html__( 'Visit the Support Forums', 'buddypress' )
 807                              );
 808                              ?>
 809                          </li>
 810                      </ul>
 811                  </div>
 812              </div>
 813          </div>
 814  
 815          <?php
 816      }
 817  
 818      /**
 819       * Output the credits screen.
 820       *
 821       * Hardcoding this in here is pretty janky. It's fine for now, but we'll
 822       * want to leverage api.wordpress.org eventually.
 823       *
 824       * @since 1.7.0
 825       */
 826  	public function credits_screen() {
 827      ?>
 828  
 829          <div class="wrap bp-about-wrap">
 830  
 831          <h1><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?> </h1>
 832  
 833          <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Credits', 'buddypress' ) ); ?></h2>
 834  
 835              <p class="about-description"><?php esc_html_e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p>
 836  
 837              <h3 class="wp-people-group"><?php esc_html_e( 'Project Leaders', 'buddypress' ); ?></h3>
 838              <ul class="wp-people-group " id="wp-people-group-project-leaders">
 839                  <li class="wp-person" id="wp-person-johnjamesjacoby">
 840                      <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7a2644fb53ae2f7bfd7143b504af396c?s=120">
 841                      John James Jacoby</a>
 842                      <span class="title"><?php esc_html_e( 'Project Lead', 'buddypress' ); ?></span>
 843                  </li>
 844                  <li class="wp-person" id="wp-person-boonebgorges">
 845                      <a class="web" href="https://profiles.wordpress.org/boonebgorges"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=120">
 846                      Boone B. Gorges</a>
 847                      <span class="title"><?php esc_html_e( 'Lead Developer', 'buddypress' ); ?></span>
 848                  </li>
 849                  <li class="wp-person" id="wp-person-djpaul">
 850                      <a class="web" href="https://profiles.wordpress.org/djpaul"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3bc9ab796299d67ce83dceb9554f75df?s=120">
 851                      Paul Gibbs</a>
 852                      <span class="title"><?php esc_html_e( 'Lead Developer', 'buddypress' ); ?></span>
 853                  </li>
 854              </ul>
 855  
 856              <h3 class="wp-people-group"><?php esc_html_e( 'BuddyPress Team', 'buddypress' ); ?></h3>
 857              <ul class="wp-people-group " id="wp-people-group-core-team">
 858                  <li class="wp-person" id="wp-person-r-a-y">
 859                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3bfa556a62b5bfac1012b6ba5f42ebfa?s=120">
 860                      Ray</a>
 861                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 862                  </li>
 863                  <li class="wp-person" id="wp-person-hnla">
 864                      <a class="web" href="https://profiles.wordpress.org/hnla"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3860c955aa3f79f13b92826ae47d07fe?s=120">
 865                      Hugo Ashmore</a>
 866                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 867                  </li>
 868                  <li class="wp-person" id="wp-person-imath">
 869                      <a class="web" href="https://profiles.wordpress.org/imath"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8b208ca408dad63888253ee1800d6a03?s=120">
 870                      Mathieu Viet</a>
 871                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 872                  </li>
 873                  <li class="wp-person" id="wp-person-mercime">
 874                      <a class="web" href="https://profiles.wordpress.org/mercime"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/fae451be6708241627983570a1a1817a?s=120">
 875                      Mercime</a>
 876                      <span class="title"><?php esc_html_e( 'Navigator', 'buddypress' ); ?></span>
 877                  </li>
 878                  <li class="wp-person" id="wp-person-dcavins">
 879                      <a class="web" href="https://profiles.wordpress.org/dcavins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5fa7e83d59cb45ebb616235a176595a?s=120">
 880                      David Cavins</a>
 881                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 882                  </li>
 883                  <li class="wp-person" id="wp-person-tw2113">
 884                      <a class="web" href="https://profiles.wordpress.org/tw2113"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5d7c934621fa1c025b83ee79bc62366?s=120">
 885                      Michael Beckwith</a>
 886                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 887                  </li>
 888                  <li class="wp-person" id="wp-person-henry-wright">
 889                      <a class="web" href="https://profiles.wordpress.org/henry.wright"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0da2f1a9340d6af196b870f6c107a248?s=120">
 890                      Henry Wright</a>
 891                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 892                  </li>
 893                  <li class="wp-person" id="wp-person-danbp">
 894                      <a class="web" href="https://profiles.wordpress.org/danbp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0deae2e7003027fbf153500cd3fa5501?s=120">
 895                      danbp</a>
 896                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 897                  </li>
 898                  <li class="wp-person" id="wp-person-shanebp">
 899                      <a class="web" href="https://profiles.wordpress.org/shanebp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ffd294ab5833ba14aaf175f9acc71cc4?s=120">
 900                      shanebp</a>
 901                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 902                  </li>
 903                  <li class="wp-person" id="wp-person-slaffik">
 904                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/61fb07ede3247b63f19015f200b3eb2c?s=120">
 905                      Slava Abakumov</a>
 906                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 907                  </li>
 908                  <li class="wp-person" id="wp-person-offereins">
 909                      <a class="web" href="https://profiles.wordpress.org/Offereins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/2404ed0a35bb41aedefd42b0a7be61c1?s=120">
 910                      Laurens Offereins</a>
 911                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 912                  </li>
 913                  <li class="wp-person" id="wp-person-netweb">
 914                      <a class="web" href="https://profiles.wordpress.org/netweb"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=120">
 915                      Stephen Edgar</a>
 916                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 917                  </li>
 918                  <li class="wp-person" id="wp-person-espellcaste">
 919                      <a class="web" href="https://profiles.wordpress.org/espellcaste"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/b691e67be0ba5cad6373770656686bc3?s=120">
 920                      Renato Alves</a>
 921                      <span class="title"><?php esc_html_e( 'Core Developer', 'buddypress' ); ?></span>
 922                  </li>
 923                  <li class="wp-person" id="wp-person-venutius">
 924                      <a class="web" href="https://profiles.wordpress.org/venutius"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/6a7c42a77fd94b82b217a7a97afdddbc?s=120">
 925                      Venutius</a>
 926                      <span class="title"><?php esc_html_e( 'Community Support', 'buddypress' ); ?></span>
 927                  </li>
 928              </ul>
 929  
 930              <h3 class="wp-people-group">
 931                  <?php
 932                  printf(
 933                      /* translators: %s: BuddyPress version number */
 934                      esc_html__( 'Noteworthy Contributors to %s', 'buddypress' ),
 935                      self::display_version()
 936                  );
 937                  ?>
 938              </h3>
 939              <ul class="wp-people-group " id="wp-people-group-noteworthy">
 940                  <li class="wp-person" id="wp-person-passoniate">
 941                      <a class="web" href="https://profiles.wordpress.org/passoniate/"><img alt="" class="gravatar" src="//gravatar.com/avatar/df262cbc82caecc7302849e8d591b32c?s=120">
 942                      Arslan Ahmed</a>
 943                  </li>
 944                  <li class="wp-person" id="wp-person-iamthewebb">
 945                      <a class="web" href="https://profiles.wordpress.org/iamthewebb/"><img alt="" class="gravatar" src="//gravatar.com/avatar/990bac871caf6d6e179b2753226d8f4a?s=120&d=mm">
 946                      IAmTheWebb</a>
 947                  </li>
 948                  <li class="wp-person" id="wp-person-vapvarun">
 949                      <a class="web" href="https://profiles.wordpress.org/vapvarun"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/78a3bf7eb3a1132fc667f96f2631e448?s=120">
 950                      Varun Dubey</a>
 951                  </li>
 952              </ul>
 953  
 954              <h3 class="wp-people-group">
 955                  <?php
 956                  printf(
 957                      /* translators: %s: BuddyPress version number */
 958                      esc_html__( 'All Contributors to BuddyPress %s', 'buddypress' ),
 959                      self::display_version()
 960                  );
 961                  ?>
 962              </h3>
 963              <p class="wp-credits-list">
 964                  <a href="https://profiles.wordpress.org/oztaser">Adil Oztaser (oztaser)</a>,
 965                  <a href="https://profiles.wordpress.org/wpamitkumar">Amit Dudhat (wpamitkumar)</a>,
 966                  <a href="https://profiles.wordpress.org/dontdream">Andrea Tarantini (dontdream)</a>,
 967                  <a href="https://profiles.wordpress.org/ankitmaru">Ankit Panchal (ankitmaru)</a>,
 968                  <a href="https://profiles.wordpress.org/passoniate">Arslan Ahmed (passoniate)</a>,
 969                  <a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
 970                  <a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
 971                  <a href="https://profiles.wordpress.org/bhargavbhandari90">Bunty (bhargavbhandari90)</a>,
 972                  <a href="https://profiles.wordpress.org/dancaragea/">Dan Caragea (dancaragea)</a>,
 973                  <a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
 974                  <a href="https://profiles.wordpress.org/ocean90">Dominik Schilling (ocean90)</a>,
 975                  <a href="https://profiles.wordpress.org/etatus">etatus</a>,
 976                  <a href="https://profiles.wordpress.org/fayazgabol">Fayaz Gabol (fayazgabol)</a>,
 977                  <a href="https://profiles.wordpress.org/hnla">Hugo Ashmore (hnla)</a>,
 978                  <a href="https://profiles.wordpress.org/audrasjb">Jb Audras (audrasjb)</a>,
 979                  <a href="https://profiles.wordpress.org/jenfraggle/">Jennifer Burnett (jenfraggle)</a>,
 980                  <a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
 981                  <a href="https://profiles.wordpress.org/greenshady">Justin Tadlock (greenshady)</a>,
 982                  <a href="https://profiles.wordpress.org/kashifgabol">Kashif Gabol (kashifgabol)</a>,
 983                  <a href="https://profiles.wordpress.org/laudag">laudag</a>,
 984                  <a href="https://profiles.wordpress.org/marbaque/">Mario Badilla (marbaque)</a>,
 985                  <a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
 986                  <a href="https://profiles.wordpress.org/mattjones2207">mattjones2207</a>,
 987                  <a href="https://profiles.wordpress.org/mercime">mercime</a>,
 988                  <a href="https://profiles.wordpress.org/mo3aser">mo3aser</a>,
 989                  <a href="https://profiles.wordpress.org/modemlooper">modemlooper</a>,
 990                  <a href="https://profiles.wordpress.org/man4toman">Morteza Geransayeh (man4toman)</a>,
 991                  <a href="https://profiles.wordpress.org/mukesh27">Mukesh Panchal (mukesh27)</a>,
 992                  <a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
 993                  <a href="https://profiles.wordpress.org/pooja1210">Pooja N Muchandikar (pooja1210)</a>,
 994                  <a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
 995                  <a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
 996                  <a href="https://profiles.wordpress.org/santiazpi2">santiazpi2</a>,
 997                  <a href="https://profiles.wordpress.org/shanebp">shanebp</a>,
 998                  <a href="https://profiles.wordpress.org/sharaz">Sharaz Shahid (sharaz)</a>,
 999                  <a href="https://github.com/sjregan">sjregan</a>,
1000                  <a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
1001                  <a href="https://profiles.wordpress.org/karmatosed">Tammie Lister (karmatosed)</a>,
1002                  <a href="https://profiles.wordpress.org/tobifjellner">Tor-Bjorn Fjellner (tobifjellner)</a>,
1003                  <a href="https://profiles.wordpress.org/itowhid06">Towhidul Islam (itowhid06)</a>,
1004                  <a href="https://profiles.wordpress.org/twmcmahan">twmcmahan</a>,
1005                  <a href="https://profiles.wordpress.org/zishanj">Zishan (zishanj)</a>
1006              </p>
1007  
1008              <h3 class="wp-people-group"><?php esc_html_e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
1009              <p class="wp-credits-list">
1010                  <a href="https://github.com/ichord/At.js">At.js</a>,
1011                  <a href="https://bbpress.org">bbPress</a>,
1012                  <a href="https://github.com/ichord/Caret.js">Caret.js</a>,
1013                  <a href="https://tedgoas.github.io/Cerberus/">Cerberus</a>,
1014                  <a href="https://ionicons.com/">Ionicons</a>,
1015                  <a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
1016                  <a href="https://mattbradley.github.io/livestampjs/">Livestamp.js</a>,
1017                  <a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
1018                  <a href="https://momentjs.com/">Moment.js</a>,
1019                  <a href="https://wordpress.org">WordPress</a>.
1020              </p>
1021  
1022              <h3 class="wp-people-group"><?php esc_html_e( 'Contributor Emeriti', 'buddypress' ); ?></h3>
1023              <ul class="wp-people-group " id="wp-people-group-emeriti">
1024                  <li class="wp-person" id="wp-person-apeatling">
1025                      <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=120">
1026                      Andy Peatling</a>
1027                      <span class="title"><?php esc_html_e( 'Project Founder', 'buddypress' ); ?></span>
1028                  </li>
1029                  <li class="wp-person" id="wp-person-burtadsit">
1030                      <a class="web" href="https://profiles.wordpress.org/burtadsit"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/185e1d3e2d653af9d49a4e8e4fc379df?s=120">
1031                      Burt Adsit</a>
1032                  </li>
1033                  <li class="wp-person" id="wp-person-dimensionmedia">
1034                      <a class="web" href="https://profiles.wordpress.org/dimensionmedia"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7735aada1ec39d0c1118bd92ed4551f1?s=120">
1035                      David Bisset</a>
1036                  </li>
1037                  <li class="wp-person" id="wp-person-jeffsayre">
1038                      <a class="web" href="https://profiles.wordpress.org/jeffsayre"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8e009a84ff5d245c22a69c7df6ab45f7?s=120">
1039                      Jeff Sayre</a>
1040                  </li>
1041                  <li class="wp-person" id="wp-person-karmatosed">
1042                      <a class="web" href="https://profiles.wordpress.org/karmatosed"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ca7d4273a689cdbf524d8332771bb1ca?s=120">
1043                      Tammie Lister</a>
1044                  </li>
1045                  <li class="wp-person" id="wp-person-modemlooper">
1046                      <a class="web" href="https://profiles.wordpress.org/modemlooper"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/1c07be1016e845de514931477c939307?s=120">
1047                      modemlooper</a>
1048                  </li>
1049              </ul>
1050          </div>
1051  
1052          <?php
1053      }
1054  
1055      /** Emails ****************************************************************/
1056  
1057      /**
1058       * Registers 'Situations' column on Emails dashboard page.
1059       *
1060       * @since 2.6.0
1061       *
1062       * @param array $columns Current column data.
1063       * @return array
1064       */
1065  	public function emails_register_situation_column( $columns = array() ) {
1066          $situation = array(
1067              'situation' => _x( 'Situations', 'Email post type', 'buddypress' )
1068          );
1069  
1070          // Inject our 'Situations' column just before the last 'Date' column.
1071          return array_slice( $columns, 0, -1, true ) + $situation + array_slice( $columns, -1, null, true );
1072      }
1073  
1074      /**
1075       * Output column data for our custom 'Situations' column.
1076       *
1077       * @since 2.6.0
1078       *
1079       * @param string $column  Current column name.
1080       * @param int    $post_id Current post ID.
1081       */
1082  	public function emails_display_situation_column_data( $column = '', $post_id = 0 ) {
1083          if ( 'situation' !== $column ) {
1084              return;
1085          }
1086  
1087          // Grab email situations for the current post.
1088          $situations = wp_list_pluck( get_the_terms( $post_id, bp_get_email_tax_type() ), 'description' );
1089  
1090          // Output each situation as a list item.
1091          echo '<ul><li>';
1092          echo implode( '</li><li>', $situations );
1093          echo '</li></ul>';
1094      }
1095  
1096      /** Helpers ***************************************************************/
1097  
1098      /**
1099       * Return true/false based on whether a query argument is set.
1100       *
1101       * @see bp_do_activation_redirect()
1102       *
1103       * @since 2.2.0
1104       *
1105       * @return bool
1106       */
1107  	public static function is_new_install() {
1108          return (bool) isset( $_GET['is_new_install'] );
1109      }
1110  
1111      /**
1112       * Return a user-friendly version-number string, for use in translations.
1113       *
1114       * @since 2.2.0
1115       *
1116       * @return string
1117       */
1118  	public static function display_version() {
1119  
1120          // Use static variable to prevent recalculations.
1121          static $display = '';
1122  
1123          // Only calculate on first run.
1124          if ( '' === $display ) {
1125  
1126              // Get current version.
1127              $version = bp_get_version();
1128  
1129              // Check for prerelease hyphen.
1130              $pre     = strpos( $version, '-' );
1131  
1132              // Strip prerelease suffix.
1133              $display = ( false !== $pre )
1134                  ? substr( $version, 0, $pre )
1135                  : $version;
1136          }
1137  
1138          // Done!
1139          return $display;
1140      }
1141  
1142      /**
1143       * Add Emails menu item to custom menus array.
1144       *
1145       * Several BuddyPress components have top-level menu items in the Dashboard,
1146       * which all appear together in the middle of the Dashboard menu. This function
1147       * adds the Emails screen to the array of these menu items.
1148       *
1149       * @since 2.4.0
1150       *
1151       * @param array $custom_menus The list of top-level BP menu items.
1152       * @return array $custom_menus List of top-level BP menu items, with Emails added.
1153       */
1154  	public function emails_admin_menu_order( $custom_menus = array() ) {
1155          array_push( $custom_menus, 'edit.php?post_type=' . bp_get_email_post_type() );
1156  
1157          if ( is_network_admin() && bp_is_network_activated() ) {
1158              array_push(
1159                  $custom_menus,
1160                  get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() )
1161              );
1162          }
1163  
1164          return $custom_menus;
1165      }
1166  
1167      /**
1168       * Register styles commonly used by BuddyPress wp-admin screens.
1169       *
1170       * @since 2.5.0
1171       */
1172  	public function admin_register_styles() {
1173          $min = bp_core_get_minified_asset_suffix();
1174          $url = $this->css_url;
1175  
1176          /**
1177           * Filters the BuddyPress Core Admin CSS file path.
1178           *
1179           * @since 1.6.0
1180           *
1181           * @param string $file File path for the admin CSS.
1182           */
1183          $common_css = apply_filters( 'bp_core_admin_common_css', "{$url}common{$min}.css" );
1184  
1185          /**
1186           * Filters the BuddyPress admin stylesheet files to register.
1187           *
1188           * @since 2.5.0
1189           *
1190           * @param array $value Array of admin stylesheet file information to register.
1191           */
1192          $styles = apply_filters( 'bp_core_admin_register_styles', array(
1193              // Legacy.
1194              'bp-admin-common-css' => array(
1195                  'file'         => $common_css,
1196                  'dependencies' => array(),
1197              ),
1198  
1199              // 2.5
1200              'bp-customizer-controls' => array(
1201                  'file'         => "{$url}customizer-controls{$min}.css",
1202                  'dependencies' => array(),
1203              ),
1204  
1205              // 3.0
1206              'bp-hello-css' => array(
1207                  'file'         => "{$url}hello{$min}.css",
1208                  'dependencies' => array( 'bp-admin-common-css', 'thickbox' ),
1209              ),
1210          ) );
1211  
1212          $version = bp_get_version();
1213  
1214          foreach ( $styles as $id => $style ) {
1215              wp_register_style( $id, $style['file'], $style['dependencies'], $version );
1216              wp_style_add_data( $id, 'rtl', 'replace' );
1217  
1218              if ( $min ) {
1219                  wp_style_add_data( $id, 'suffix', $min );
1220              }
1221          }
1222      }
1223  
1224      /**
1225       * Register JS commonly used by BuddyPress wp-admin screens.
1226       *
1227       * @since 2.5.0
1228       */
1229  	public function admin_register_scripts() {
1230          $min = bp_core_get_minified_asset_suffix();
1231          $url = $this->js_url;
1232  
1233          /**
1234           * Filters the BuddyPress admin JS files to register.
1235           *
1236           * @since 2.5.0
1237           *
1238           * @param array $value Array of admin JS file information to register.
1239           */
1240          $scripts = apply_filters( 'bp_core_admin_register_scripts', array(
1241              // 2.5
1242              'bp-customizer-controls' => array(
1243                  'file'         => "{$url}customizer-controls{$min}.js",
1244                  'dependencies' => array( 'jquery' ),
1245                  'footer'       => true,
1246              ),
1247  
1248              // 3.0
1249              'bp-hello-js' => array(
1250                  'file'         => "{$url}hello{$min}.js",
1251                  'dependencies' => array( 'thickbox', 'bp-api-request' ),
1252                  'footer'       => true,
1253              ),
1254          ) );
1255  
1256          $version = bp_get_version();
1257  
1258          foreach ( $scripts as $id => $script ) {
1259              wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
1260          }
1261      }
1262  }
1263  endif; // End class_exists check.


Generated: Sun Jul 5 01:02:21 2020 Cross-referenced by PHPXref 0.7.1