mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Can update following status of a group membership.
This commit is contained in:
		@@ -626,6 +626,28 @@ class GroupsController {
 | 
			
		||||
		return array("success" => "Your membership has been successfully deleted!");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set whether a user is following a group or not
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @url POST groups/set_following
 | 
			
		||||
	 */
 | 
			
		||||
	public function setFollowing(){
 | 
			
		||||
		user_login_required();
 | 
			
		||||
 | 
			
		||||
		//Get the group
 | 
			
		||||
		$groupID = getPostGroupIdWithAccess("groupID", GroupInfo::MEMBER_ACCESS);
 | 
			
		||||
 | 
			
		||||
		//Get following status
 | 
			
		||||
		$following = postBool("follow");
 | 
			
		||||
 | 
			
		||||
		//Save the new value
 | 
			
		||||
		if(!components()->groups->setFollowing($groupID, userID, $following))
 | 
			
		||||
			Rest_fatal_error(500, "Could not update following status!");
 | 
			
		||||
		
 | 
			
		||||
		//Success
 | 
			
		||||
		return array("success" => "Follow status has been successfully updated!");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Parse a GroupInfo object into an array for the API
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user