check if ID is set
fallback to URL
This commit is contained in:
parent
d00e5a03c8
commit
1af821621b
1 changed files with 7 additions and 2 deletions
|
@ -123,6 +123,7 @@ class Inbox {
|
||||||
* @return WP_REST_Response
|
* @return WP_REST_Response
|
||||||
*/
|
*/
|
||||||
public static function user_inbox_post( $request ) {
|
public static function user_inbox_post( $request ) {
|
||||||
|
var_dump( $request->get_params() );
|
||||||
$user_id = $request->get_param( 'user_id' );
|
$user_id = $request->get_param( 'user_id' );
|
||||||
$user = User_Collection::get_by_various( $user_id );
|
$user = User_Collection::get_by_various( $user_id );
|
||||||
|
|
||||||
|
@ -236,8 +237,12 @@ class Inbox {
|
||||||
$params['actor'] = array(
|
$params['actor'] = array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'sanitize_callback' => function( $param, $request, $key ) {
|
'sanitize_callback' => function( $param, $request, $key ) {
|
||||||
if ( ! \is_string( $param ) ) {
|
if ( \is_array( $param ) ) {
|
||||||
|
if ( isset( $param['id'] ) ) {
|
||||||
$param = $param['id'];
|
$param = $param['id'];
|
||||||
|
} else {
|
||||||
|
$param = $param['url'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return \esc_url_raw( $param );
|
return \esc_url_raw( $param );
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue