bp_admin_email_maybe_add_translation_notice

In admin emails list, for non-en_US locales, add notice explaining how to reinstall emails.

Description

bp_admin_email_maybe_add_translation_notice(); 

If BuddyPress installs before its translations are in place, tell people how to reinstall the emails so they have their contents in their site's language.


Usage

  1. if ( !function_exists( 'bp_admin_email_maybe_add_translation_notice' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_admin_email_maybe_add_translation_notice(); 
  7.  

Defined (1)

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

/bp-core/admin/bp-core-admin-functions.php  
  1. function bp_admin_email_maybe_add_translation_notice() { 
  2. if ( get_current_screen()->post_type !== bp_get_email_post_type() || get_locale() === 'en_US' ) { 
  3. return; 
  4.  
  5. // If user can't access BP Tools, there's no point showing the message. 
  6. if ( ! current_user_can(buddypress)->admin->capability ) ) { 
  7. return; 
  8.  
  9. $admin_page = 'admin.php'; 
  10. } else { 
  11. $admin_page = 'tools.php'; 
  12.  
  13. sprintf( 
  14. __( 'Are your emails in the wrong language? Go to <a href="%s">BuddyPress Tools and run the "reinstall emails"</a> tool.', buddypress ),  
  15. esc_url( add_query_arg( 'page', 'bp-tools', bp_get_admin_url( $admin_page ) ) ) 
  16. ),  
  17. 'updated' 
  18. );