bbp_update_user_last_posted( int $user_id, int $time )

Update a users last posted time, for use with post throttling


Description Description


Parameters Parameters

$user_id

(Required) User ID to update

$time

(Required) Time in time() format


Top ↑

Return Return

(bool) False if no user or failure, true if successful


Top ↑

Source Source

File: includes/users/options.php

function bbp_update_user_last_posted( $user_id = 0, $time = 0 ) {

	// Validate user id
	$user_id = bbp_get_user_id( $user_id );
	if ( empty( $user_id ) ) {
		return false;
	}

	// Set time to now if nothing is passed
	if ( empty( $time ) ) {
		$time = time();
	}

	return update_user_option( $user_id, '_bbp_last_posted', $time );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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