Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/11/2019 01:33:14 PM (5 years ago)
Author:
imath
Message:

Improve i18n of Groups activity updates action string

Dynamically generated activity action strings were introduced in BuddyPress 2.0 to ensure these strings are always up to date and multilingual-friendly (see #3856).

It appeared although the activity_update type enjoys this feature when activities are shared by users on their profiles, it was not the case for activity updates posted within Groups.

Thanks to this commit, BuddyPress is now taking it in charge by:

  • Registering a new group activity action to reference a specific formatting callback function for activities posted within Groups.
  • Making sure this new activity action type does not interfere with the one of regular activity updates in dropdown filters or into the Activity Administration screens.

BTW happy 4th WPTranslationDay to everyone :)

Fixes #8089

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-admin.php

    r11907 r12395  
    841841
    842842        for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) {
     843            /**
     844             * Don't take in account:
     845             * - a mis-named Friends activity type from before BP 1.6,
     846             * - The Group's component 'activity_update' one as the Activity component is using it.
     847             */
     848            if ( 'friends_register_activity_action' === $action[$i]['key'] || 'bp_groups_format_activity_action_group_activity_update' === $action[$i]['format_callback'] ) {
     849                continue;
     850            }
     851
    843852            $actions[ $action[$i]['key'] ] = $action[$i]['value'];
    844853        }
    845854    }
    846855
    847     // This was a mis-named activity type from before BP 1.6.
    848     unset( $actions['friends_register_activity_action'] );
    849 
    850856    // Sort array by the human-readable value.
    851857    natsort( $actions );
     
    871877        $action = array_values( (array) $action );
    872878
    873         for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
     879        for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) {
     880            /**
     881             * Don't take in account:
     882             * - a mis-named Friends activity type from before BP 1.6,
     883             * - The Group's component 'activity_update' one as the Activity component is using it.
     884             */
     885            if ( 'friends_register_activity_action' === $action[$i]['key'] || 'bp_groups_format_activity_action_group_activity_update' === $action[$i]['format_callback'] ) {
     886                continue;
     887            }
     888
    874889            $actions[ $action[$i]['key'] ] = $action[$i]['value'];
     890        }
    875891    }
    876 
    877     // This was a mis-named activity type from before BP 1.6.
    878     unset( $actions['friends_register_activity_action'] );
    879892
    880893    // Sort array by the human-readable value.
Note: See TracChangeset for help on using the changeset viewer.