BP_Core_User::delete_last_activity( int $user_id )

Delete a user’s last_activity value.

Parameters Parameters


(int) (Required) ID of the user whose activity should be deleted.

Top ↑

Return Return

(bool) True on success, false on failure or if no last_activity is found for the user.

Source Source

File: bp-core/classes/class-bp-core-user.php

	public static function delete_last_activity( $user_id ) {
		global $wpdb;

		$existing = self::get_last_activity( $user_id );

		if ( empty( $existing ) || empty( $existing[ $user_id ]['activity_id'] ) ) {
			return false;

		$deleted = $wpdb->delete(

			// WHERE.
				'id' => $existing[ $user_id ]['activity_id'],

			// WHERE sanitization format.

		wp_cache_delete( $user_id, 'bp_last_activity' );

		return $deleted;

Top ↑

Changelog Changelog

Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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