[ 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      =  preg_replace( '/-.*/', '', bp_get_version() );
 632          $version_slug = 'version-' . str_replace( '.', '-', $version );
 633      ?>
 634  
 635          <div id="bp-hello-container">
 636              <div id="plugin-information-scrollable">
 637                  <div id='plugin-information-title' class="with-banner">
 638                      <div class='vignette'></div>
 639                      <h2>
 640                          <?php printf(
 641                              /* translators: %s is the placeholder for the BuddyPress version number. */
 642                              esc_html__( 'BuddyPress %s', 'buddypress' ),
 643                              $version
 644                          ); ?>
 645                      </h2>
 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( 'Introducing the BP REST API', 'buddypress' ); ?></h2>
 657                          <figure class="bp-hello-alignleft">
 658                              <div class="dashicons dashicons-rest-api big"></div>
 659                          </figure>
 660                          <p>
 661                              <?php esc_html_e( 'BuddyPress 5.0.0 comes with REST API endpoints for members, groups, activities, users, private messages, screen notifications and extended profiles.', 'buddypress' ); ?>
 662                          </p>
 663                          <p>
 664                              <?php esc_html_e( 'BuddyPress endpoints provide machine-readable external access to your WordPress site with a clear, standards-driven interface, paving the way for new and innovative methods of interacting with your community through plugins, themes, apps, and beyond.', 'buddypress' ); ?>
 665                              <?php printf(
 666                                  /* translators: %s is the placeholder for the link to the BP REST API documentation site. */
 667                                  esc_html__( 'Ready to get started with development? Check out the %s.', 'buddypress' ),
 668                                  sprintf(
 669                                      '<a href="%1$s">%2$s</a>',
 670                                      esc_url( 'https://developer.buddypress.org/bp-rest-api/' ),
 671                                      esc_html__( 'BP REST API reference', 'buddypress' )
 672                                  )
 673                              ); ?>
 674                          </p>
 675  
 676                          <hr class="bp-hello-divider"/>
 677  
 678                          <h2><?php esc_html_e( 'A new interface for managing group members.', 'buddypress' ); ?></h2>
 679                          <p>
 680                              <?php esc_html_e( 'The best way to show the power of the BP REST API is to start using it for one of our Core features.', 'buddypress' ); ?>
 681                          </p>
 682                          <figure class="bp-hello-aligncenter">
 683                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/manage-members-interface.png' ); ?>" alt="<?php esc_attr_e( 'Screenshot of the Group Members management interface in the administration and on the front-end of your site.', 'buddypress' ); ?>" />
 684                          </figure>
 685                          <p>
 686                              <?php esc_html_e( 'Group administrators will love our new interface for managing group membership. Whether you\'re working as a group admin on the front-end Manage tab, or as the site admin on the Dashboard, the new REST API-based tools are faster, easier to use, and more consistent.', 'buddypress' ); ?>
 687                          </p>
 688  
 689                          <hr class="bp-hello-divider"/>
 690  
 691                          <h2><?php esc_html_e( 'Improved Group invites and membership requests.', 'buddypress' ); ?></h2>
 692                          <figure class="bp-hello-alignright">
 693                              <div class="dashicons dashicons-buddicons-groups big"></div>
 694                          </figure>
 695                          <p>
 696                              <?php esc_html_e( 'Thanks to the new BP Invitations API, Group invites and membership requests are now managed in a more consistent way.', 'buddypress' ); ?>
 697                          </p>
 698                          <p>
 699                              <?php esc_html_e( 'The BP Invitations API abstracts how these two actions are handled and allows developers to use them for any object on your site (e.g., Sites of a WordPress network).', 'buddypress' ); ?>
 700                              <?php printf(
 701                                  /* translators: %s is the placeholder for the link to the BP Invitations API development note. */
 702                                  esc_html__( 'Read more about the %s.', 'buddypress' ),
 703                                  sprintf(
 704                                      '<a href="%1$s">%2$s</a>',
 705                                      esc_url( 'https://bpdevel.wordpress.com/2019/09/16/new-invitations-api-coming-in-buddypress-5-0/' ),
 706                                      esc_html__( 'BP Invitations API', 'buddypress' )
 707                                  )
 708                              ); ?>
 709                          </p>
 710  
 711                          <hr class="bp-hello-divider"/>
 712  
 713                          <h2><?php esc_html_e( 'Help our support volunteers help you.', 'buddypress' ); ?></h2>
 714                          <p>
 715                              <?php esc_html_e( 'Knowing your WordPress and BuddyPress configuration is very important when one of our beloved support volunteers tries to help you fix an issue. That\'s why we added a BuddyPress section to the Site Health Info Administration screen.', 'buddypress' ); ?>
 716                          </p>
 717                          <figure class="bp-hello-aligncenter">
 718                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/site-health-buddypress-section.png' ); ?>" alt="<?php esc_attr_e( 'Screenshot of the BuddyPress section of the Site Health Info Administration screen.', 'buddypress' ); ?>" />
 719                          </figure>
 720                          <p>
 721                              <?php esc_html_e( 'The panel is displayed at the bottom of the screen. It includes the BuddyPress version, active components, active template pack, and a list of other component-specific settings information.', 'buddypress' ); ?>
 722                          </p>
 723  
 724                          <hr class="bp-hello-divider"/>
 725  
 726                          <h2><?php esc_html_e( 'Improved integrations with WordPress', 'buddypress' ); ?></h2>
 727                          <figure class="bp-hello-aligncenter">
 728                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-nouveau-improvements.png' );?>" alt="<?php esc_attr_e( 'Screenshot of the BuddyPress members directory & Password control in Twenty Ninteen.', 'buddypress' ); ?>" />
 729                          </figure>
 730  
 731                          <p>
 732                              <?php esc_html_e( 'In BuddyPress 5.0.0, the BP Nouveau template pack looks better than ever with the Twenty Nineteen theme.', 'buddypress' ); ?>
 733                              <?php esc_html_e( 'Nouveau also now uses the same password control as the one used in WordPress Core, for better consistency between BuddyPress and WordPress spaces.', 'buddypress' ); ?>
 734                          </p>
 735  
 736                          <p>
 737                              <strong><?php esc_html_e( 'BuddyPress Blocks now have their own category into the Block Editor.', 'buddypress' ); ?></strong>
 738                          </p>
 739                          <figure class="bp-hello-aligncenter">
 740                              <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/buddypress-blocks-category.png' ); ?>" alt="<?php esc_attr_e( 'Screenshot of the BuddyPress block category.', 'buddypress' ); ?>" />
 741                          </figure>
 742                          <p>
 743                              <?php esc_html_e( 'Developers building tools for the Block Editor can now add their blocks to the BuddyPress category. This change provides a foundation for organizing custom BuddyPress blocks.', 'buddypress' ); ?>
 744                              <?php printf(
 745                                  /* translators: %s is the placeholder for the link to the blocks category development note. */
 746                                  esc_html__( 'Read more about this feature in the %s.', 'buddypress' ),
 747                                  sprintf(
 748                                      '<a href="%1$s">%2$s</a>',
 749                                      esc_url( 'https://bpdevel.wordpress.com/2019/07/31/a-category-to-store-your-buddypress-blocks/' ),
 750                                      esc_html__( 'development note', 'buddypress' )
 751                                  )
 752                              ); ?>
 753                          </p>
 754  
 755                          <hr class="bp-hello-divider"/>
 756  
 757                          <h2><?php echo esc_html( _x( 'Your feedback', 'screen heading', 'buddypress' ) ); ?></h2>
 758                          <p>
 759                              <?php
 760                              printf(
 761                                  /* translators: %s is the placeholder for the link to BuddyPress support forums. */
 762                                  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' ),
 763                                  sprintf(
 764                                      '<a href="%1$s">%2$s</a>',
 765                                      esc_url( 'https://buddypress.org/support/' ),
 766                                      esc_html__( 'share your feedback', 'buddypress' )
 767                                  )
 768                              );
 769                              ?>
 770                          </p>
 771                          <p><?php esc_html_e( 'Thank you for using BuddyPress! 😊', 'buddypress' ); ?></p>
 772  
 773                          <br /><br />
 774                      </div>
 775                  </div>
 776              </div>
 777              <div id="plugin-information-footer">
 778                  <div class="bp-hello-social-cta">
 779                      <p>
 780                          <?php
 781                          printf(
 782                              /* translators: 1: heart dashicons. 2: BP Credits screen url. 3: number of BuddyPress contributors to this version. */
 783                              _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>.', 28, 'buddypress' ),
 784                              '<span class="dashicons dashicons-heart"></span>',
 785                              esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
 786                              number_format_i18n( 28 )
 787                          );
 788                          ?>
 789                      </p>
 790                  </div>
 791  
 792                  <div class="bp-hello-social-links">
 793                      <ul class="bp-hello-social">
 794                          <li>
 795                              <?php
 796                              printf(
 797                                  '<a class="twitter bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 798                                  esc_attr__( 'Follow BuddyPress on Twitter', 'buddypress' ),
 799                                  esc_url( 'https://twitter.com/buddypress' ),
 800                                  esc_html__( 'Follow BuddyPress on Twitter', 'buddypress' )
 801                              );
 802                              ?>
 803                          </li>
 804  
 805                          <li>
 806                              <?php
 807                              printf(
 808                                  '<a class="support bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 809                                  esc_attr__( 'Visit the Support Forums', 'buddypress' ),
 810                                  esc_url( 'https://buddypress.org/support/' ),
 811                                  esc_html__( 'Visit the Support Forums', 'buddypress' )
 812                              );
 813                              ?>
 814                          </li>
 815                      </ul>
 816                  </div>
 817              </div>
 818          </div>
 819  
 820          <?php
 821      }
 822  
 823      /**
 824       * Output the credits screen.
 825       *
 826       * Hardcoding this in here is pretty janky. It's fine for now, but we'll
 827       * want to leverage api.wordpress.org eventually.
 828       *
 829       * @since 1.7.0
 830       */
 831  	public function credits_screen() {
 832      ?>
 833  
 834          <div class="wrap bp-about-wrap">
 835  
 836          <h1><?php _e( 'BuddyPress Settings', 'buddypress' ); ?> </h1>
 837  
 838          <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Credits', 'buddypress' ) ); ?></h2>
 839  
 840              <p class="about-description"><?php _e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p>
 841  
 842              <h3 class="wp-people-group"><?php _e( 'Project Leaders', 'buddypress' ); ?></h3>
 843              <ul class="wp-people-group " id="wp-people-group-project-leaders">
 844                  <li class="wp-person" id="wp-person-johnjamesjacoby">
 845                      <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7a2644fb53ae2f7bfd7143b504af396c?s=120">
 846                      John James Jacoby</a>
 847                      <span class="title"><?php _e( 'Project Lead', 'buddypress' ); ?></span>
 848                  </li>
 849                  <li class="wp-person" id="wp-person-boonebgorges">
 850                      <a class="web" href="https://profiles.wordpress.org/boonebgorges"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=120">
 851                      Boone B. Gorges</a>
 852                      <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
 853                  </li>
 854                  <li class="wp-person" id="wp-person-djpaul">
 855                      <a class="web" href="https://profiles.wordpress.org/djpaul"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3bc9ab796299d67ce83dceb9554f75df?s=120">
 856                      Paul Gibbs</a>
 857                      <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
 858                  </li>
 859              </ul>
 860  
 861              <h3 class="wp-people-group"><?php _e( 'BuddyPress Team', 'buddypress' ); ?></h3>
 862              <ul class="wp-people-group " id="wp-people-group-core-team">
 863                  <li class="wp-person" id="wp-person-r-a-y">
 864                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3bfa556a62b5bfac1012b6ba5f42ebfa?s=120">
 865                      Ray</a>
 866                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 867                  </li>
 868                  <li class="wp-person" id="wp-person-hnla">
 869                      <a class="web" href="https://profiles.wordpress.org/hnla"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3860c955aa3f79f13b92826ae47d07fe?s=120">
 870                      Hugo Ashmore</a>
 871                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 872                  </li>
 873                  <li class="wp-person" id="wp-person-imath">
 874                      <a class="web" href="https://profiles.wordpress.org/imath"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8b208ca408dad63888253ee1800d6a03?s=120">
 875                      Mathieu Viet</a>
 876                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 877                  </li>
 878                  <li class="wp-person" id="wp-person-mercime">
 879                      <a class="web" href="https://profiles.wordpress.org/mercime"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/fae451be6708241627983570a1a1817a?s=120">
 880                      Mercime</a>
 881                      <span class="title"><?php _e( 'Navigator', 'buddypress' ); ?></span>
 882                  </li>
 883                  <li class="wp-person" id="wp-person-dcavins">
 884                      <a class="web" href="https://profiles.wordpress.org/dcavins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5fa7e83d59cb45ebb616235a176595a?s=120">
 885                      David Cavins</a>
 886                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 887                  </li>
 888                  <li class="wp-person" id="wp-person-tw2113">
 889                      <a class="web" href="https://profiles.wordpress.org/tw2113"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5d7c934621fa1c025b83ee79bc62366?s=120">
 890                      Michael Beckwith</a>
 891                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 892                  </li>
 893                  <li class="wp-person" id="wp-person-henry-wright">
 894                      <a class="web" href="https://profiles.wordpress.org/henry.wright"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0da2f1a9340d6af196b870f6c107a248?s=120">
 895                      Henry Wright</a>
 896                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 897                  </li>
 898                  <li class="wp-person" id="wp-person-danbp">
 899                      <a class="web" href="https://profiles.wordpress.org/danbp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0deae2e7003027fbf153500cd3fa5501?s=120">
 900                      danbp</a>
 901                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 902                  </li>
 903                  <li class="wp-person" id="wp-person-shanebp">
 904                      <a class="web" href="https://profiles.wordpress.org/shanebp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ffd294ab5833ba14aaf175f9acc71cc4?s=120">
 905                      shanebp</a>
 906                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 907                  </li>
 908                  <li class="wp-person" id="wp-person-slaffik">
 909                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/61fb07ede3247b63f19015f200b3eb2c?s=120">
 910                      Slava Abakumov</a>
 911                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 912                  </li>
 913                  <li class="wp-person" id="wp-person-offereins">
 914                      <a class="web" href="https://profiles.wordpress.org/Offereins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/2404ed0a35bb41aedefd42b0a7be61c1?s=120">
 915                      Laurens Offereins</a>
 916                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 917                  </li>
 918                  <li class="wp-person" id="wp-person-netweb">
 919                      <a class="web" href="https://profiles.wordpress.org/netweb"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=120">
 920                      Stephen Edgar</a>
 921                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 922                  </li>
 923                  <li class="wp-person" id="wp-person-espellcaste">
 924                      <a class="web" href="https://profiles.wordpress.org/espellcaste"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/b691e67be0ba5cad6373770656686bc3?s=120">
 925                      Renato Alves</a>
 926                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 927                  </li>
 928                  <li class="wp-person" id="wp-person-venutius">
 929                      <a class="web" href="https://profiles.wordpress.org/venutius"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/6a7c42a77fd94b82b217a7a97afdddbc?s=120">
 930                      Venutius</a>
 931                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 932                  </li>
 933              </ul>
 934  
 935              <h3 class="wp-people-group"><?php _e( 'Recent Rockstars', 'buddypress' ); ?></h3>
 936              <ul class="wp-people-group " id="wp-people-group-rockstars">
 937                  <li class="wp-person" id="wp-person-dimensionmedia">
 938                      <a class="web" href="https://profiles.wordpress.org/dimensionmedia"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7735aada1ec39d0c1118bd92ed4551f1?s=120">
 939                      David Bisset</a>
 940                  </li>
 941                  <li class="wp-person" id="wp-person-garrett-eclipse">
 942                      <a class="web" href="https://profiles.wordpress.org/garrett-eclipse"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7f68f24441c61514d5d0e1451bb5bc9d?s=120">
 943                      Garrett Hyder</a>
 944                  </li>
 945                  <li class="wp-person" id="wp-person-thebrandonallen">
 946                      <a class="web" href="https://profiles.wordpress.org/thebrandonallen"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/6d3f77bf3c9ca94c406dea401b566950?s=120">
 947                      Brandon Allen</a>
 948                  </li>
 949                  <li class="wp-person" id="wp-person-ramiy">
 950                      <a class="web" href="https://profiles.wordpress.org/ramiy"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ce2a269e424156d79cb0c4e1d4d82db1?s=120">
 951                      Rami Yushuvaev</a>
 952                  </li>
 953                  <li class="wp-person" id="wp-person-vapvarun">
 954                      <a class="web" href="https://profiles.wordpress.org/vapvarun"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/78a3bf7eb3a1132fc667f96f2631e448?s=120">
 955                      Vapvarun</a>
 956                  </li>
 957              </ul>
 958  
 959              <h3 class="wp-people-group">
 960                  <?php
 961                  printf(
 962                      /* translators: %s: BuddyPress version number */
 963                      esc_html__( 'Contributors to BuddyPress %s', 'buddypress' ),
 964                      self::display_version()
 965                  );
 966                  ?>
 967              </h3>
 968              <p class="wp-credits-list">
 969                  <a href="https://github.com/baconbro">baconbro</a>,
 970                  <a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
 971                  <a href="https://profiles.wordpress.org/joncadams/">boop (joncadams)</a>,
 972                  <a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
 973                  <a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
 974                  <a href="https://profiles.wordpress.org/ericlewis/">Eric Lewis (ericlewis)</a>,
 975                  <a href="https://profiles.wordpress.org/geminorum/">geminorum</a>,
 976                  <a href="https://profiles.wordpress.org/gingerbooch/">gingerbooch</a>,
 977                  <a href="https://profiles.wordpress.org/ivinco/">Ivinco</a>,
 978                  <a href="https://profiles.wordpress.org/whyisjake/">Jake Spurlock (whyisjake)</a>,
 979                  <a href="https://profiles.wordpress.org/JarretC/">Jarret (JarretC)</a>,
 980                  <a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
 981                  <a href="https://profiles.wordpress.org/klawton/">klawton</a>,
 982                  <a href="https://profiles.wordpress.org/kristianngve/">Kristian Yngve (kristianngve)</a>,
 983                  <a href="https://profiles.wordpress.org/maniou/">Maniou</a>,
 984                  <a href="https://profiles.wordpress.org/netweblogic/">Marcus (netweblogic)</a>,
 985                  <a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
 986                  <a href="https://github.com/bhoot-biswas">Mithun Biswas</a>,
 987                  <a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
 988                  <a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
 989                  <a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
 990                  <a href="https://profiles.wordpress.org/razor90/">razor90</a>,
 991                  <a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
 992                  <a href="https://profiles.wordpress.org/slaFFik/">Slava Abakumov (slaFFik)</a>,
 993                  <a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
 994                  <a href="https://profiles.wordpress.org/truchot/">truchot</a>,
 995                  <a href="https://profiles.wordpress.org/venutius/">Venutius</a>,
 996                  <a href="https://profiles.wordpress.org/wegosi/">wegosi</a>,
 997              </p>
 998  
 999              <h3 class="wp-people-group"><?php _e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
1000              <p class="wp-credits-list">
1001                  <a href="https://github.com/ichord/At.js">At.js</a>,
1002                  <a href="https://bbpress.org">bbPress</a>,
1003                  <a href="https://github.com/ichord/Caret.js">Caret.js</a>,
1004                  <a href="https://tedgoas.github.io/Cerberus/">Cerberus</a>,
1005                  <a href="https://ionicons.com/">Ionicons</a>,
1006                  <a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
1007                  <a href="https://mattbradley.github.io/livestampjs/">Livestamp.js</a>,
1008                  <a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
1009                  <a href="https://momentjs.com/">Moment.js</a>,
1010                  <a href="https://wordpress.org">WordPress</a>.
1011              </p>
1012  
1013              <h3 class="wp-people-group"><?php _e( 'Contributor Emeriti', 'buddypress' ); ?></h3>
1014              <ul class="wp-people-group " id="wp-people-group-emeriti">
1015                  <li class="wp-person" id="wp-person-apeatling">
1016                      <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=120">
1017                      Andy Peatling</a>
1018                      <span class="title"><?php _e( 'Project Founder', 'buddypress' ); ?></span>
1019                  </li>
1020                  <li class="wp-person" id="wp-person-burtadsit">
1021                      <a class="web" href="https://profiles.wordpress.org/burtadsit"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/185e1d3e2d653af9d49a4e8e4fc379df?s=120">
1022                      Burt Adsit</a>
1023                  </li>
1024                  <li class="wp-person" id="wp-person-jeffsayre">
1025                      <a class="web" href="https://profiles.wordpress.org/jeffsayre"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8e009a84ff5d245c22a69c7df6ab45f7?s=120">
1026                      Jeff Sayre</a>
1027                  </li>
1028                  <li class="wp-person" id="wp-person-karmatosed">
1029                      <a class="web" href="https://profiles.wordpress.org/karmatosed"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ca7d4273a689cdbf524d8332771bb1ca?s=120">
1030                      Tammie Lister</a>
1031                  </li>
1032                  <li class="wp-person" id="wp-person-modemlooper">
1033                      <a class="web" href="https://profiles.wordpress.org/modemlooper"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/1c07be1016e845de514931477c939307?s=120">
1034                      modemlooper</a>
1035                  </li>
1036              </ul>
1037          </div>
1038  
1039          <?php
1040      }
1041  
1042      /** Emails ****************************************************************/
1043  
1044      /**
1045       * Registers 'Situations' column on Emails dashboard page.
1046       *
1047       * @since 2.6.0
1048       *
1049       * @param array $columns Current column data.
1050       * @return array
1051       */
1052  	public function emails_register_situation_column( $columns = array() ) {
1053          $situation = array(
1054              'situation' => _x( 'Situations', 'Email post type', 'buddypress' )
1055          );
1056  
1057          // Inject our 'Situations' column just before the last 'Date' column.
1058          return array_slice( $columns, 0, -1, true ) + $situation + array_slice( $columns, -1, null, true );
1059      }
1060  
1061      /**
1062       * Output column data for our custom 'Situations' column.
1063       *
1064       * @since 2.6.0
1065       *
1066       * @param string $column  Current column name.
1067       * @param int    $post_id Current post ID.
1068       */
1069  	public function emails_display_situation_column_data( $column = '', $post_id = 0 ) {
1070          if ( 'situation' !== $column ) {
1071              return;
1072          }
1073  
1074          // Grab email situations for the current post.
1075          $situations = wp_list_pluck( get_the_terms( $post_id, bp_get_email_tax_type() ), 'description' );
1076  
1077          // Output each situation as a list item.
1078          echo '<ul><li>';
1079          echo implode( '</li><li>', $situations );
1080          echo '</li></ul>';
1081      }
1082  
1083      /** Helpers ***************************************************************/
1084  
1085      /**
1086       * Return true/false based on whether a query argument is set.
1087       *
1088       * @see bp_do_activation_redirect()
1089       *
1090       * @since 2.2.0
1091       *
1092       * @return bool
1093       */
1094  	public static function is_new_install() {
1095          return (bool) isset( $_GET['is_new_install'] );
1096      }
1097  
1098      /**
1099       * Return a user-friendly version-number string, for use in translations.
1100       *
1101       * @since 2.2.0
1102       *
1103       * @return string
1104       */
1105  	public static function display_version() {
1106  
1107          // Use static variable to prevent recalculations.
1108          static $display = '';
1109  
1110          // Only calculate on first run.
1111          if ( '' === $display ) {
1112  
1113              // Get current version.
1114              $version = bp_get_version();
1115  
1116              // Check for prerelease hyphen.
1117              $pre     = strpos( $version, '-' );
1118  
1119              // Strip prerelease suffix.
1120              $display = ( false !== $pre )
1121                  ? substr( $version, 0, $pre )
1122                  : $version;
1123          }
1124  
1125          // Done!
1126          return $display;
1127      }
1128  
1129      /**
1130       * Add Emails menu item to custom menus array.
1131       *
1132       * Several BuddyPress components have top-level menu items in the Dashboard,
1133       * which all appear together in the middle of the Dashboard menu. This function
1134       * adds the Emails screen to the array of these menu items.
1135       *
1136       * @since 2.4.0
1137       *
1138       * @param array $custom_menus The list of top-level BP menu items.
1139       * @return array $custom_menus List of top-level BP menu items, with Emails added.
1140       */
1141  	public function emails_admin_menu_order( $custom_menus = array() ) {
1142          array_push( $custom_menus, 'edit.php?post_type=' . bp_get_email_post_type() );
1143  
1144          if ( is_network_admin() && bp_is_network_activated() ) {
1145              array_push(
1146                  $custom_menus,
1147                  get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() )
1148              );
1149          }
1150  
1151          return $custom_menus;
1152      }
1153  
1154      /**
1155       * Register styles commonly used by BuddyPress wp-admin screens.
1156       *
1157       * @since 2.5.0
1158       */
1159  	public function admin_register_styles() {
1160          $min = bp_core_get_minified_asset_suffix();
1161          $url = $this->css_url;
1162  
1163          /**
1164           * Filters the BuddyPress Core Admin CSS file path.
1165           *
1166           * @since 1.6.0
1167           *
1168           * @param string $file File path for the admin CSS.
1169           */
1170          $common_css = apply_filters( 'bp_core_admin_common_css', "{$url}common{$min}.css" );
1171  
1172          /**
1173           * Filters the BuddyPress admin stylesheet files to register.
1174           *
1175           * @since 2.5.0
1176           *
1177           * @param array $value Array of admin stylesheet file information to register.
1178           */
1179          $styles = apply_filters( 'bp_core_admin_register_styles', array(
1180              // Legacy.
1181              'bp-admin-common-css' => array(
1182                  'file'         => $common_css,
1183                  'dependencies' => array(),
1184              ),
1185  
1186              // 2.5
1187              'bp-customizer-controls' => array(
1188                  'file'         => "{$url}customizer-controls{$min}.css",
1189                  'dependencies' => array(),
1190              ),
1191  
1192              // 3.0
1193              'bp-hello-css' => array(
1194                  'file'         => "{$url}hello{$min}.css",
1195                  'dependencies' => array( 'bp-admin-common-css', 'thickbox' ),
1196              ),
1197          ) );
1198  
1199          $version = bp_get_version();
1200  
1201          foreach ( $styles as $id => $style ) {
1202              wp_register_style( $id, $style['file'], $style['dependencies'], $version );
1203              wp_style_add_data( $id, 'rtl', 'replace' );
1204  
1205              if ( $min ) {
1206                  wp_style_add_data( $id, 'suffix', $min );
1207              }
1208          }
1209      }
1210  
1211      /**
1212       * Register JS commonly used by BuddyPress wp-admin screens.
1213       *
1214       * @since 2.5.0
1215       */
1216  	public function admin_register_scripts() {
1217          $min = bp_core_get_minified_asset_suffix();
1218          $url = $this->js_url;
1219  
1220          /**
1221           * Filters the BuddyPress admin JS files to register.
1222           *
1223           * @since 2.5.0
1224           *
1225           * @param array $value Array of admin JS file information to register.
1226           */
1227          $scripts = apply_filters( 'bp_core_admin_register_scripts', array(
1228              // 2.5
1229              'bp-customizer-controls' => array(
1230                  'file'         => "{$url}customizer-controls{$min}.js",
1231                  'dependencies' => array( 'jquery' ),
1232                  'footer'       => true,
1233              ),
1234  
1235              // 3.0
1236              'bp-hello-js' => array(
1237                  'file'         => "{$url}hello{$min}.js",
1238                  'dependencies' => array( 'thickbox', 'bp-api-request' ),
1239                  'footer'       => true,
1240              ),
1241          ) );
1242  
1243          $version = bp_get_version();
1244  
1245          foreach ( $scripts as $id => $script ) {
1246              wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
1247          }
1248      }
1249  }
1250  endif; // End class_exists check.


Generated: Mon Apr 6 01:01:29 2020 Cross-referenced by PHPXref 0.7.1