/** * Fetch the activity_id for an existing activity entry in the DB. * * @since BuddyPress (1.2.0) * * @see BP_Activity_Activity::get() For more information on accepted arguments. * @uses wp_parse_args() * @uses apply_filters() To call the 'bp_activity_get_activity_id' hook. * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} * * @param array $args See BP_Activity_Activity::get() for description. * @return int $activity_id The ID of the activity item found. */ function bp_activity_get_activity_id($args = '') { $r = bp_parse_args($args, array('user_id' => false, 'component' => false, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'action' => false, 'content' => false, 'date_recorded' => false)); return apply_filters('bp_activity_get_activity_id', BP_Activity_Activity::get_id($r['user_id'], $r['component'], $r['type'], $r['item_id'], $r['secondary_item_id'], $r['action'], $r['content'], $r['date_recorded'])); }
/** * @group get_id */ public function test_get_id_with_secondary_item_id() { $a1 = $this->factory->activity->create(array('secondary_item_id' => 523)); $a2 = $this->factory->activity->create(array('secondary_content' => 1888)); $activity = BP_Activity_Activity::get_id(false, false, false, false, 523, false, false, false); $this->assertEquals($a1, $activity); }
/** * Fetch the activity_id for an existing activity entry in the DB. * * @since 1.2.0 * * @see BP_Activity_Activity::get() For more information on accepted arguments. * @uses wp_parse_args() * @uses apply_filters() To call the 'bp_activity_get_activity_id' hook. * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} * * @param array|string $args See BP_Activity_Activity::get() for description. * @return int $activity_id The ID of the activity item found. */ function bp_activity_get_activity_id($args = '') { $r = bp_parse_args($args, array('user_id' => false, 'component' => false, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'action' => false, 'content' => false, 'date_recorded' => false)); /** * Filters the activity ID being requested. * * @since 1.2.0 * @since 2.5.0 Added the `$r` and `$args` parameters. * * @param BP_Activity_Activity $value ID returned by BP_Activity_Activity get_id() method with provided arguments. * @param array $r Parsed function arguments. * @param array $args Arguments passed to the function. */ return apply_filters('bp_activity_get_activity_id', BP_Activity_Activity::get_id($r['user_id'], $r['component'], $r['type'], $r['item_id'], $r['secondary_item_id'], $r['action'], $r['content'], $r['date_recorded']), $r, $args); }
/** * Fetch the activity_id for an existing activity entry in the DB. * * @since 1.2.0 * * @param array $args See docs for $defaults for details * * @uses nxt_parse_args() * @uses apply_filters() To call the 'bp_activity_get_activity_id' hook * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} * * @return int $activity_id The activity id */ function bp_activity_get_activity_id($args = '') { $defaults = array('user_id' => false, 'component' => false, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'action' => false, 'content' => false, 'date_recorded' => false); $r = nxt_parse_args($args, $defaults); extract($r, EXTR_SKIP); return apply_filters('bp_activity_get_activity_id', BP_Activity_Activity::get_id($user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded)); }
/** * Fetch the activity_id for an existing activity entry in the DB. * * @since BuddyPress (1.2.0) * * @see BP_Activity_Activity::get() For more information on accepted arguments. * @uses wp_parse_args() * @uses apply_filters() To call the 'bp_activity_get_activity_id' hook. * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity} * * @param array $args See BP_Activity_Activity::get() for description. * @return int $activity_id The ID of the activity item found. */ function bp_activity_get_activity_id( $args = '' ) { $r = bp_parse_args( $args, array( 'user_id' => false, 'component' => false, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'action' => false, 'content' => false, 'date_recorded' => false, ) ); /** * Filters the activity ID being requested. * * @since BuddyPress (1.2.0) * * @param BP_Activity_Activity ID returned by BP_Activity_Activity get_id() method with provided arguments. */ return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $r['user_id'], $r['component'], $r['type'], $r['item_id'], $r['secondary_item_id'], $r['action'], $r['content'], $r['date_recorded'] ) ); }