bp_activity_recurse_comments( object $comment )

Loops through a level of activity comments and loads the template for each.


Description Description

Note: The recursion itself used to happen entirely in this function. Now it is split between here and the comment.php template.


Parameters Parameters

$comment

(Required) The activity object currently being recursed.


Top ↑

Return Return

(bool|string)


Top ↑

Source Source

File: bp-activity/bp-activity-template.php

		function bp_activity_recurse_comments( $comment ) {
			global $activities_template;

			if ( empty( $comment ) ) {
				return false;
			}

			if ( empty( $comment->children ) ) {
				return false;
			}

			/**
			 * Filters the opening tag for the template that lists activity comments.
			 *
			 * @since 1.6.0
			 *
			 * @param string $value Opening tag for the HTML markup to use.
			 */
			echo apply_filters( 'bp_activity_recurse_comments_start_ul', '<ul>' );
			foreach ( (array) $comment->children as $comment_child ) {

				// Put the comment into the global so it's available to filters.
				$activities_template->activity->current_comment = $comment_child;

				$template = bp_locate_template( 'activity/comment.php', false, false );

				// Backward compatibility. In older versions of BP, the markup was
				// generated in the PHP instead of a template. This ensures that
				// older themes (which are not children of bp-default and won't
				// have the new template) will still work.
				if ( !$template ) {
					$template = buddypress()->plugin_dir . '/bp-themes/bp-default/activity/comment.php';
				}

				load_template( $template, false );

				unset( $activities_template->activity->current_comment );
			}

			/**
			 * Filters the closing tag for the template that list activity comments.
			 *
			 * @since  1.6.0
			 *
			 * @param string $value Closing tag for the HTML markup to use.
			 */
			echo apply_filters( 'bp_activity_recurse_comments_end_ul', '</ul>' );
		}

Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.