2018-08-21 13:17:07 +00:00
|
|
|
<?php
|
2018-08-21 21:52:56 +00:00
|
|
|
namespace api;
|
|
|
|
|
|
|
|
require_once plugin_dir_path( __FILE__ ) . '/actors.php';
|
2018-08-21 13:17:07 +00:00
|
|
|
|
|
|
|
function get_user( $data ) {
|
|
|
|
$handle = $data["handle"];
|
|
|
|
$id = get_user_by( 'slug', $handle );
|
2018-08-21 21:52:56 +00:00
|
|
|
return \actors\author_to_user( $id );
|
2018-08-21 13:17:07 +00:00
|
|
|
}
|
|
|
|
|
2018-08-21 21:52:56 +00:00
|
|
|
function register_routes() {
|
|
|
|
register_rest_route( 'activitypub/v1', '/user/(?P<handle>[a-zA-Z0-9-]+)', array(
|
2018-08-21 13:17:07 +00:00
|
|
|
'methods' => 'GET',
|
2018-08-21 21:52:56 +00:00
|
|
|
'callback' => __NAMESPACE__ . '\get_user',
|
2018-08-21 13:17:07 +00:00
|
|
|
) );
|
2018-08-21 21:52:56 +00:00
|
|
|
}
|
2018-08-21 13:17:07 +00:00
|
|
|
?>
|