ap_activity_parse( object $activity )

Description #

Parse raw activity returned from database. Rename column name append action data.

Parameters #

  • $activity
    object (Required) Activity object returned from database.

Changelog #

VersionDescription
4.1.2Introduced.

Source #

File: includes/activity.php

function ap_activity_parse( $activity ) {
	if ( ! is_object( $activity ) ) {
		return false;
	}

	$new = array();

	// Rename keys.
	foreach ( $activity as $key => $value ) {
		$new[ str_replace( 'activity_', '', $key ) ] = $value;
	}

	$new = (object) $new;

	// Append actions data if exists.
	if ( ap_activity_object()->action_exists( $new->action ) ) {
		$new->action = ap_activity_object()->get_action( $new->action );
	}

	return $new;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment