Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/12/2021 02:58:38 AM (3 years ago)
Author:
imath
Message:

Generate a richer content for "no-content" activities

Create the "generated-content" support for the following activity types: 'new_member', 'new_avatar', 'friendship_created', 'created_group', 'joined_group' & 'updated_profile'.

  • Introduce the 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.

Props vapvarun, oztaser

See #8581

File:
1 edited

Legend:

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

    r13150 r13181  
    709709                $retval = true;
    710710            }
     711            break;
     712
     713        /**
     714         * Does this activity type support `generated-content`?
     715         */
     716        case 'generated-content' :
     717            /*
     718             * @todo `bp_activity_set_action()` should be improved to include a supports
     719             * argument or best we should create a `bp_register_activity_type()` function
     720             * to mimic the way WordPress registers post types. For now we'll use a non
     721             * extendable workaround.
     722             */
     723            $activity_types = array( 'new_member', 'new_avatar' );
     724
     725            if ( bp_is_active( 'friends' ) ) {
     726                array_push( $activity_types, 'friendship_created' );
     727            }
     728
     729            if ( bp_is_active( 'groups' ) ) {
     730                array_push( $activity_types, 'created_group', 'joined_group' );
     731            }
     732
     733            if ( bp_is_active( 'xprofile' ) ) {
     734                array_push( $activity_types, 'updated_profile' );
     735            }
     736
     737            $retval = in_array( $activity_type, $activity_types, true );
    711738            break;
    712739    }
Note: See TracChangeset for help on using the changeset viewer.