Guest User

WHMCS blacklist check on ticket-form

a guest
Oct 13th, 2024
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined("WHMCS"))
  4. die("This file cannot be accessed directly");
  5.  
  6. use WHMCS\Database\Capsule;
  7.  
  8. add_hook('TicketOpenValidation', 1, function($vars) {
  9. $useremail = strtolower($vars['email']);
  10.  
  11. if (!filter_var($useremail, FILTER_VALIDATE_EMAIL)) {
  12. return 'Invalid email format.';
  13. }
  14.  
  15. $blocked = Capsule::table('tblticketspamfilters')
  16. ->where('type', 'sender')
  17. ->where('content', $useremail)
  18. ->exists();
  19.  
  20. if ($blocked) {
  21. return 'Sorry, you cannot open a ticket.';
  22. }
  23. });
Advertisement
Add Comment
Please, Sign In to add comment