How can I customize the Banned IP message in Drupal 7?
I was reading your article https://www.inmotionhosting.com/support/website/drupal/blocking-a-specific-ip-address-in-drupal and was wondering how you could customize the message “Sorry, 141.0.10.182 has been banned.” I'm a web developer and would like to customize that message. Do you know how?
/** * Handles denied users. * * @param $ip * IP address to check. Prints a message and exits if access is denied. */ function drupal_block_denied($ip) { // Deny access to blocked IP addresses - t() is not yet available. if (drupal_is_denied($ip)) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); print 'Sorry, ' . check_plain(ip_address()) . ' has been banned.'; exit(); } }
Notice, the line:print 'Sorry, ' . check_plain(ip_address()) . ' has been banned.';
You simply need to edit this line to whatever you'd like the banned IP address message to be. If you need further assistance please feel free to contact us. Thanks! Tim S