bp_admin_email_maybe_add_translation_notice()

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

Description

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.

Source

File: bp-core/admin/bp-core-admin-functions.php

1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
function bp_admin_email_maybe_add_translation_notice() {
    if ( get_current_screen()->post_type !== bp_get_email_post_type() || get_locale() === 'en_US' ) {
        return;
    }
 
    // If user can't access BP Tools, there's no point showing the message.
    if ( ! current_user_can( buddypress()->admin->capability ) ) {
        return;
    }
 
    if ( bp_core_do_network_admin() ) {
        $admin_page = 'admin.php';
    } else {
        $admin_page = 'tools.php';
    }
 
    bp_core_add_admin_notice(
        sprintf(
            __( 'Are these emails not written in your site\'s language? Go to <a href="%s">BuddyBoss Tools and try the "reinstall emails"</a> tool.', 'buddyboss' ),
            esc_url( add_query_arg( 'page', 'bp-tools', bp_get_admin_url( $admin_page ) ) )
        ),
        'updated'
    );
}

Changelog

Changelog
Version Description
BuddyPress 2.5.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.