| @@ -14,9 +14,14 @@ | ||
| 14 | 14 | /** |
| 15 | 15 | * Initialize the class, registering WordPress hooks |
| 16 | 16 | */ |
| 17 | 17 | public static function init() { |
| 18 | - \add_action( 'activitypub_inbox_create', array( self::class, 'handle_create' ), 10, 3 ); | |
| 18 | + \add_action( | |
| 19 | + 'activitypub_inbox_create', | |
| 20 | + array( self::class, 'handle_create' ), | |
| 21 | + 10, | |
| 22 | + 3 | |
| 23 | + ); | |
| 19 | 24 | } |
| 20 | 25 | |
| 21 | 26 | /** |
| 22 | 27 | * Handles "Create" requests |
| @@ -27,8 +32,12 @@ | ||
| 27 | 32 | * |
| 28 | 33 | * @return void |
| 29 | 34 | */ |
| 30 | 35 | public static function handle_create( $array, $user_id, $object = null ) { |
| 36 | + if ( ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS ) { | |
| 37 | + return; | |
| 38 | + } | |
| 39 | + | |
| 31 | 40 | if ( |
| 32 | 41 | ! isset( $array['object'] ) || |
| 33 | 42 | ! isset( $array['object']['id'] ) |
| 34 | 43 | ) { |
| @@ -51,9 +60,9 @@ | ||
| 51 | 60 | |
| 52 | 61 | $state = Interactions::add_comment( $array ); |
| 53 | 62 | $reaction = null; |
| 54 | 63 | |
| 55 | - if ( $state && ! \is_wp_error( $reaction ) ) { | |
| 64 | + if ( $state && ! \is_wp_error( $state ) ) { | |
| 56 | 65 | $reaction = \get_comment( $state ); |
| 57 | 66 | } |
| 58 | 67 | |
| 59 | 68 | \do_action( 'activitypub_handled_create', $array, $user_id, $state, $reaction ); |