By default, BuddyPress has had an elementary style for secondary activities for a long time, now it’s time to make it more attractive.
These simple activities about specific user interactions or events (e.g., you joined a group) are more visually attractive to improve user engagement in your community. The most impressive new activity is generated when a user updates their profile photo; it will include the profile photo that spurred the creation of the activity item, even if it has been updated.
The new update also saves your avatar change timeline. For example, when a user uploads a new avatar, the previously uploaded one is moved inside a history subdirectory of the user’s avatar directory. This avatar’s history is then available for the new_avatar activities to display the avatar the user had when these were published.
We’ve added a new « recycle » tab inside the change profile photo UI to manage and delete old uploaded avatars.
Thanks to this recycle tab, users can manage their avatar’s history. They can choose to:
- Reuse a previously uploaded avatar as their current profile photo,
- Permanently delete an avatar from their avatars history.
It also deletes the activity when a historical avatar has been deleted. It also covered avoiding multiple new_avatar activities per hour. You can change your avatar numerous times in a short time frame, and it will use the last avatar for the activity.
The new functions added for these updates
bp_attachments_list_directory_files()returns a list of file objects contained into the directory thanks to its absolute path passed as the function argument.
bp_attachments_list_directory_files_recursively()returns a list of file objects contained into the directory and its subdirectories thanks to the directory absolute path passed as the function argument.
bp_avatar_get_version()can be used to get a version of an avatar according to its timestamp. Since  the
BP_Attachment_Avatarclass is using a timestamp inside the avatar file name instead of a generated unique string (
uniqid()), this change allows us to request avatars according to the timestamp included into their names.
bp_avatar_get_avatars_history()can be used to get the file objects list of previously uploaded avatars.
bp_activity_type_part()function to return the name of the activity type template part.
- edit the
bp_activity_has_content()function to generate a richer content for activity types supporting the feature. For such activities the
$activities_templateglobal is extended adding a
generated_contentproperty to each activity in the loop having a type supporting the “generated-content” feature.
- Introduce the
bp_activity_generated_content_part()template tag which use the current activity
generated_contentproperty to output the requested information passed as the function parameter.
The new template tags introduced with current update:
- bp_activity_the_content_body() to bypass the activity types template parts look up or to use this tag inside an activity types template part.
- bp_activity_has_generated_content_part() is checking if the property of a generated content exists
- bp_activity_generated_content_part() is outputing the the property of a generated content
- bp_activity_get_generated_content_part() is returning the output after making sure it has been sanitized.
The new update will need theme developers to update the buddypress/activity/entry.php template if they have overridden it inside their themes.
PS: all screenshots were made using the BuddyX theme (WordPress 5.8.2 ).