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

New xProfile Field Type – Checkbox Acceptance will be introduced in BuddyPress 8.0.0

The BuddyPress xProfile component gives you the power to create as many profile fields as you wish quickly and to organize these fields into groups of fields. An important step when creating a new profile field is to select the Field Type that best suits your need to display the information.

The Checkbox Acceptance field type is a new type of field we will introduce into our next major release (8.0.0). Thanks to it you’ll be able to easily create a new field to manage the Terms of Service of your site (which is often mandatory nowadays to follow compliance) or any other acceptance page (eg: code of conduct, good behavior rules, etc…). As it’s a profile field, it’s very easy to include it into your registration form to be sure to have your new members to agree to your linked acceptance page.

Adding a new field using the Checkbox Acceptance type.

When you’ll create a new xProfile field once you upgraded to BuddyPress 8.0.0, you will find a new field type option – Checkbox Acceptance.

Checkbox Acceptance field option

After selecting the Acceptance field, you can map your terms of service page to field options and include it into your registration form using the checkbox of the new Signup metabox (also introduced in 8.0.0).

Select your Terms of Service page to Checkbox Acceptance field

Save your profile field, and log out to preview the result on your registration page.

Checkbox Acceptance field view at register page.

It will be visible as in the above screenshot, mapped terms & condition page link on the register page with checkbox. Of course, new users will be able to click on the “Terms and conditions” link to aknowledge it.

Checkbox Acceptance field view for existing users.

Existing members can also agree to your acceptance page. Tell them to log in and visit their edit profile screen to submit their Acceptance from there. Once submitted, it will be a read-only field; members can not uncheck the value for the Acceptance field.

The acceptance field will only be visible to the logged-in member (viewing their self profile) and the admin. It will not be visible to members visiting any other one’s profile.

Checkbox Acceptance field view at own profile

Watch the demo!

The video below will show you how to create a new Acceptance field

Please read the full story about this new xProfile field type, head over to this ticket on our Trac environment.

#8-0-0, #xprofile