I have a module that displays an alert to a user, inside of a block. Here is my GitHub repo, because I can't remember how to get a dev branch going on Drupal CVS right this second:
https://github.com/kevinquillen/User-Alerts
Module page 开发者_如何学Python(with longer description):
http://drupal.org/project/user_alert
I recently started addressing some of the issues in the queue. One of the first ones I wanted to get out of the way was making it so this module can still function when Block Cache and/or Boost are enabled. One person reported that when one user closed the message, it closed it for all other visitors, I assume this stems from caching mechanisms.
I added a Drupal.behavior to check for an active alert on page load- but I can't figure out how to only fire this behavior if the block is visible per its visibility settings. For instance, if its only set to the front page, this behavior should only fire on the front page and not all pages (adding overhead).
check for the existence of your blocks css class, or add a class specificly for this check, before firing off AJAX call. If your class exists your block exists.
精彩评论