More engaging logging activities in 10.0.0

By default, BuddyPress has had an elementary style for secondary activities for a long time, now it’s time to make it more attractive.

Default secondary BuddyPress activities

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.

New Interactive activities

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 [13175] the BP_Attachment_Avatar class 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_template global is extended adding a generated_content property 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_content property 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 ).

#10-0-0, #activity

Dev Chat Summary for April 29, 2015

BuddyPress 2.3.0 Schedule Update

  • BP 2.3.0 Beta 1 release has been postponed to next week because some features are not done yet (see trac tickets below). Deadline to complete feature for inclusion in BP 2.3.0 has been set this Saturday, May 2nd.
  • BP 2.3.0 RC 1 is scheduled two weeks before release ~ May 12th.
  • Target release date for 2.3.0 is May 26th, three days before BuddyCamp in Miami, Florida.

Star Private Messages

  • (#6331) @rayisme has a patch and is “just re-testing everything, but would appreciate some feedback on the general approach.” @johnjamesjacoby said he will be reviewing and testing the patch.
  • Update: @im4th and @boonebgorges have tested the patch and have given their feedback.

XProfile fields used for signup should be configurable

  • (#6347) @johnjamesjacoby mentioned that this still needs unit tests. He will get the tests in Friday “with a commit-ready patch for review.”

Attachment Library

  • (#6278) @im4th would like to commit the latest patch on this ticket. This last patch contains a back compatibility fix for versions of WordPress < 4.0.
  • Dev feedback needed.

Avatar UI

  • (#6290) @im4th mentioned that he would need to check for WP version compatibility since this UI requires Plupload 2.1.1 to maximize cross-browser compatibility. This version of the script was introduced in WP 3.9. While the general mantra is to check for feature compatibility and not version compatibility, @boonebgorges and @johnjamesjacoby gave thumbs up for the version check since this was the better course of action for this feature.
  • Update: This ticket is now a done deal. Testing and feedback welcome.

Update about the Blogs single items

  • (#6026) While this ticket was not discussed during this dev chat, it was previously tagged for 2.3.0 and bears mentioning. The team has decided to postpone it to 2.4 dev-cycle because of the sheer scope of the improvements suggested by @im4th in the patches.

Slack log:
(You need a Slack account to view the logs.)


#6026, #6278, #6290, #6331, #6347, #dev-chat

Changes to bp_has_activities() queries in BP 2.1

Activity queries were largely overhauled in BuddyPress 2.0, leading to major performance improvements. These improvements were focused on the paginated query, the SELECT that contained a LIMIT clause based on the per_page value. The remaining bottleneck for activity pages on large installations was the other SELECT COUNT(*) query performed in BP_Activity_Activity::get() to get the total number of items matching the query params, a query that is much less amenable to optimization. The kicker is that the value returned by this query is almost never used in BuddyPress; the most common use for the total count figure is to generate pagination HTML, but by default, BuddyPress does not show true pagination for activity anywhere on the front end – just a generic “Load More” button at the bottom of the stream.

BuddyPress 2.1 will include changes to address this bottleneck. (See #5629 and r8491.) The SELECT COUNT(*) query will no longer take place by default, and the logic for displaying the “Load More” button has been altered to work without this query. Most sites will not notice any difference (except for the increase in speed!). However, there are a few cases where developers may need to make modifications to preserve some functionality:

  • noscript support – The “Load More” button on activity page uses Javascript. To cover browsers with JS disabled, a <noscript> block appeared in the activity-loop.php template that contained traditional pagination markup. This pagination will no longer generate properly as of BP 2.1. In BP’s bp-legacy templates, we have removed the <noscript> block and altered the “Load More” href to be populated by bp_activity_load_more_link(). However, if your theme is a bp-default derivative, or if you have overridden activity-loop.php in your theme, you will need to make the mods yourself to support non-JS browsers. Either reproduce the core change, or add count_total=count_query to the bp_has_activities() arguments.
  • Custom activity queries – If you have built a plugin or another customization that uses BP’s activity query functions (bp_has_activities(), bp_activity_get(), BP_Activity_Activity::get()), and if your customization relies on the 'total' or 'total_activity_count' value, you’ll need to make the necessary modifications to work properly with BP 2.1. In most cases, this just means passing 'count_total' => 'count_query' as one of the function args.

Apologies to those for whom this will cause an inconvenience – normally we try not to break backward compatibility for any reason, but it was impossible to ensure that all installations would receive the performance benefits without affecting a certain subset of installations (we did try to minimize impact).

Questions? Please ask in the comments below.

#5629, #activity, #bp_activity_activity, #bp_activity_get, #bp_has_activities

Today some primitive moderation functions were introduced to…

Today some primitive moderation functions were introduced to BuddyPress core to help combat unwanted submissions to your social network. These take advantage of the same Discussion Settings and illegal keys the WordPress Comments system uses to prevent them from being displayed immediately to your blogs’ audience.

This code currently exists in a new core component file named: bp-core-moderation.php

The Activity Stream is the first component to take advantage of this new ability. Any new Activity Stream updates that contain any of the illegal keys entered in your Discussion Settings will simply not be saved to the database. This is due to there currently not being a ‘moderation’ queue for activity stream items, which we may implement in a future version of BuddyPress.

The reason we are introducing this feature is simple: it’s your social network, and you reserve the right to keep your members safe from harassment and unfriendly interaction.

We’ll be testing this new feature over at shortly, and hope you’ll test and report any issues you find!

#activity, #moderation