Yoast\WP\SEO\Introductions\User_Interface
Introductions_Integration::update_metadata_for
Updates the introductions metadata format for the user This is needed because we're introducing timestamps for introductions that have been seen, thus changing the format.
Метод класса: Introductions_Integration{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->update_metadata_for( $user_id );
- $user_id(int) (обязательный)
- The user ID.
Код Introductions_Integration::update_metadata_for() Introductions Integration::update metadata for Yoast 28.3
private function update_metadata_for( int $user_id ) {
$metadata = $this->introductions_collector->get_metadata( $user_id );
foreach ( $metadata as $introduction_name => $introduction_data ) {
if ( \is_bool( $introduction_data ) ) {
$metadata[ $introduction_name ] = [
'is_seen' => $introduction_data,
'seen_on' => ( $introduction_data === true ) ? \time() : 0,
];
}
}
$this->user_helper->update_meta( $user_id, Introductions_Seen_Repository::USER_META_KEY, $metadata );
}