Skip to:
Content

BuddyPress.org

Changeset 12776


Ignore:
Timestamp:
11/09/2020 02:47:32 AM (3 weeks ago)
Author:
johnjamesjacoby
Message:

Group/Member Types: More string changes.

This commit includes the following code changes:

  • Change case of strings to match how WordPress core labels are cased
  • Reorder schema so singular is before plural (see: order of adjectives)
  • Adds missing taxonomy labels for core functionalities that could be activated or used later (hierarchy, popularity, etc...)
  • Simplifies all verbiage, to be more concise without sacrificing accuracy or descriptiveness (removes example URLs, encoded quotes, etc...)
  • Remove "member" references from default strings, and re-add them back in using member-specific variants to match how groups works
  • Related inline documentation

Together, these changes bring both Group and Member types closer in readability and usability to other taxonomies, making them feel a little bit more familiar, while also keeping strings within 2 lines tall on most viewport sizes, and hopefully making them easier to understand for users who are new to these features.

See #7179, #7181.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r12745 r12776  
    29782978function bp_get_taxonomy_common_labels() {
    29792979    return array(
    2980         'bp_type_name'           => _x( 'Name', 'BP Type name label', 'buddypress' ),
     2980        'bp_type_name'           => _x( 'Plural Name', 'BP Type name label', 'buddypress' ),
    29812981        'bp_type_singular_name'  => _x( 'Singular name', 'BP Type singular name label', 'buddypress' ),
    2982         'bp_type_has_directory'  => _x( 'Add Type-Filtered Directory View', 'BP Type has directory checkbox label', 'buddypress' ),
     2982        'bp_type_has_directory'  => _x( 'Has Directory View', 'BP Type has directory checkbox label', 'buddypress' ),
    29832983        'bp_type_directory_slug' => _x( 'Custom type directory slug', 'BP Type slug label', 'buddypress' ),
    29842984    );
     
    30873087function bp_get_type_metadata_schema( $suppress_filters = false, $type_taxonomy = '' ) {
    30883088    $schema = array(
    3089         'bp_type_name' => array(
    3090             'description'       => __( 'The name of your type, at the plural form.', 'buddypress' ),
     3089        'bp_type_singular_name' => array(
     3090            'description'       => __( 'The name of this type in singular form. ', 'buddypress' ),
    30913091            'type'              => 'string',
    30923092            'single'            => true,
    30933093            'sanitize_callback' => 'sanitize_text_field',
    30943094        ),
    3095         'bp_type_singular_name' => array(
    3096             'description'       => __( 'The name of your type, at the singular form.', 'buddypress' ),
     3095        'bp_type_name' => array(
     3096            'description'       => __( 'The name of this type in plural form.', 'buddypress' ),
    30973097            'type'              => 'string',
    30983098            'single'            => true,
     
    31003100        ),
    31013101        'bp_type_has_directory' => array(
    3102             'description'       => __( 'Add a list of members matching the member type available on the Members Directory page (e.g. site.url/members/type/teacher/).', 'buddypress' ),
     3102            'description'       => __( 'Make a list matching this type available on the directory.', 'buddypress' ),
    31033103            'type'              => 'boolean',
    31043104            'single'            => true,
     
    31063106        ),
    31073107        'bp_type_directory_slug' => array(
    3108             'label'             => __( 'Custom type directory slug', 'buddypress' ),
    3109             'description'       => __( 'If you want to use a slug that is different from the Member Type ID above, enter it here.', 'buddypress' ),
     3108            'label'             => __( 'Type slug', 'buddypress' ),
     3109            'description'       => __( 'Enter if you want the type slug to be different from its ID.', 'buddypress' ),
    31103110            'type'              => 'string',
    31113111            'single'            => true,
  • trunk/src/bp-groups/bp-groups-functions.php

    r12764 r12776  
    25102510        'bp_get_group_type_tax_labels',
    25112511        array(
    2512             'name'                          => _x( 'Group types', 'Group type taxonomy name', 'buddypress' ),
    2513             'singular_name'                 => _x( 'Group type', 'Group type taxonomy singular name', 'buddypress' ),
    2514             'search_items'                  => _x( 'Search Group types', 'Group type taxonomy search items label', 'buddypress' ),
    2515             'popular_items'                 => _x( 'Most used Group types', 'Group type taxonomy popular items label', 'buddypress' ),
    2516             'all_items'                     => _x( 'All Group types', 'Group type taxonomy all items label', 'buddypress' ),
    2517             'edit_item'                     => _x( 'Edit Group type', 'Group type taxonomy edit item label', 'buddypress' ),
    2518             'view_item'                     => _x( 'View Group type', 'Group type taxonomy view item label', 'buddypress' ),
    2519             'update_item'                   => _x( 'Update Group type', 'Group type taxonomy update item label', 'buddypress' ),
    2520             'add_new_item'                  => _x( 'Add new Group type', 'Group type taxonomy add new item label', 'buddypress' ),
    2521             'new_item_name'                 => _x( 'New Group type name', 'Group type taxonomy new item name label', 'buddypress' ),
    2522             'separate_items_with_commas'    => _x( 'Separate Group types with commas', 'Group type taxonomy separate items with commas label', 'buddypress' ),
    2523             'add_or_remove_items'           => _x( 'Add or remove Group types', 'Group type taxonomy add or remove items label', 'buddypress' ),
    2524             'choose_from_most_used'         => _x( 'Choose from the most used Group types', 'Group type taxonomy choose from most used label', 'buddypress' ),
    2525             'not_found'                     => _x( 'No Group types found', 'Group type taxonomy not found label', 'buddypress' ),
    2526             'no_terms'                      => _x( 'No Group types', 'Group type taxonomy no terms label', 'buddypress' ),
    2527             'items_list_navigation'         => _x( 'Group types list navigation', 'Group type taxonomy items list navigation label', 'buddypress' ),
    2528             'items_list'                    => _x( 'Group types list', 'Group type taxonomy items list label', 'buddypress' ),
    2529             'back_to_items'                 => _x( 'Back to all Group types', 'Group type taxonomy back to items label', 'buddypress' ),
     2512
     2513            // General labels
     2514            'name'                          => _x( 'Group Types', 'Group type taxonomy name', 'buddypress' ),
     2515            'singular_name'                 => _x( 'Group Type', 'Group type taxonomy singular name', 'buddypress' ),
     2516            'search_items'                  => _x( 'Search Group Types', 'Group type taxonomy search items label', 'buddypress' ),
     2517            'popular_items'                 => _x( 'Popular Group Types', 'Group type taxonomy popular items label', 'buddypress' ),
     2518            'all_items'                     => _x( 'All Group Types', 'Group type taxonomy all items label', 'buddypress' ),
     2519            'parent_item'                   => _x( 'Parent Group Type', 'Group type taxonomy parent item label', 'buddypress' ),
     2520            'parent_item_colon'             => _x( 'Parent Group Type:', 'Group type taxonomy parent item label', 'buddypress' ),
     2521            'edit_item'                     => _x( 'Edit Group Type', 'Group type taxonomy edit item label', 'buddypress' ),
     2522            'view_item'                     => _x( 'View Group Type', 'Group type taxonomy view item label', 'buddypress' ),
     2523            'update_item'                   => _x( 'Update Group Type', 'Group type taxonomy update item label', 'buddypress' ),
     2524            'add_new_item'                  => _x( 'Add New Group Type', 'Group type taxonomy add new item label', 'buddypress' ),
     2525            'new_item_name'                 => _x( 'New Group Type Name', 'Group type taxonomy new item name label', 'buddypress' ),
     2526            'separate_items_with_commas'    => _x( 'Separate group types with commas', 'Group type taxonomy separate items with commas label', 'buddypress' ),
     2527            'add_or_remove_items'           => _x( 'Add or remove group types', 'Group type taxonomy add or remove items label', 'buddypress' ),
     2528            'choose_from_most_used'         => _x( 'Choose from the most used group types', 'Group type taxonomy choose from most used label', 'buddypress' ),
     2529            'not_found'                     => _x( 'No group types found.', 'Group type taxonomy not found label', 'buddypress' ),
     2530            'no_terms'                      => _x( 'No group types', 'Group type taxonomy no terms label', 'buddypress' ),
     2531            'items_list_navigation'         => _x( 'Group Types list navigation', 'Group type taxonomy items list navigation label', 'buddypress' ),
     2532            'items_list'                    => _x( 'Group Types list', 'Group type taxonomy items list label', 'buddypress' ),
     2533
     2534            /* translators: Tab heading when selecting from the most used terms. */
     2535            'most_used'                     => _x( 'Most Used', 'Group type taxonomy most used items label', 'buddypress' ),
     2536            'back_to_items'                 => _x( '← Back to Group Types', 'Group type taxonomy back to items label', 'buddypress' ),
     2537
    25302538            // Specific to BuddyPress.
    25312539            'bp_type_id_label'              => _x( 'Group Type ID', 'BP Member type ID label', 'buddypress' ),
    2532             'bp_type_id_description'        => _x( 'Enter a lower-case string without spaces or special characters (used internally to identify the group type).', 'BP Group type ID description', 'buddypress' ),
    2533             'bp_type_show_in_create_screen' => _x( 'Add to Available Types on Create Screen', 'BP Group type show in create screen', 'buddypress' ),
    2534             'bp_type_show_in_list'          => _x( 'Include when Group Types are Listed for a Group', 'BP Group type show in list', 'buddypress' ),
     2540            'bp_type_id_description'        => _x( 'Lower-case string, no spaces or special characters. Used to identify the group type.', 'BP Group type ID description', 'buddypress' ),
     2541            'bp_type_show_in_create_screen' => _x( 'Show on Group Creation', 'BP Group type show in create screen', 'buddypress' ),
     2542            'bp_type_show_in_list'          => _x( 'Show on Group', 'BP Group type show in list', 'buddypress' ),
    25352543        )
    25362544    );
     
    25572565        array_merge(
    25582566            array(
    2559                 'description' => _x( 'BuddyPress Group types', 'Group type taxonomy description', 'buddypress' ),
     2567                'description' => _x( 'BuddyPress Group Types', 'Group type taxonomy description', 'buddypress' ),
    25602568                'labels'      => array_merge( bp_get_group_type_tax_labels(), bp_get_taxonomy_common_labels() ),
    25612569            ),
     
    26142622function bp_get_group_type_metadata_schema( $schema = array(), $taxonomy = '' ) {
    26152623    if ( bp_get_group_type_tax_name() === $taxonomy ) {
     2624
     2625        // Directory
    26162626        if ( isset( $schema['bp_type_has_directory']['description'] ) ) {
    2617             $schema['bp_type_has_directory']['description'] = __( 'Add a list of groups matching the group type available on the Groups Directory page (e.g. site.url/groups/type/ninja/).', 'buddypress' );
     2627            $schema['bp_type_has_directory']['description'] = __( 'Make a list of groups matching this type available on the groups directory.', 'buddypress' );
    26182628        }
    26192629
     2630        // Slug
    26202631        if ( isset( $schema['bp_type_directory_slug']['description'] ) ) {
    2621             $schema['bp_type_directory_slug']['description'] = __( 'If you want to use a slug that is different from the Group Type ID above, enter it here.', 'buddypress' );
     2632            $schema['bp_type_directory_slug']['description'] = __( 'Enter if you want the type slug to be different from its ID.', 'buddypress' );
    26222633        }
    26232634
    2624         $schema = array_merge(
    2625             $schema,
    2626             array(
    2627                 'bp_type_show_in_create_screen' => array(
    2628                     'description'       => __( 'Include this group type during group creation and when a group administrator is on the group’s “Manage > Settings” page.', 'buddypress' ),
    2629                     'type'              => 'boolean',
    2630                     'single'            => true,
    2631                     'sanitize_callback' => 'absint',
    2632                 ),
    2633                 'bp_type_show_in_list'          => array(
    2634                     'description'       => __( 'Include this group type when group types are listed, like in the group header.', 'buddypress' ),
    2635                     'type'              => 'boolean',
    2636                     'single'            => true,
    2637                     'sanitize_callback' => 'absint',
    2638                 ),
    2639             )
     2635        // Create
     2636        $schema['bp_type_show_in_create_screen'] = array(
     2637            'description'       => __( 'Show during group creation, and when a group admin is on the group’s settings page.', 'buddypress' ),
     2638            'type'              => 'boolean',
     2639            'single'            => true,
     2640            'sanitize_callback' => 'absint',
     2641        );
     2642
     2643        // List
     2644        $schema['bp_type_show_in_list'] = array(
     2645            'description'       => __( 'Show where group types may be listed, like in the group header.', 'buddypress' ),
     2646            'type'              => 'boolean',
     2647            'single'            => true,
     2648            'sanitize_callback' => 'absint',
    26402649        );
    26412650    }
  • trunk/src/bp-members/bp-members-functions.php

    r12768 r12776  
    26902690        'bp_get_member_type_tax_labels',
    26912691        array(
    2692             'name'                       => _x( 'Member types', 'Member type taxonomy name', 'buddypress' ),
    2693             'singular_name'              => _x( 'Member type', 'Member type taxonomy singular name', 'buddypress' ),
    2694             'search_items'               => _x( 'Search Member types', 'Member type taxonomy search items label', 'buddypress' ),
    2695             'popular_items'              => _x( 'Most used Member types', 'Member type taxonomy popular items label', 'buddypress' ),
    2696             'all_items'                  => _x( 'All Member types', 'Member type taxonomy all items label', 'buddypress' ),
    2697             'edit_item'                  => _x( 'Edit Member type', 'Member type taxonomy edit item label', 'buddypress' ),
    2698             'view_item'                  => _x( 'View Member type', 'Member type taxonomy view item label', 'buddypress' ),
    2699             'update_item'                => _x( 'Update Member type', 'Member type taxonomy update item label', 'buddypress' ),
    2700             'add_new_item'               => _x( 'Add new Member type', 'Member type taxonomy add new item label', 'buddypress' ),
    2701             'new_item_name'              => _x( 'New Member type name', 'Member type taxonomy new item name label', 'buddypress' ),
    2702             'separate_items_with_commas' => _x( 'Separate Member types with commas', 'Member type taxonomy separate items with commas label', 'buddypress' ),
    2703             'add_or_remove_items'        => _x( 'Add or remove Member types', 'Member type taxonomy add or remove items label', 'buddypress' ),
    2704             'choose_from_most_used'      => _x( 'Choose from the most used Member types', 'Member type taxonomy choose from most used label', 'buddypress' ),
    2705             'not_found'                  => _x( 'No Member types found', 'Member type taxonomy not found label', 'buddypress' ),
    2706             'no_terms'                   => _x( 'No Member types', 'Member type taxonomy no terms label', 'buddypress' ),
    2707             'items_list_navigation'      => _x( 'Member types list navigation', 'Member type taxonomy items list navigation label', 'buddypress' ),
    2708             'items_list'                 => _x( 'Member types list', 'Member type taxonomy items list label', 'buddypress' ),
    2709             'back_to_items'              => _x( 'Back to all Member types', 'Member type taxonomy back to items label', 'buddypress' ),
     2692
     2693            // General labels
     2694            'name'                       => _x( 'Member Types', 'Member type taxonomy name', 'buddypress' ),
     2695            'singular_name'              => _x( 'Member Type', 'Member type taxonomy singular name', 'buddypress' ),
     2696            'search_items'               => _x( 'Search Member Types', 'Member type taxonomy search items label', 'buddypress' ),
     2697            'popular_items'              => _x( 'Popular Member Types', 'Member type taxonomy popular items label', 'buddypress' ),
     2698            'all_items'                  => _x( 'All Member Types', 'Member type taxonomy all items label', 'buddypress' ),
     2699            'parent_item'                => _x( 'Parent Member Type', 'Member type taxonomy parent item label', 'buddypress' ),
     2700            'parent_item_colon'          => _x( 'Parent Member Type:', 'Member type taxonomy parent item label', 'buddypress' ),
     2701            'edit_item'                  => _x( 'Edit Member Type', 'Member type taxonomy edit item label', 'buddypress' ),
     2702            'view_item'                  => _x( 'View Member Type', 'Member type taxonomy view item label', 'buddypress' ),
     2703            'update_item'                => _x( 'Update Member Type', 'Member type taxonomy update item label', 'buddypress' ),
     2704            'add_new_item'               => _x( 'Add New Member Type', 'Member type taxonomy add new item label', 'buddypress' ),
     2705            'new_item_name'              => _x( 'New Member Type Name', 'Member type taxonomy new item name label', 'buddypress' ),
     2706            'separate_items_with_commas' => _x( 'Separate member types with commas', 'Member type taxonomy separate items with commas label', 'buddypress' ),
     2707            'add_or_remove_items'        => _x( 'Add or remove member types', 'Member type taxonomy add or remove items label', 'buddypress' ),
     2708            'choose_from_most_used'      => _x( 'Choose from the most used meber types', 'Member type taxonomy choose from most used label', 'buddypress' ),
     2709            'not_found'                  => _x( 'No member types found.', 'Member type taxonomy not found label', 'buddypress' ),
     2710            'no_terms'                   => _x( 'No member types', 'Member type taxonomy no terms label', 'buddypress' ),
     2711            'items_list_navigation'      => _x( 'Member Types list navigation', 'Member type taxonomy items list navigation label', 'buddypress' ),
     2712            'items_list'                 => _x( 'Member Types list', 'Member type taxonomy items list label', 'buddypress' ),
     2713
     2714            /* translators: Tab heading when selecting from the most used terms. */
     2715            'most_used'                  => _x( 'Most Used', 'Member type taxonomy most used items label', 'buddypress' ),
     2716            'back_to_items'              => _x( '← Back to Member Types', 'Member type taxonomy back to items label', 'buddypress' ),
     2717
    27102718            // Specific to BuddyPress.
    27112719            'bp_type_id_label'           => _x( 'Member Type ID', 'BP Member type ID label', 'buddypress' ),
     
    27352743        array_merge(
    27362744            array(
    2737                 'description' => _x( 'BuddyPress Member types', 'Member type taxonomy description', 'buddypress' ),
     2745                'description' => _x( 'BuddyPress Member Types', 'Member type taxonomy description', 'buddypress' ),
    27382746                'labels'      => array_merge( bp_get_member_type_tax_labels(), bp_get_taxonomy_common_labels() ),
    27392747            ),
     
    27422750    );
    27432751}
     2752
     2753/**
     2754 * Extend generic Type metadata schema to match Member Type needs.
     2755 *
     2756 * @since 7.0.0
     2757 *
     2758 * @param array  $schema   The generic Type metadata schema.
     2759 * @param string $taxonomy The taxonomy name the schema applies to.
     2760 * @return array           The Member Type metadata schema.
     2761 */
     2762function bp_get_member_type_metadata_schema( $schema = array(), $taxonomy = '' ) {
     2763    if ( bp_get_member_type_tax_name() === $taxonomy ) {
     2764
     2765        // Directory
     2766        if ( isset( $schema['bp_type_has_directory']['description'] ) ) {
     2767            $schema['bp_type_has_directory']['description'] = __( 'Make a list of members matching this type available on the members directory.', 'buddypress' );
     2768        }
     2769
     2770        // Slug
     2771        if ( isset( $schema['bp_type_directory_slug']['description'] ) ) {
     2772            $schema['bp_type_directory_slug']['description'] = __( 'Enter if you want the type slug to be different from its ID.', 'buddypress' );
     2773        }
     2774    }
     2775
     2776    return $schema;
     2777}
     2778add_filter( 'bp_get_type_metadata_schema', 'bp_get_member_type_metadata_schema', 1, 2 );
    27442779
    27452780/**
Note: See TracChangeset for help on using the changeset viewer.