Display message instead of redirecting to Access Denied page I'm using Commerce Auction module for an auction site. I want to display a message when the auction time out occurs for a certain product and at the same moment the user clicks on place bid tab.

Scenario:


Created an auction item
Started bidding with different users.
When auction time out just occurs and at the same moment any user clicks on Place Bid tab that user is redirected to Access Denied page.


Now instead of redirecting to access denied page, how to display a message on the same page?

I have set a rule for mailing purpose on the same event. I also tried using "display message" rule for this event. But still it is displaying Access Denied message. I want to show different message only for this event.
1st attempt

Maybe the Disable Messages module can help here? Here is an excerpt from its project page:


  Gives a site owner options to disable specific messages shown to end users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal site owners are keen to show all the messages sent out by drupal core and all modules to their users. This module gives site administrators a reasonably powerful way to filter out messages shown to the end users.


Some of its features which might help in this specific case:


  
  Filter out messages that match a full text string exactly.
  Filter out messages that match a regular expression.
  Apply filtering only for specific paths.
  


2nd attempt

If the 1st attempt doesn't help, then you may want to try to expand the rule you already seem to have (as per your "I have set a rule for mailing purpose on the same event"). I.e by adding a rules action to flag the user (using the Flag module, with a flag you only use to indicate your scenario just happened to that user (let's say you label it "TimeOut").

Together with this, create an additional rule like so:


Rules Event: Drupal is initializing
Rules Conditions:


Current path matches your "no access" path (whatever that is in your case).
User is flagged with the "TimeOut"

Rules Actions:


Remove the "timeOut" flag (=unflag) for the current user.
Set your message.
Perform a redirect to a path that fits your needs.