From fff721dd185f5b97f7ae7a6e64189e55887ff590 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 05 Jul 2026 18:36:57 +0000
Subject: [PATCH] =Cleaning up the Square integration (still a bit more to do yet). Also majorly overhauled /rest/ files to ignore a rest request 'user' paramater, and rely on get_current_user_id() instead.

---
 inc/rest/routes/Invitations.php |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/inc/rest/routes/Invitations.php b/inc/rest/routes/Invitations.php
index 1839f44..6322115 100644
--- a/inc/rest/routes/Invitations.php
+++ b/inc/rest/routes/Invitations.php
@@ -43,7 +43,6 @@
 		Route::for('invitations')
 			->get([$this, 'getInvitations'])
 			->args([
-				'user' => 'int|required',
 				'to_term' => 'int',
 				'taxonomy' => 'string',
 				'status' => 'string|enum:all,pending,accepted,rejected,expired,revoked|default:all',
@@ -54,7 +53,6 @@
 
 			->post([$this, 'createInvitationRequest'])
 			->args([
-				'user' => 'int|required',
 				'action' => 'string|enum:create,revoke,refresh|default:create',
 				'invites' => 'array',
 				'invitation_id' => 'int'
@@ -69,12 +67,12 @@
 	 */
 	public function getInvitations(WP_REST_Request $request): WP_REST_Response
 	{
-		$userID = $request->get_param('user');
+		$userID = get_current_user_id();
 		$termID = $request->get_param('to_term');
 		$taxonomy = $request->get_param('taxonomy');
 
 		// Validate user
-		if (get_current_user_id() !== $userID) {
+		if (!$userID) {
 			return $this->unauthorized('Invalid user');
 		}
 
@@ -185,11 +183,11 @@
 	 */
 	public function createInvitationRequest(WP_REST_Request $request): WP_REST_Response
 	{
-		$userID = $request->get_param('user');
+		$userID = get_current_user_id();
 		$action = $request->get_param('action');
 
 		// Validate user
-		if (get_current_user_id() !== $userID) {
+		if (!$userID) {
 			return $this->unauthorized('Invalid user');
 		}
 

--
Gitblit v1.10.0