BP_Core_User::delete_last_activity( int $user_id )

Delete a user’s last_activity value.


Description Description


Parameters Parameters

$user_id

(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.


Top ↑

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(
			buddypress()->members->table_name_last_activity,

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

			// WHERE sanitization format.
			array(
				'%s',
			)
		);

		wp_cache_delete( $user_id, 'bp_last_activity' );

		return $deleted;
	}

Top ↑

Changelog 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.