[ 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          /* XProfile Section **************************************************/
 398  
 399          if ( bp_is_active( 'xprofile' ) ) {
 400  
 401              // Add the main section.
 402              add_settings_section( 'bp_xprofile', _x( 'Profile Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' );
 403  
 404              // Avatars.
 405              add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_xprofile' );
 406              register_setting( 'buddypress', 'bp-disable-avatar-uploads', 'intval' );
 407  
 408              // Cover images.
 409              if ( bp_is_active( 'xprofile', 'cover_image' ) ) {
 410                  add_settings_field( 'bp-disable-cover-image-uploads', __( 'Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_cover_image_uploads', 'buddypress', 'bp_xprofile' );
 411                  register_setting( 'buddypress', 'bp-disable-cover-image-uploads', 'intval' );
 412              }
 413  
 414              // Profile sync setting.
 415              add_settings_field( 'bp-disable-profile-sync',   __( 'Profile Syncing',  'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile' );
 416              register_setting  ( 'buddypress', 'bp-disable-profile-sync', 'intval' );
 417          }
 418  
 419          /* Groups Section ****************************************************/
 420  
 421          if ( bp_is_active( 'groups' ) ) {
 422  
 423              // Add the main section.
 424              add_settings_section( 'bp_groups', __( 'Groups Settings',  'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
 425  
 426              // Allow subscriptions setting.
 427              add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation',   'buddypress', 'bp_groups' );
 428              register_setting( 'buddypress', 'bp_restrict_group_creation', 'intval' );
 429  
 430              // Allow group avatars.
 431              add_settings_field( 'bp-disable-group-avatar-uploads', __( 'Group Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_avatar_uploads', 'buddypress', 'bp_groups' );
 432              register_setting( 'buddypress', 'bp-disable-group-avatar-uploads', 'intval' );
 433  
 434              // Allow group cover images.
 435              if ( bp_is_active( 'groups', 'cover_image' ) ) {
 436                  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' );
 437                  register_setting( 'buddypress', 'bp-disable-group-cover-image-uploads', 'intval' );
 438              }
 439          }
 440  
 441          /* Activity Section **************************************************/
 442  
 443          if ( bp_is_active( 'activity' ) ) {
 444  
 445              // Add the main section.
 446              add_settings_section( 'bp_activity', __( 'Activity Settings', 'buddypress' ), 'bp_admin_setting_callback_activity_section', 'buddypress' );
 447  
 448              // Activity commenting on post and comments.
 449              add_settings_field( 'bp-disable-blogforum-comments', __( 'Post Comments', 'buddypress' ), 'bp_admin_setting_callback_blogforum_comments', 'buddypress', 'bp_activity' );
 450              register_setting( 'buddypress', 'bp-disable-blogforum-comments', 'bp_admin_sanitize_callback_blogforum_comments' );
 451  
 452              // Activity Heartbeat refresh.
 453              add_settings_field( '_bp_enable_heartbeat_refresh', __( 'Activity auto-refresh', 'buddypress' ), 'bp_admin_setting_callback_heartbeat', 'buddypress', 'bp_activity' );
 454              register_setting( 'buddypress', '_bp_enable_heartbeat_refresh', 'intval' );
 455  
 456              // Allow activity akismet.
 457              if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) {
 458                  add_settings_field( '_bp_enable_akismet', __( 'Akismet', 'buddypress' ), 'bp_admin_setting_callback_activity_akismet', 'buddypress', 'bp_activity' );
 459                  register_setting( 'buddypress', '_bp_enable_akismet', 'intval' );
 460              }
 461          }
 462      }
 463  
 464      /**
 465       * Add a link to BuddyPress Hello to the admin bar.
 466       *
 467       * @since 1.9.0
 468       * @since 3.0.0 Hooked at priority 100 (was 15).
 469       *
 470       * @param WP_Admin_Bar $wp_admin_bar
 471       */
 472  	public function admin_bar_about_link( $wp_admin_bar ) {
 473          if ( ! is_user_logged_in() ) {
 474              return;
 475          }
 476  
 477          $wp_admin_bar->add_node( array(
 478              'parent' => 'wp-logo',
 479              'id'     => 'bp-about',
 480              'title'  => esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ),
 481              'href'   => bp_get_admin_url( '?hello=buddypress' ),
 482              'meta'   => array(
 483                  'class' => 'say-hello-buddypress',
 484              ),
 485          ) );
 486      }
 487  
 488      /**
 489       * Add Settings link to plugins area.
 490       *
 491       * @since 1.6.0
 492       *
 493       * @param array  $links Links array in which we would prepend our link.
 494       * @param string $file  Current plugin basename.
 495       * @return array Processed links.
 496       */
 497  	public function modify_plugin_action_links( $links, $file ) {
 498  
 499          // Return normal links if not BuddyPress.
 500          if ( plugin_basename( buddypress()->basename ) != $file ) {
 501              return $links;
 502          }
 503  
 504          // Add a few links to the existing links array.
 505          return array_merge( $links, array(
 506              'settings' => '<a href="' . esc_url( add_query_arg( array( 'page' => 'bp-components' ), bp_get_admin_url( $this->settings_page ) ) ) . '">' . esc_html__( 'Settings', 'buddypress' ) . '</a>',
 507              'about'    => '<a href="' . esc_url( bp_get_admin_url( '?hello=buddypress' ) ) . '">' . esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ) . '</a>'
 508          ) );
 509      }
 510  
 511      /**
 512       * Add some general styling to the admin area.
 513       *
 514       * @since 1.6.0
 515       */
 516  	public function admin_head() {
 517  
 518          // Settings pages.
 519          remove_submenu_page( $this->settings_page, 'bp-page-settings' );
 520          remove_submenu_page( $this->settings_page, 'bp-settings'      );
 521          remove_submenu_page( $this->settings_page, 'bp-credits'       );
 522  
 523          // Network Admin Tools.
 524          remove_submenu_page( 'network-tools', 'network-tools' );
 525  
 526          // About and Credits pages.
 527          remove_submenu_page( 'index.php', 'bp-about'   );
 528          remove_submenu_page( 'index.php', 'bp-credits' );
 529      }
 530  
 531      /**
 532       * Add some general styling to the admin area.
 533       *
 534       * @since 1.6.0
 535       */
 536  	public function enqueue_scripts() {
 537          wp_enqueue_style( 'bp-admin-common-css' );
 538  
 539          // BuddyPress Hello.
 540          if ( 0 === strpos( get_current_screen()->id, 'dashboard' ) && ! empty( $_GET['hello'] ) && $_GET['hello'] === 'buddypress' ) {
 541              wp_enqueue_style( 'bp-hello-css' );
 542              wp_enqueue_script( 'bp-hello-js' );
 543              wp_localize_script( 'bp-hello-js', 'bpHelloStrings', array(
 544                  'pageNotFound' => __( 'Sorry, the page you requested was not found.', 'buddypress' ),
 545                  'modalLabel'   => __( 'Hello BuddyPress', 'buddypress' ),
 546              ) );
 547          }
 548      }
 549  
 550      /**
 551       * Registers BuddyPress's suggested privacy policy language.
 552       *
 553       * @since 4.0.0
 554       */
 555  	public function add_privacy_policy_content() {
 556          // Nothing to do if we're running < WP 4.9.6.
 557          if ( version_compare( $GLOBALS['wp_version'], '4.9.6', '<' ) ) {
 558              return;
 559          }
 560  
 561          $suggested_text = '<strong class="privacy-policy-tutorial">' . esc_html__( 'Suggested text:', 'buddypress' ) . ' </strong>';
 562          $content = '';
 563  
 564          $content .= '<div class="wp-suggested-text">';
 565  
 566          $content .= '<h2>' . esc_html__( 'What personal data we collect and why we collect it', 'buddypress' ) . '</h2>';
 567          $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>';
 568  
 569          if ( bp_is_active( 'xprofile' ) ) {
 570              $content .= '<h3>' . esc_html__( 'Profile Data', 'buddypress' ) . '</h3>';
 571              $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>';
 572  
 573              $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>';
 574              $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>';
 575          }
 576  
 577          if ( bp_is_active( 'activity' ) ) {
 578              $content .= '<h3>' . esc_html__( 'Activity', 'buddypress' ) . '</h3>';
 579              $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>';
 580  
 581              $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>';
 582              $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>';
 583              $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>';
 584          }
 585  
 586          if ( bp_is_active( 'messages' ) ) {
 587              $content .= '<h3>' . esc_html__( 'Messages', 'buddypress' ) . '</h3>';
 588              $content .= '<p class="privacy-policy-tutorial">' . esc_html__( 'In this section you should describe any personal data related to private messages.', 'buddypress' ) . '</p>';
 589  
 590              $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>';
 591          }
 592  
 593          $content .= '<h3>' . esc_html__( 'Cookies', 'buddypress' ) . '</h3>';
 594          $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>';
 595  
 596          $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>';
 597  
 598          $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>';
 599  
 600          if ( bp_is_active( 'groups' ) ) {
 601              $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>';
 602          }
 603  
 604          $content .= '</div><!-- .wp-suggested-text -->';
 605  
 606          wp_add_privacy_policy_content(
 607              'BuddyPress',
 608              wp_kses_post( wpautop( $content, false ) )
 609          );
 610      }
 611  
 612      /** About *****************************************************************/
 613  
 614      /**
 615       * Output the BuddyPress Hello template.
 616       *
 617       * @since 1.7.0 Screen content.
 618       * @since 3.0.0 Now outputs BuddyPress Hello template.
 619       */
 620  	public function about_screen() {
 621          if ( 0 !== strpos( get_current_screen()->id, 'dashboard' ) || empty( $_GET['hello'] ) || $_GET['hello'] !== 'buddypress' ) {
 622              return;
 623          }
 624  
 625          // Get BuddyPress stable version.
 626          $version      =  preg_replace( '/-.*/', '', bp_get_version() );
 627          $version_slug = 'version-' . str_replace( '.', '-', $version );
 628      ?>
 629  
 630          <div id="bp-hello-container">
 631              <div id="plugin-information-scrollable">
 632                  <div id='plugin-information-title' class="with-banner">
 633                      <div class='vignette'></div>
 634                      <h2>
 635                          <?php printf(
 636                              /* translators: %s is the placehoder for the BuddyPress version number. */
 637                              esc_html__( 'BuddyPress %s', 'buddypress' ),
 638                              $version
 639                          ); ?>
 640                      </h2>
 641                  </div>
 642                  <div id="plugin-information-tabs">
 643                      <a name="whats-new" href="#whats-new" class="current"><?php esc_html_e( 'What\'s new?', 'buddypress' ); ?></a>
 644                      <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>
 645                      <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>
 646                  </div>
 647  
 648                  <div class="bp-hello-content">
 649                      <div id="dynamic-content"></div>
 650                      <div id="top-features">
 651                          <h2><?php esc_html_e( 'Introducing the BP REST API', 'buddypress' ); ?></h2>
 652                          <figure class="bp-hello-alignleft">
 653                              <div class="dashicons dashicons-rest-api big"></div>
 654                          </figure>
 655                          <p>
 656                              <?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' ); ?>
 657                          </p>
 658                          <p>
 659                              <?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' ); ?>
 660                              <?php printf(
 661                                  /* translators: %s is the placehoder for the link to the BP REST API documentation site. */
 662                                  esc_html__( 'Ready to get started with development? Check out the %s.', 'buddypress' ),
 663                                  sprintf(
 664                                      '<a href="%1$s">%2$s</a>',
 665                                      esc_url( 'https://developer.buddypress.org/bp-rest-api/' ),
 666                                      esc_html__( 'BP REST API reference', 'buddypress' )
 667                                  )
 668                              ); ?>
 669                          </p>
 670  
 671                          <hr class="bp-hello-divider"/>
 672  
 673                          <h2><?php esc_html_e( 'A new interface for managing group members.', 'buddypress' ); ?></h2>
 674                          <p>
 675                              <?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' ); ?>
 676                          </p>
 677                          <figure class="bp-hello-aligncenter">
 678                              <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' ); ?>" />
 679                          </figure>
 680                          <p>
 681                              <?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' ); ?>
 682                          </p>
 683  
 684                          <hr class="bp-hello-divider"/>
 685  
 686                          <h2><?php esc_html_e( 'Improved Group invites and membership requests.', 'buddypress' ); ?></h2>
 687                          <figure class="bp-hello-alignright">
 688                              <div class="dashicons dashicons-buddicons-groups big"></div>
 689                          </figure>
 690                          <p>
 691                              <?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' ); ?>
 692                          </p>
 693                          <p>
 694                              <?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' ); ?>
 695                              <?php printf(
 696                                  /* translators: %s is the placehoder for the link to the BP Invitations API development note. */
 697                                  esc_html__( 'Read more about the %s.', 'buddypress' ),
 698                                  sprintf(
 699                                      '<a href="%1$s">%2$s</a>',
 700                                      esc_url( 'https://bpdevel.wordpress.com/2019/09/16/new-invitations-api-coming-in-buddypress-5-0/' ),
 701                                      esc_html__( 'BP Invitations API', 'buddypress' )
 702                                  )
 703                              ); ?>
 704                          </p>
 705  
 706                          <hr class="bp-hello-divider"/>
 707  
 708                          <h2><?php esc_html_e( 'Help our support volunteers help you.', 'buddypress' ); ?></h2>
 709                          <p>
 710                              <?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' ); ?>
 711                          </p>
 712                          <figure class="bp-hello-aligncenter">
 713                              <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' ); ?>" />
 714                          </figure>
 715                          <p>
 716                              <?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' ); ?>
 717                          </p>
 718  
 719                          <hr class="bp-hello-divider"/>
 720  
 721                          <h2><?php esc_html_e( 'Improved integrations with WordPress', 'buddypress' ); ?></h2>
 722                          <figure class="bp-hello-aligncenter">
 723                              <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' ); ?>" />
 724                          </figure>
 725  
 726                          <p>
 727                              <?php esc_html_e( 'In BuddyPress 5.0.0, the BP Nouveau template pack looks better than ever with the Twenty Nineteen theme.', 'buddypress' ); ?>
 728                              <?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' ); ?>
 729                          </p>
 730  
 731                          <p>
 732                              <strong><?php esc_html_e( 'BuddyPress Blocks now have their own category into the Block Editor.', 'buddypress' ); ?></strong>
 733                          </p>
 734                          <figure class="bp-hello-aligncenter">
 735                              <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' ); ?>" />
 736                          </figure>
 737                          <p>
 738                              <?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' ); ?>
 739                              <?php printf(
 740                                  /* translators: %s is the placehoder for the link to the blocks category development note. */
 741                                  esc_html__( 'Read more about this feature in the %s.', 'buddypress' ),
 742                                  sprintf(
 743                                      '<a href="%1$s">%2$s</a>',
 744                                      esc_url( 'https://bpdevel.wordpress.com/2019/07/31/a-category-to-store-your-buddypress-blocks/' ),
 745                                      esc_html__( 'development note', 'buddypress' )
 746                                  )
 747                              ); ?>
 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 placehoder 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                              _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' ),
 778                              '<span class="dashicons dashicons-heart"></span>',
 779                              esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
 780                              number_format_i18n( 28 )
 781                          );
 782                          ?>
 783                      </p>
 784                  </div>
 785  
 786                  <div class="bp-hello-social-links">
 787                      <ul class="bp-hello-social">
 788                          <li>
 789                              <?php
 790                              printf(
 791                                  '<a class="twitter bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 792                                  esc_attr__( 'Follow BuddyPress on Twitter', 'buddypress' ),
 793                                  esc_url( 'https://twitter.com/buddypress' ),
 794                                  esc_html__( 'Follow BuddyPress on Twitter', 'buddypress' )
 795                              );
 796                              ?>
 797                          </li>
 798  
 799                          <li>
 800                              <?php
 801                              printf(
 802                                  '<a class="support bp-tooltip" data-bp-tooltip="%1$s" href="%2$s"><span class="screen-reader-text">%3$s</span></a>',
 803                                  esc_attr__( 'Visit the Support Forums', 'buddypress' ),
 804                                  esc_url( 'https://buddypress.org/support/' ),
 805                                  esc_html__( 'Visit the Support Forums', 'buddypress' )
 806                              );
 807                              ?>
 808                          </li>
 809                      </ul>
 810                  </div>
 811              </div>
 812          </div>
 813  
 814          <?php
 815      }
 816  
 817      /**
 818       * Output the credits screen.
 819       *
 820       * Hardcoding this in here is pretty janky. It's fine for now, but we'll
 821       * want to leverage api.wordpress.org eventually.
 822       *
 823       * @since 1.7.0
 824       */
 825  	public function credits_screen() {
 826      ?>
 827  
 828          <div class="wrap bp-about-wrap">
 829  
 830          <h1><?php _e( 'BuddyPress Settings', 'buddypress' ); ?> </h1>
 831  
 832          <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Credits', 'buddypress' ) ); ?></h2>
 833  
 834              <p class="about-description"><?php _e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p>
 835  
 836              <h3 class="wp-people-group"><?php _e( 'Project Leaders', 'buddypress' ); ?></h3>
 837              <ul class="wp-people-group " id="wp-people-group-project-leaders">
 838                  <li class="wp-person" id="wp-person-johnjamesjacoby">
 839                      <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7a2644fb53ae2f7bfd7143b504af396c?s=120">
 840                      John James Jacoby</a>
 841                      <span class="title"><?php _e( 'Project Lead', 'buddypress' ); ?></span>
 842                  </li>
 843                  <li class="wp-person" id="wp-person-boonebgorges">
 844                      <a class="web" href="https://profiles.wordpress.org/boonebgorges"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=120">
 845                      Boone B. Gorges</a>
 846                      <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
 847                  </li>
 848                  <li class="wp-person" id="wp-person-djpaul">
 849                      <a class="web" href="https://profiles.wordpress.org/djpaul"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3bc9ab796299d67ce83dceb9554f75df?s=120">
 850                      Paul Gibbs</a>
 851                      <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
 852                  </li>
 853              </ul>
 854  
 855              <h3 class="wp-people-group"><?php _e( 'BuddyPress Team', 'buddypress' ); ?></h3>
 856              <ul class="wp-people-group " id="wp-people-group-core-team">
 857                  <li class="wp-person" id="wp-person-r-a-y">
 858                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3bfa556a62b5bfac1012b6ba5f42ebfa?s=120">
 859                      Ray</a>
 860                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 861                  </li>
 862                  <li class="wp-person" id="wp-person-hnla">
 863                      <a class="web" href="https://profiles.wordpress.org/hnla"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/3860c955aa3f79f13b92826ae47d07fe?s=120">
 864                      Hugo Ashmore</a>
 865                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 866                  </li>
 867                  <li class="wp-person" id="wp-person-imath">
 868                      <a class="web" href="https://profiles.wordpress.org/imath"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8b208ca408dad63888253ee1800d6a03?s=120">
 869                      Mathieu Viet</a>
 870                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 871                  </li>
 872                  <li class="wp-person" id="wp-person-mercime">
 873                      <a class="web" href="https://profiles.wordpress.org/mercime"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/fae451be6708241627983570a1a1817a?s=120">
 874                      Mercime</a>
 875                      <span class="title"><?php _e( 'Navigator', 'buddypress' ); ?></span>
 876                  </li>
 877                  <li class="wp-person" id="wp-person-dcavins">
 878                      <a class="web" href="https://profiles.wordpress.org/dcavins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5fa7e83d59cb45ebb616235a176595a?s=120">
 879                      David Cavins</a>
 880                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 881                  </li>
 882                  <li class="wp-person" id="wp-person-tw2113">
 883                      <a class="web" href="https://profiles.wordpress.org/tw2113"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/a5d7c934621fa1c025b83ee79bc62366?s=120">
 884                      Michael Beckwith</a>
 885                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 886                  </li>
 887                  <li class="wp-person" id="wp-person-henry-wright">
 888                      <a class="web" href="https://profiles.wordpress.org/henry.wright"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0da2f1a9340d6af196b870f6c107a248?s=120">
 889                      Henry Wright</a>
 890                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 891                  </li>
 892                  <li class="wp-person" id="wp-person-danbp">
 893                      <a class="web" href="https://profiles.wordpress.org/danbp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/0deae2e7003027fbf153500cd3fa5501?s=120">
 894                      danbp</a>
 895                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 896                  </li>
 897                  <li class="wp-person" id="wp-person-shanebp">
 898                      <a class="web" href="https://profiles.wordpress.org/shanebp"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ffd294ab5833ba14aaf175f9acc71cc4?s=120">
 899                      shanebp</a>
 900                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 901                  </li>
 902                  <li class="wp-person" id="wp-person-slaffik">
 903                      <a class="web" href="https://profiles.wordpress.org/r-a-y"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/61fb07ede3247b63f19015f200b3eb2c?s=120">
 904                      Slava Abakumov</a>
 905                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 906                  </li>
 907                  <li class="wp-person" id="wp-person-offereins">
 908                      <a class="web" href="https://profiles.wordpress.org/Offereins"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/2404ed0a35bb41aedefd42b0a7be61c1?s=120">
 909                      Laurens Offereins</a>
 910                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 911                  </li>
 912                  <li class="wp-person" id="wp-person-netweb">
 913                      <a class="web" href="https://profiles.wordpress.org/netweb"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=120">
 914                      Stephen Edgar</a>
 915                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 916                  </li>
 917                  <li class="wp-person" id="wp-person-espellcaste">
 918                      <a class="web" href="https://profiles.wordpress.org/espellcaste"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/b691e67be0ba5cad6373770656686bc3?s=120">
 919                      Renato Alves</a>
 920                      <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
 921                  </li>
 922                  <li class="wp-person" id="wp-person-venutius">
 923                      <a class="web" href="https://profiles.wordpress.org/venutius"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/6a7c42a77fd94b82b217a7a97afdddbc?s=120">
 924                      Venutius</a>
 925                      <span class="title"><?php _e( 'Community Support', 'buddypress' ); ?></span>
 926                  </li>
 927              </ul>
 928  
 929              <h3 class="wp-people-group"><?php _e( 'Recent Rockstars', 'buddypress' ); ?></h3>
 930              <ul class="wp-people-group " id="wp-people-group-rockstars">
 931                  <li class="wp-person" id="wp-person-dimensionmedia">
 932                      <a class="web" href="https://profiles.wordpress.org/dimensionmedia"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7735aada1ec39d0c1118bd92ed4551f1?s=120">
 933                      David Bisset</a>
 934                  </li>
 935                  <li class="wp-person" id="wp-person-garrett-eclipse">
 936                      <a class="web" href="https://profiles.wordpress.org/garrett-eclipse"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/7f68f24441c61514d5d0e1451bb5bc9d?s=120">
 937                      Garrett Hyder</a>
 938                  </li>
 939                  <li class="wp-person" id="wp-person-thebrandonallen">
 940                      <a class="web" href="https://profiles.wordpress.org/thebrandonallen"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/6d3f77bf3c9ca94c406dea401b566950?s=120">
 941                      Brandon Allen</a>
 942                  </li>
 943                  <li class="wp-person" id="wp-person-ramiy">
 944                      <a class="web" href="https://profiles.wordpress.org/ramiy"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ce2a269e424156d79cb0c4e1d4d82db1?s=120">
 945                      Rami Yushuvaev</a>
 946                  </li>
 947                  <li class="wp-person" id="wp-person-vapvarun">
 948                      <a class="web" href="https://profiles.wordpress.org/vapvarun"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/78a3bf7eb3a1132fc667f96f2631e448?s=120">
 949                      Vapvarun</a>
 950                  </li>
 951              </ul>
 952  
 953              <h3 class="wp-people-group"><?php printf( esc_html__( 'Contributors to BuddyPress %s', 'buddypress' ), self::display_version() ); ?></h3>
 954              <p class="wp-credits-list">
 955                  <a href="https://github.com/baconbro">baconbro</a>,
 956                  <a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
 957                  <a href="https://profiles.wordpress.org/joncadams/">boop (joncadams)</a>,
 958                  <a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
 959                  <a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
 960                  <a href="https://profiles.wordpress.org/ericlewis/">Eric Lewis (ericlewis)</a>,
 961                  <a href="https://profiles.wordpress.org/geminorum/">geminorum</a>,
 962                  <a href="https://profiles.wordpress.org/gingerbooch/">gingerbooch</a>,
 963                  <a href="https://profiles.wordpress.org/ivinco/">Ivinco</a>,
 964                  <a href="https://profiles.wordpress.org/whyisjake/">Jake Spurlock (whyisjake)</a>,
 965                  <a href="https://profiles.wordpress.org/JarretC/">Jarret (JarretC)</a>,
 966                  <a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
 967                  <a href="https://profiles.wordpress.org/klawton/">klawton</a>,
 968                  <a href="https://profiles.wordpress.org/kristianngve/">Kristian Yngve (kristianngve)</a>,
 969                  <a href="https://profiles.wordpress.org/maniou/">Maniou</a>,
 970                  <a href="https://profiles.wordpress.org/netweblogic/">Marcus (netweblogic)</a>,
 971                  <a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
 972                  <a href="https://github.com/bhoot-biswas">Mithun Biswas</a>,
 973                  <a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
 974                  <a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
 975                  <a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
 976                  <a href="https://profiles.wordpress.org/razor90/">razor90</a>,
 977                  <a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
 978                  <a href="https://profiles.wordpress.org/slaFFik/">Slava Abakumov (slaFFik)</a>,
 979                  <a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
 980                  <a href="https://profiles.wordpress.org/truchot/">truchot</a>,
 981                  <a href="https://profiles.wordpress.org/venutius/">Venutius</a>,
 982                  <a href="https://profiles.wordpress.org/wegosi/">wegosi</a>,
 983              </p>
 984  
 985              <h3 class="wp-people-group"><?php _e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
 986              <p class="wp-credits-list">
 987                  <a href="https://github.com/ichord/At.js">At.js</a>,
 988                  <a href="https://bbpress.org">bbPress</a>,
 989                  <a href="https://github.com/ichord/Caret.js">Caret.js</a>,
 990                  <a href="https://tedgoas.github.io/Cerberus/">Cerberus</a>,
 991                  <a href="https://ionicons.com/">Ionicons</a>,
 992                  <a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
 993                  <a href="https://mattbradley.github.io/livestampjs/">Livestamp.js</a>,
 994                  <a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
 995                  <a href="https://momentjs.com/">Moment.js</a>,
 996                  <a href="https://wordpress.org">WordPress</a>.
 997              </p>
 998  
 999              <h3 class="wp-people-group"><?php _e( 'Contributor Emeriti', 'buddypress' ); ?></h3>
1000              <ul class="wp-people-group " id="wp-people-group-emeriti">
1001                  <li class="wp-person" id="wp-person-apeatling">
1002                      <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=120">
1003                      Andy Peatling</a>
1004                      <span class="title"><?php _e( 'Project Founder', 'buddypress' ); ?></span>
1005                  </li>
1006                  <li class="wp-person" id="wp-person-burtadsit">
1007                      <a class="web" href="https://profiles.wordpress.org/burtadsit"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/185e1d3e2d653af9d49a4e8e4fc379df?s=120">
1008                      Burt Adsit</a>
1009                  </li>
1010                  <li class="wp-person" id="wp-person-jeffsayre">
1011                      <a class="web" href="https://profiles.wordpress.org/jeffsayre"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/8e009a84ff5d245c22a69c7df6ab45f7?s=120">
1012                      Jeff Sayre</a>
1013                  </li>
1014                  <li class="wp-person" id="wp-person-karmatosed">
1015                      <a class="web" href="https://profiles.wordpress.org/karmatosed"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/ca7d4273a689cdbf524d8332771bb1ca?s=120">
1016                      Tammie Lister</a>
1017                  </li>
1018                  <li class="wp-person" id="wp-person-modemlooper">
1019                      <a class="web" href="https://profiles.wordpress.org/modemlooper"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/1c07be1016e845de514931477c939307?s=120">
1020                      modemlooper</a>
1021                  </li>
1022              </ul>
1023          </div>
1024  
1025          <?php
1026      }
1027  
1028      /** Emails ****************************************************************/
1029  
1030      /**
1031       * Registers 'Situations' column on Emails dashboard page.
1032       *
1033       * @since 2.6.0
1034       *
1035       * @param array $columns Current column data.
1036       * @return array
1037       */
1038  	public function emails_register_situation_column( $columns = array() ) {
1039          $situation = array(
1040              'situation' => _x( 'Situations', 'Email post type', 'buddypress' )
1041          );
1042  
1043          // Inject our 'Situations' column just before the last 'Date' column.
1044          return array_slice( $columns, 0, -1, true ) + $situation + array_slice( $columns, -1, null, true );
1045      }
1046  
1047      /**
1048       * Output column data for our custom 'Situations' column.
1049       *
1050       * @since 2.6.0
1051       *
1052       * @param string $column  Current column name.
1053       * @param int    $post_id Current post ID.
1054       */
1055  	public function emails_display_situation_column_data( $column = '', $post_id = 0 ) {
1056          if ( 'situation' !== $column ) {
1057              return;
1058          }
1059  
1060          // Grab email situations for the current post.
1061          $situations = wp_list_pluck( get_the_terms( $post_id, bp_get_email_tax_type() ), 'description' );
1062  
1063          // Output each situation as a list item.
1064          echo '<ul><li>';
1065          echo implode( '</li><li>', $situations );
1066          echo '</li></ul>';
1067      }
1068  
1069      /** Helpers ***************************************************************/
1070  
1071      /**
1072       * Return true/false based on whether a query argument is set.
1073       *
1074       * @see bp_do_activation_redirect()
1075       *
1076       * @since 2.2.0
1077       *
1078       * @return bool
1079       */
1080  	public static function is_new_install() {
1081          return (bool) isset( $_GET['is_new_install'] );
1082      }
1083  
1084      /**
1085       * Return a user-friendly version-number string, for use in translations.
1086       *
1087       * @since 2.2.0
1088       *
1089       * @return string
1090       */
1091  	public static function display_version() {
1092  
1093          // Use static variable to prevent recalculations.
1094          static $display = '';
1095  
1096          // Only calculate on first run.
1097          if ( '' === $display ) {
1098  
1099              // Get current version.
1100              $version = bp_get_version();
1101  
1102              // Check for prerelease hyphen.
1103              $pre     = strpos( $version, '-' );
1104  
1105              // Strip prerelease suffix.
1106              $display = ( false !== $pre )
1107                  ? substr( $version, 0, $pre )
1108                  : $version;
1109          }
1110  
1111          // Done!
1112          return $display;
1113      }
1114  
1115      /**
1116       * Add Emails menu item to custom menus array.
1117       *
1118       * Several BuddyPress components have top-level menu items in the Dashboard,
1119       * which all appear together in the middle of the Dashboard menu. This function
1120       * adds the Emails screen to the array of these menu items.
1121       *
1122       * @since 2.4.0
1123       *
1124       * @param array $custom_menus The list of top-level BP menu items.
1125       * @return array $custom_menus List of top-level BP menu items, with Emails added.
1126       */
1127  	public function emails_admin_menu_order( $custom_menus = array() ) {
1128          array_push( $custom_menus, 'edit.php?post_type=' . bp_get_email_post_type() );
1129  
1130          if ( is_network_admin() && bp_is_network_activated() ) {
1131              array_push(
1132                  $custom_menus,
1133                  get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() )
1134              );
1135          }
1136  
1137          return $custom_menus;
1138      }
1139  
1140      /**
1141       * Register styles commonly used by BuddyPress wp-admin screens.
1142       *
1143       * @since 2.5.0
1144       */
1145  	public function admin_register_styles() {
1146          $min = bp_core_get_minified_asset_suffix();
1147          $url = $this->css_url;
1148  
1149          /**
1150           * Filters the BuddyPress Core Admin CSS file path.
1151           *
1152           * @since 1.6.0
1153           *
1154           * @param string $file File path for the admin CSS.
1155           */
1156          $common_css = apply_filters( 'bp_core_admin_common_css', "{$url}common{$min}.css" );
1157  
1158          /**
1159           * Filters the BuddyPress admin stylesheet files to register.
1160           *
1161           * @since 2.5.0
1162           *
1163           * @param array $value Array of admin stylesheet file information to register.
1164           */
1165          $styles = apply_filters( 'bp_core_admin_register_styles', array(
1166              // Legacy.
1167              'bp-admin-common-css' => array(
1168                  'file'         => $common_css,
1169                  'dependencies' => array(),
1170              ),
1171  
1172              // 2.5
1173              'bp-customizer-controls' => array(
1174                  'file'         => "{$url}customizer-controls{$min}.css",
1175                  'dependencies' => array(),
1176              ),
1177  
1178              // 3.0
1179              'bp-hello-css' => array(
1180                  'file'         => "{$url}hello{$min}.css",
1181                  'dependencies' => array( 'bp-admin-common-css', 'thickbox' ),
1182              ),
1183          ) );
1184  
1185          $version = bp_get_version();
1186  
1187          foreach ( $styles as $id => $style ) {
1188              wp_register_style( $id, $style['file'], $style['dependencies'], $version );
1189              wp_style_add_data( $id, 'rtl', 'replace' );
1190  
1191              if ( $min ) {
1192                  wp_style_add_data( $id, 'suffix', $min );
1193              }
1194          }
1195      }
1196  
1197      /**
1198       * Register JS commonly used by BuddyPress wp-admin screens.
1199       *
1200       * @since 2.5.0
1201       */
1202  	public function admin_register_scripts() {
1203          $min = bp_core_get_minified_asset_suffix();
1204          $url = $this->js_url;
1205  
1206          /**
1207           * Filters the BuddyPress admin JS files to register.
1208           *
1209           * @since 2.5.0
1210           *
1211           * @param array $value Array of admin JS file information to register.
1212           */
1213          $scripts = apply_filters( 'bp_core_admin_register_scripts', array(
1214              // 2.5
1215              'bp-customizer-controls' => array(
1216                  'file'         => "{$url}customizer-controls{$min}.js",
1217                  'dependencies' => array( 'jquery' ),
1218                  'footer'       => true,
1219              ),
1220  
1221              // 3.0
1222              'bp-hello-js' => array(
1223                  'file'         => "{$url}hello{$min}.js",
1224                  'dependencies' => array( 'thickbox', 'bp-api-request' ),
1225                  'footer'       => true,
1226              ),
1227          ) );
1228  
1229          $version = bp_get_version();
1230  
1231          foreach ( $scripts as $id => $script ) {
1232              wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
1233          }
1234      }
1235  }
1236  endif; // End class_exists check.


Generated: Tue Nov 19 01:01:36 2019 Cross-referenced by PHPXref 0.7.1