Hi,

For some reason the modal popup only works on my front home page, if i go into any other page (article, blog etc) then when I click on the login/create new account links they open the standard page and not model.

Is this by design because I cannot see any configuration that shows this kind of behaviour.

many thanks

Millzee

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Spleshka’s picture

Hi,

The problem is definetely in your theme. Module not provides settings for popup.

Teeman’s picture

Hi,

I'm experiencing the same problem. What could the problem be with the theme?

Teeman’s picture

Disabling block caching solved the problem for me

Spleshka’s picture

Status: Active » Closed (works as designed)

This is not a Ajax Register issue. The problem may occurs because of cache settings (page cache or block cache).

auberdjinn’s picture

Version: 7.x-4.0-rc13 » 7.x-4.0-rc15
Status: Closed (works as designed) » Active

Hello,

I can confirm this issue.

I think it is an ajax_register issue because the links do not work if block caching is enabled. This means that a site admin cannot choose to cache other blocks if they are using ajax_register. I don't think it should be necessary to turn block caching off altogether in order to use this module.

The problem is that the javascript file is added to the page within ajax_register_block_view(). This is only called when the block is built. It's not called if the block is cached, so the javascript for the popup doesn't get included after the first view of the site.

It could be fixed by not caching this block, i.e. change the cache setting in ajax_register_block_info() to DRUPAL_NO_CACHE.

Or maybe the call to drupal_add_js() could be placed somewhere other than hook_block_view(), e.g. hook_init()?

I'm not sure which approach would be best.

auberdjinn’s picture

Issue summary: View changes

amended

kalabro’s picture

Title: Modal Popup » JS/CSS is not attached when Block cache is enabled
Version: 7.x-4.0-rc15 » 7.x-4.x-dev
Category: Support request » Feature request
Issue summary: View changes
FileSize
5.6 KB

Blocks support attached JS/CSS with "#attached" key. I used it successfully and provide raw patch. It can be buggy or outdated.

swim’s picture

Tested the patch in #6 and can confirm that Kalabro has amended the issue. This should be fairly easy to replicate, clean install of Drupal 7 & enable block & page cache.

As Kalabro has said above blocks support attaching CSS & JS in a renderable array which is more cache friendly.