bp_core_admin_php52_plugin_row

Outputs a replacement for WP's default update notice, when site is not running PHP 5.3 or greater.

Description

bp_core_admin_php52_plugin_row( (string) $file, (array) $plugin_data ); 

When we see that a site is not running PHP 5.3 and is trying to update to BP 2.8+, we replace WP's default notice with our own, which both provides a link to our documentation of the requirement, and removes the link that allows a single plugin to be updated.

Parameters (2)

0. $file (string)
Plugin filename. buddypress/bp-loader.php.
1. $plugin_data (array)
Data about the BuddyPress plugin, as returned by the plugins API.

Usage

  1. if ( !function_exists( 'bp_core_admin_php52_plugin_row' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/deprecated/2.8.php'; 
  3.  
  4. // Plugin filename. buddypress/bp-loader.php. 
  5. $file = ''; 
  6.  
  7. // Data about the BuddyPress plugin, as returned by the 
  8. // plugins API. 
  9. $plugin_data = array(); 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = bp_core_admin_php52_plugin_row($file, $plugin_data); 
  13.  

Defined (1)

The function is defined in the following location(s).

/bp-core/deprecated/2.8.php  
  1. function bp_core_admin_php52_plugin_row( $file, $plugin_data ) { 
  2. if ( is_multisite() && ! is_network_admin() ) { 
  3. return; 
  4.  
  5. $current = get_site_transient( 'update_plugins' ); 
  6. if ( ! isset( $current->response[ $file ] ) ) { 
  7. return false; 
  8.  
  9. $response = $current->response[ $file ]; 
  10.  
  11. // No need to do this if update is for < BP 2.8. 
  12. if ( version_compare( $response->new_version, '2.8', '<' ) ) { 
  13. return false; 
  14.  
  15. $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); 
  16.  
  17. if ( is_network_admin() ) { 
  18. $active_class = is_plugin_active_for_network( $file ) ? ' active' : ''; 
  19. } else { 
  20. $active_class = is_plugin_active( $file ) ? ' active' : ''; 
  21.  
  22. // WP 4.6 uses different markup for the plugin row notice. 
  23. if ( function_exists( 'wp_get_ext_types' ) ) { 
  24. $p = '<p>%s</p>'; 
  25.  
  26. // WP < 4.6. 
  27. } else { 
  28. $p = '%s'; 
  29.  
  30. // Ugh. 
  31. $active_class .= ' not-shiny'; 
  32.  
  33. echo '<tr class="plugin-update-tr' . $active_class . '" id="' . esc_attr( $response->slug . '-update' ) . '" data-slug="' . esc_attr( $response->slug ) . '" data-plugin="' . esc_attr( $file ) . '"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message inline notice notice-error notice-alt">'; 
  34.  
  35. printf( $p,  
  36. esc_html__( 'A BuddyPress update is available, but your system is not compatible.', buddypress ) . ' ' . 
  37. sprintf( __( 'See <a href="%s">the Codex guide</a> for more information.', buddypress ), 'https://codex.buddypress.org/getting-started/buddypress-2-8-will-require-php-5-3/' ) 
  38. ); 
  39.  
  40. echo '</div></td></tr>'; 
  41.  
  42. /** 
  43. * JavaScript to disable the bulk upgrade checkbox. 
  44. * See WP_Plugins_List_Table::single_row(). 
  45. */ 
  46. $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] ); 
  47. echo "<script type='text/javascript'>document.getElementById('$checkbox_id').disabled = true;</script>";