Changeset 10474 for trunk/src/bp-core/admin/bp-core-admin-functions.php
- Timestamp:
- 01/27/2016 08:23:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-admin-functions.php
r10417 r10474 812 812 813 813 /** 814 * In admin emails list, for non-en_US locales, add notice explaining how to reinstall emails. 815 * 816 * If BuddyPress installs before its translations are in place, tell people how to reinstall 817 * the emails so they have their contents in their site's language. 818 * 819 * @since 2.5.0 820 */ 821 function bp_admin_email_maybe_add_translation_notice() { 822 if ( get_current_screen()->post_type !== bp_get_email_post_type() || get_locale() === 'en_US' ) { 823 return; 824 } 825 826 // If user can't access BP Tools, there's no point showing the message. 827 if ( ! current_user_can( buddypress()->admin->capability ) ) { 828 return; 829 } 830 831 bp_core_add_admin_notice( 832 sprintf( 833 __( 'Are your emails in the wrong language? Go to <a href="%s">BuddyPress Tools and run the "reinstall emails"</a> tool.', 'buddypress' ), 834 bp_get_admin_url( 'tools.php?page=bp-tools' ) 835 ), 836 'updated' 837 ); 838 } 839 add_action( 'admin_head-edit.php', 'bp_admin_email_maybe_add_translation_notice' ); 840 841 /** 842 * In emails editor, add notice linking to token documentation on Codex. 843 * 844 * @since 2.5.0 845 */ 846 function bp_admin_email_add_codex_notice() { 847 if ( get_current_screen()->post_type !== bp_get_email_post_type() ) { 848 return; 849 } 850 851 bp_core_add_admin_notice( 852 sprintf( 853 __( 'Phrases wrapped in braces <code>{{ }}</code> are email tokens. <a href="%s">Learn about tokens on the BuddyPress Codex</a>.', 'buddypress' ), 854 esc_url( 'https://codex.buddypress.org/emails/email-tokens/' ) 855 ), 856 'error' 857 ); 858 } 859 add_action( 'admin_head-post.php', 'bp_admin_email_add_codex_notice' ); 860 861 /** 862 * Display metabox for email taxonomy type. 863 * 864 * Shows the term description in a list, rather than the term name itself. 865 * 866 * @since 2.5.0 867 * 868 * @param WP_Post $post Post object. 869 * @param array $box { 870 * Tags meta box arguments. 871 * 872 * @type string $id Meta box ID. 873 * @type string $title Meta box title. 874 * @type callable $callback Meta box display callback. 875 * } 876 */ 877 function bp_email_tax_type_metabox( $post, $box ) { 878 $r = array( 879 'taxonomy' => bp_get_email_tax_type() 880 ); 881 882 $tax_name = esc_attr( $r['taxonomy'] ); 883 $taxonomy = get_taxonomy( $r['taxonomy'] ); 884 ?> 885 <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> 886 <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> 887 <?php 888 $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; 889 echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 890 ?> 891 <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> 892 <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'walker' => new BP_Walker_Category_Checklist ) ); ?> 893 </ul> 894 </div> 895 896 <p><?php esc_html_e( 'Choose when this email will be sent.', 'buddypress' ); ?></p> 897 </div> 898 <?php 899 } 900 901 /** 814 902 * Restrict various items from view if editing a BuddyPress menu. 815 903 *
Note: See TracChangeset
for help on using the changeset viewer.