-
Notifications
You must be signed in to change notification settings - Fork 7
mastodon_api_canonical_user_id
Alex Kirk edited this page Feb 8, 2025
·
4 revisions
Map a user id to a canonical user id.
This allows to ensure that the user id stays the same no matter of the relationship to this user. For example, if external user information is fetched about a user and we later follow that user, the user id should stay the same.
add_filter(
'mastodon_api_canonical_user_id',
function ( int $user_id ) {
// Your code here
return $user_id;
}
);
-
int
$user_id
The user ID.
int
The potentially modified user ID.
apply_filters( 'mastodon_api_canonical_user_id', $user_id )
apply_filters( 'mastodon_api_canonical_user_id', $remote_user_id->name )
apply_filters( 'mastodon_api_canonical_user_id', $user_id )