mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-10-31 10:14:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			614 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			614 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Notifications helper
 | |
|  * 
 | |
|  * @author Pierre HUBERT
 | |
|  */
 | |
| 
 | |
| /**
 | |
|  * Delete all the notifications related to a post targeting a user
 | |
|  * 
 | |
|  * @param int $userID Target user ID
 | |
|  * @param int $postID Target post
 | |
|  * @return bool TRUE in case of success / FALSE else
 | |
|  */
 | |
| function delete_user_notifications_over_post(int $userID, int $postID) : bool {
 | |
| 
 | |
| 	user_login_required();
 | |
| 
 | |
| 	$notification = new Notification();
 | |
| 	$notification->set_on_elem_type(Notification::POST);
 | |
| 	$notification->set_on_elem_id($postID);
 | |
| 	$notification->set_dest_user_id($userID);
 | |
| 	return components()->notifications->delete($notification);
 | |
| 
 | |
| } | 
