wordpress-activitypub/templates/author-json.php
Matthias Pfefferle 09518ea66b prepare pseudo users like a blog wide user.
this allows also other constructs like tag oder category users

fix #1
2023-06-27 14:25:12 +02:00

30 lines
919 B
PHP

<?php
$user = \Activitypub\User_Factory::get_by_id( \get_the_author_meta( 'ID' ) );
/*
* Action triggerd prior to the ActivityPub profile being created and sent to the client
*/
\do_action( 'activitypub_json_author_pre', $user->get_user_id() );
$options = 0;
// JSON_PRETTY_PRINT added in PHP 5.4
if ( \get_query_var( 'pretty' ) ) {
$options |= \JSON_PRETTY_PRINT; // phpcs:ignore
}
$options |= \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT;
/*
* Options to be passed to json_encode()
*
* @param int $options The current options flags
*/
$options = \apply_filters( 'activitypub_json_author_options', $options, $user->get_user_id() );
\header( 'Content-Type: application/activity+json' );
echo \wp_json_encode( $user->to_array(), $options );
/*
* Action triggerd after the ActivityPub profile has been created and sent to the client
*/
\do_action( 'activitypub_json_author_post', $user->get_user_id() );