Yoast\WP\SEO\Introductions\Infrastructure

Introductions_Seen_Repository::set_introduction()publicYoast 1.0

Sets the introduction as seen.

Метод класса: Introductions_Seen_Repository{}

Хуков нет.

Возвращает

true|false. False on failure. Not having to update is a success.

Использование

$Introductions_Seen_Repository = new Introductions_Seen_Repository();
$Introductions_Seen_Repository->set_introduction( $user_id, $introduction_id, $is_seen ): bool;
$user_id(int) (обязательный)
The user ID.
$introduction_id(строка) (обязательный)
The introduction ID.
$is_seen(true|false)
Whether the introduction is seen.
По умолчанию: true

Код Introductions_Seen_Repository::set_introduction() Yoast 24.4

public function set_introduction( $user_id, string $introduction_id, bool $is_seen = true ): bool {
	$introductions = $this->get_all_introductions( $user_id );

	// Check if the wanted value is already set.
	if ( \array_key_exists( $introduction_id, $introductions ) && $introductions[ $introduction_id ] === $is_seen ) {
		return true;
	}
	$introductions[ $introduction_id ] = $is_seen;

	return $this->set_all_introductions( $user_id, $introductions );
}