Function Reference: geodir_buddypress_get_activity_id

Summary

set parent activity_id to 1 if listing comment has not parent activity_id.

Package

GeoDirectory_BuddyPress_Integration

Parameters

$activity_id
(int) (required) BP activity ID.

Default: None

Return Values

(int)
  • BP activity ID.

Change Log

Since: 1.0.0

Source File

geodir_buddypress_get_activity_id() is located in geodir_buddypress/includes/gdbuddypress_functions.php [Line: 1505]

Source Code

function geodir_buddypress_get_activity_id( $activity_id ) {
	if ( !$activity_id ) {
		$gd_post_types = geodir_get_posttypes( 'array' );
		
		$comment_post_ID = isset( $_POST['comment_post_ID'] ) ? $_POST['comment_post_ID'] : 0;
		$comment_post = get_post( $comment_post_ID );
		
		if ( !empty( $comment_post ) && isset( $comment_post->post_type ) && $comment_post->post_type && !empty( $gd_post_types ) && array_key_exists( $comment_post->post_type, $gd_post_types ) ) {
			$activity_id = 1;
		}
	}
	return $activity_id;
}