Hi,

So first off, Thanks for making this a module I had read your blog post and was getting ready to try to write my own, then this showed up.

Basically I install the module (UUID and Scheduler also) got all excited made a user alert and it didn't show up in the block, so I tried a couple more, and tried it in chrome and safari in addition to firefox. It just looks like the content is never being loaded. I did just upgrade to drupal 7.7 right before installing so am a little worried there was a bug introduced with the new version, but I'm not really sure.

I have tried both the release and development version of UUID I also tried it in php/mysql mode, and with only the base turned on and everything active. Looking at the db it has no record of me closing them, so I'm not sure whats going on. I'd love to help debug it but sticking random print and drupal_set_message('Don\'t panic!', 'warning'); through out got no response so I'm not sure user_alert_display_alert() is actually being called.

-Tristan

CommentFileSizeAuthor
#33 1238862.patch1.7 KBkevinquillen

Comments

tristanmatthews’s picture

Ok, so I solved my problems. They where 2 fold.

1) I have my drupal module installed in /hotel so in user-alert.js when it uses the path /admin/user-alert/get-message it wasn't finding it for some reason so adding /hotel to the front of that made that work.

2) The theme I'm using had the the block template set to instead of

so the js couldn't find it. So I updated my theme to divs.

Things seem to be working now.

-Tristan

kevinquillen’s picture

Is there a file pathing issue?

kevinquillen’s picture

Status: Active » Postponed (maintainer needs more info)
erok415’s picture

I can't get the user alerts to show up in any block I place them in. I enabled the base UUID module and the scheduler. Is there something that I'm missing?
E.

kevinquillen’s picture

Are you getting any JS/AJAX errors? Check the Firebug console (Firefox plugin) Response console.

kevinquillen’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing due to no follow-up.

anovac’s picture

Status: Closed (cannot reproduce) » Needs review

On line 216 on user_alert.module, one might want to replace this:

$vars['body'] = $vars['node']->body['und'][0]['safe_value'];

with this:

$vars['body'] = $vars['node']->body[$node->language]['0']['safe_value'];

Then the body of the alert will show up in alert block.

sammy-node’s picture

Same problem with me - block shows up but alerts inside it don't. Sorry, not really a developer so I really can't add anything more useful.

kevinquillen’s picture

You guys are using the latest version (7.x-1.4)? Is this Drupal 7.12? What are your caching settings? What browser are you using? I am using the latest User Alert in D7.12, 7.x-1.4, and was able to get the user alert to show in FF, Safari, Chrome, with caching enabled and disabled, clear urls on and off, for anon and auth users.

kevinquillen’s picture

I just committed a change to fix the issue noted in #7. I also changed some other things, look for a new release. Clear your cache, I changed the admin path of the module.

sammy-node’s picture

Hi

Just upgraded module and doesn't seem to be working - I'm not assuming I haven't done something to prevent it working btw. Just that I afaik it's installed as per instructions and it's not showing up.

Current Status:
Drupal 7.12
Version 7.x-1.5
Caching off
Logged in as Admin

Cheers

sammy-node’s picture

Title: Alerts Not Showing Up In Block » Alerts Not Showing Up In

Also browsers tested in;
Firefox 10.0.2
Chrome 17.0963
IE 9

kevinquillen’s picture

Hmmmm I am at a loss. I tried this on a couple of sites and have not had an issue.

sammy-node’s picture

OK - its a theme issue. Garland works, Sky doesn't. http://drupal.org/project/sky - should have checked this earlier.

I like the module a lot - what would I need to consider in the theme that might stop it working, please?

kevinquillen’s picture

Okay, thats progress. I mainly use Omega theme. I guess I will have to look at Sky- my guess is there is something in its template.php that is interfering.

kevinquillen’s picture

Title: Alerts Not Showing Up In » Module does not show alerts in certain themes
Version: 7.x-1.0 » 7.x-1.x-dev
Component: Miscellaneous » Code
Assigned: Unassigned » kevinquillen
Status: Needs review » Active

Okay, so, looking back at an earlier comment:

2) The theme I'm using had the the block template set to instead of so the js couldn't find it. So I updated my theme to divs.

It looks like some stuff was stripped out of there. I wonder if some themes block ID patterns are different and that might be whats causing the issue?

sammy-node’s picture

This is from the sky theme:

<section id="block-user-alert-user-alert" class="block block-user-alert block-odd block-count-4 block-region-sidebar-first">
  <div class="block-inner clearfix">
              <h2 class="block-title">Notice Alert</h2>
            <div class="block-content content">
           </div>
  </div>
</section>
kevinquillen’s picture

OH, okay, its enclosed in a section tag instead of a div tag. I suppose I can remove 'div' from the js selector to be applicable in HTML5 themes that use section. That should fix it. You can test that by removing 'div' from the selector in the user alert javascript in the module. Clear the cache and try it out.

This line right here:

success: function(response) {
					 $('div#block-user-alert-user-alert').html(response[1].data);

If that works for you, I'll commit this and get a new release up tomorrow. This was written long before I used HTML5 themes, and it didn't dawn on me that some will output section instead of div.

kevinquillen’s picture

Status: Active » Needs review
sammy-node’s picture

Beautiful. Thanks, please add the fix.

kevinquillen’s picture

Status: Needs review » Fixed

Committed in 7.x-1.6.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mrpeanut’s picture

Version: 7.x-1.x-dev » 7.x-1.7
Status: Closed (fixed) » Active

I'm having this same issue (using 7.x-1.7) on the Analytic theme. Shouldn't that commit have fixed the issue?

kevinquillen’s picture

Yes, it should. I just checked the js and the change is there. Is there anything else you can tell me about that theme? Does the alert output contain an ID on the block or region? Are there any firebug errors?

mrpeanut’s picture

Here is the code that gets outputted:

<div class="column-3">  <div class="region region-right">
      <div class="block block-user_alert clearfix" id="block-user_alert-user_alert">
   <h2 class="title"><none></h2>    <div class="content clearfix"> </div>
 </div>

No errors or warnings from Firebug. There is a /js/user-alert/get-message 200 OK 87ms in the Console FWIW.

I have UUID and User Alert installed, and the block enabled. I don't think I'm missing anything else.

mrpeanut’s picture

FWIW I am using Analytic on a 6.x site and User Alert works fine.

kevinquillen’s picture

Hmm... I will have to install it and check it out later then.

mrpeanut’s picture

Okay, thanks, I appreciate it. If there's anything else you need me to do, just let me know where to look. Thanks!

Nick Fedchik’s picture

The same in 0 Point 7.x-1.1 theme, just turn on the module.
admin/content/scheduler is empty
All Sceduler settings in the User Alert nodetype are off (by default).
Then I turn on publishing/unpublishing checkboxes, edit the Alert Type node, see it in Scheduler, but, when publishing time happend, the node still in "unpublished" status and I see nothing.

Then in the nodetype form of the Alert Type I turn on only
Enable scheduled publishing
Enable scheduled unpublishing
and set Published for my User Alert node.

See nothing in block on frontpage in 0 Point 7.x-1.1 theme (Firefox with logged in user (admin)).

But I see a back label and yellow ribbon if just switch theme to Garland (Chrome, anonymous).

/js/user-alert/get-message show me this code

[ {"command":"settings", "settings":{"basePath":"\u002F", "pathPrefix":"", "ajaxPageState":{"theme":"garland", "theme_token":"QeslwUf1jI1u26Jaq7kPs8R6geg1zph2OzYKP77qQes", "css":[ ]}, "user_alert":{"url_prefix":""}}, "merge":true}, {"command":"insert", "method":null, "selector":null, "data":"", "settings":null}, {"command":"insert", "method":"prepend", "selector":null, "data":"", "settings":null} ]

with different "theme_token" on each page refresh.

kevinquillen’s picture

Alright, for the ZeroPoint theme, the block ID is being output as block-user_alert-user-alert instead of block-user-alert-user-alert, so the JS fails. When I update the ID, it appears.

I developed this module while using the Omega theme, I suspect this is part of the issue, in its parent theme:


/**
 * Implements hook_preprocess_block().
 */
function alpha_alpha_preprocess_block(&$vars) {
  $vars['content_attributes_array']['class'][] = 'content';
  $vars['content_attributes_array']['class'][] = 'clearfix';
  $vars['attributes_array']['id'] = $vars['block_html_id'];
  $vars['attributes_array']['class'][] = drupal_html_class('block-' . $vars['block']->delta);  
  $vars['attributes_array']['class'][] = $vars['block_html_id'];
}

Investigating further...

mrpeanut’s picture

I'm guessing that is the same problem for the Analytic theme. The block ID that is being output is block-user_alert-user_alert.

Is there a spot in the code of either the module or the theme that I can manually override for now?

kevinquillen’s picture

It looks like the best solution would be to create a js variable to send to user_alert.js like url_prefix, retrive the block ID ahead of time and use that as a variable instead of a hardcoded line in javascript. I need to get the container wrapper the theme would generate.

Does anyone know why the IDs are different? I can't find anything in Zeropoint that modifies the ID name like I do in Omega. I don't want to break any existing installations.

Edit: MrPeanut and others, modify the user_alert.js file on line 11, and update the ID there with the ID that the theme is generating for the user alert block. Clear the caches and reload the page, that should fix it short term.

kevinquillen’s picture

Status: Active » Needs review
StatusFileSize
new1.7 KB

Try this patch. After this change, it worked for me in Sky, Zeropoint, Omega, Seven, Stark, Bartik and Garland. It did not work in Analytic, but I can't even get the block to appear in Analytic. I have a feeling its something with that theme.

For Analytic, it appears it hasn't been updated in a year. Might want to start here: http://drupal.org/project/issues/analytic?text=block&status=All&priorities=All&categories=All&version=All&component=All

mrpeanut’s picture

I manually changed line 11 of user_alert.js to .pane-user-alert-user-alert (I had it in a panel) and it works fine now.

kevinquillen’s picture

So the patch won't work with Panels? I changed it so the js grabs the ID from the block class, which was block-user-alert for all the themes I tested.

kevinquillen’s picture

Can everyone please relay to me what the ID is on the user alert block is when it is output in their source?

As noted, the Analytic theme for D7 just doesn't output the block, but I am not sure that is the fault of the module.

oturpin’s picture

Hello,
New user to drupal. I m trying to uset user alert, but have the same issue.
My versions : Drupal 7.12 and user alert 1.7, with theme Danland.
user-alert.js was updated with patch provided by kevinquillen.
But no difference.
Any idea ?
I m using a postgresql database 8.4.11.

Looking in the logs: I found a notice-level message:
Notice : Undefined index: fr dans user_alert_preprocess_user_alert() (ligne 213 dans /home/oturpin/equidrup/sites/all/modules/user_alert/user_alert.module).
May it be linked to the issue ?

Thx

vitaly_repin’s picture

I have similar problem: no alert body is displayed.

Drupal: 7.14
UserAlert: http://ftp.drupal.org/files/projects/user_alert-7.x-2.x-dev.tar.gz (I tested with stable version - the same outcome).

Workaround: line 211 in user_alert.module:

$vars['body'] = $vars['node']->body['und'][0]['safe_value'];

Replaced with

$vars['body'] = $vars['node']->body['und'][0]['value'];

There is no "safe_value" index in this array. I have checked the indexes it has: value, summary and format

After this fix everything is displayed as expected.

kevinquillen’s picture

I could have swore I changed that in one of the previous releases/dev.

Also, 2.x is really old- I haven't started working on that yet, haven't had the time I thought I would.

Let me make that change locally and look at those themes again.

kevinquillen’s picture

Version: 7.x-1.7 » 7.x-1.x-dev

Okay, just re-pushed that change into 1.x-dev. No more occurrences of safe_value.

Until 1.x-dev release updates with the change, change line 213 from 'safe_value' to 'value'.

kevinquillen’s picture

I am going to create a new release that includes the last two patches above.

I still can't make it show up in Analytic theme, but the rest of the reported themes do work.

#38, please let me know if the problem has gone away for you.

kevinquillen’s picture

Status: Needs review » Fixed

Release pushed. I will mark this fixed for now since no one has responded and I can no longer replicate the issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

oturpin’s picture

Hello,
I tried again user alert module with last updated versions : Drupal 7.14 and user alert 1.8, with theme Danland.
Same issue: alert content is not shown.
I still have the message : Notice : Undefined index: fr dans user_alert_preprocess_user_alert() (ligne 213 dans /home/oturpin/equidrup/sites/all/modules/user_alert/user_alert.module).
Does this problem have something to do with fr translation ?

I checked about vitaly_repin 's proposal, and code is already fixed on line 211 in user_alert.module.
$vars['body'] = $vars['node']->body['und'][0]['value'];

Any idea ?

kevinquillen’s picture

Is it because it is using $node->language as the key and theres no value 'fr'? I have not tested this with translations, but that just hit me. Are you able to dump out that part and tell me what it thinks $node->language is, or, what it should be?

oturpin’s picture

Hi kevinquillen,

Your idea is probably leading to the clue...
I replaced the line with that : $vars['body'] = $vars['node']->language;
I get an alert message which corresponds to the "fr" index.
So I wonder how it could be solved, because I m not using any other language ...???
What would be your advice ?

Thx

kevinquillen’s picture

Can you give me a list of your installed modules?

I have a couple of ideas around this.

kevinquillen’s picture

oturpin, please change line 212-213 and try this:

$language = $vars['node']->language ? $vars['node']->language : LANGUAGE_NONE;
$vars['body'] = $vars['node']->body[$language][0]['value'];
oturpin’s picture

Hi kevinquillem,
No change at all. I get exactly the same behavior. Nothing drawn. $language variable has "fr" value.
Here is the list of installed modules:

Drupal core 7.14
Contient : Bartik, Block, Blog, Color, Comment, Contact, Content translation, Contextual links, Dashboard, Database logging, Field, Field SQL storage, Field UI, File, Filter, Forum, Help, Image, List, Locale, Menu, Node, Number, Options, Overlay, Path, Profile, RDF, Search, Seven, Shortcut, Statistics, System, Taxonomy, Text, Toolbar, Tracker, Trigger, Update manager, User

Calendar 7.x-3.4
Contient : Calendar

Chaos tool suite (ctools) 7.x-1.0
Contient : Chaos tools, Page manager

Chat Room 7.x-2.0-alpha1
Contient : Chat Room

Date 7.x-2.5
Contient : Date, Date API, Date All Day, Date Popup, Date Views

Display Suite 7.x-1.5
Également disponible : 7.x-2.x-dev (2012-juin-29)

Contient : Display suite, Extras, Search display

elFinder file manager 7.x-0.7
Également disponible : 7.x-2.x-dev (2012-juin-26)

Également disponible : 7.x-1.x-dev (2012-mar-28)

Contient : elFinder

File (Field) Paths 7.x-1.0-beta3
Contient : File (Field) Paths

File entity (fieldable files) 7.x-2.0-unstable5
Contient : File entity

filedepot 7.x-1.0-beta2
Contient : Filedepot

Galleria 7.x-1.0-beta3
Contient : Galleria

Libraries API 7.x-1.0
Également disponible : 7.x-2.0-alpha2 (2011-déc-15)

Contient : Libraries

Localization update 7.x-1.0-beta3

Media 7.x-2.0-unstable5
Contient : Media

Node.js integration 7.x-1.0-rc1
Contient : Nodejs integration

Panels 7.x-3.2
Contient : Panel nodes, Panels, Panels In-Place Editor

Pathauto 7.x-1.1
Contient : Pathauto

Scheduler 7.x-1.0
Contient : Scheduler

Signup 7.x-1.x-dev (2012-mar-01)
Contient : Signup

SMTP Authentication Support 7.x-1.0-beta1
Contient : SMTP Authentication Support

Token 7.x-1.1
Contient : Token

User Alert 7.x-1.8
Contient : User Alert

Views 7.x-3.3
Contient : Views, Views UI

Workflow 7.x-1.0
Contient : Workflow, Workflow UI, Workflow access, Workflow actions and triggers

Wysiwyg 7.x-2.1
Contient : Wysiwyg
Thèmes

Danland 7.x-1.0
Contient : Danland

Thx !

oturpin’s picture

Hi again,

Further to your advice, kevinquillen, I modified code with that line:
$vars['body'] = $vars['node']->body[LANGUAGE_NONE][0]['value'];

This time I get a correct message in the alert box !!

So the problem is clearly a language issue with the object I created. The node was created with NO LANGUAGE although my configuration is "fr".

French Français fr De gauche à droite
Activer French

When I list the content objects, I can see the user_alert object is "French". Which seems correct...

Something I don't understand...

oturpin’s picture

Hi again and again...

Here is a proposal for fixing the language issue. Please tell me your mind about that:

I found a $node->translate booelan which indicates whether node is a translation. If not, I suppose LANGUAGE_NONE should be used.

So, just one little modification:

$language = $vars['node']->translate ? $vars['node']->language : LANGUAGE_NONE;
$vars['body'] = $vars['node']->body[$language][0]['value'];

I could even suppose you meant to write that ? Didn't you ?

Thx

kevinquillen’s picture

Thanks, I will look into that. I have never used trans/locale etc before, so I thought ->language or LANGUAGE_NONE was the advised way to account for it.

kevinquillen’s picture

Status: Closed (fixed) » Needs work
kevinquillen’s picture

What actually triggers the translate property of a node? I tried the Content Translation module and Locale, neither seemed to trigger it.

elshae’s picture

Hi everyone,

I appreciate all the hard work that has been done so far as I have a Drupal site that has a use case for this module. I am using Drupal 7.14, Omega 7.x-3, and User Alert 7.x-1.8. I am having the issue of my alert having no text or body displayed in it. I do have a multi-lingual site using i18n, locale, content translation etc. I'm sorry I cannot provide any help, I just wanted to point out that it was happening to me too :(

kevinquillen’s picture

elshae,

Can you try replacing line ~212 in user_alert.module with:

$language = $vars['node']->translate ? $vars['node']->language : LANGUAGE_NONE;
$vars['body'] = $vars['node']->body[$language][0]['value'];

Does it show up then?

elshae’s picture

Yes! And thank you. I had misunderstood as I read this thread and had thought that the code you just gave me was the old code that you had replaced with the code currently in the module file. The only problem now is that I wish the alerts would show for the language to which they are in. If I translate my alerts, I get all of them on the page, one for each language :/.

kevinquillen’s picture

Hmm..

kevinquillen’s picture

Status: Needs work » Postponed (maintainer needs more info)

Is this still an open issue? I can't seem to replicate this, but I don't know exactly how to replicate this bug since I do not have much experience with locale/translation.

If someone is still experiencing this, can they please provide me a step by step way to reproduce and/or see this issue? That would put me in a much better position to debug it.

As it stands, I am able to see alerts in any of the themes reported above.

siriusb’s picture

Version: 7.x-1.x-dev » 7.x-1.8

Hi,

I've just updated a site from drupal 6 to 7 and I bumped into this issue, however the proposed fix in #56 solved the problem.

So after upgrading a dupal 6 site with a working user alert module, the alert itself was displayed but not the content (body) of the user alert node.
I don't know if it can be any help, but here's my modules list: http://pastebin.com/Tt1erzjz

markosaurus’s picture

I'm on the latest Drupal 7 with a custom theme.

Block is showing on the front-end, but no content;

<h2><none></none></h2>

Shows in garland on the back-end though?

I don't have time to wait for a fix for this or to investigate so I'm going back to a view, block and content type.

kevinquillen’s picture

Version: 7.x-1.8 » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Fixed

Your custom theme may not be implementing an ID in the block.tpl.php. I just noticed this as well on the Foundation theme. It's tpl does not put ID's on blocks.

I have changed the JS in the latest commit to simply use the .block-user-alert as the selector instead of look for its container ID. I then saw the alert in every theme on my install (Bartik, Seven, Foundation, Sky, etc).

http://drupalcode.org/project/user_alert.git/blobdiff/bcddfa256d3e9cb694...

At the very least, the templates rendering blocks need to put classes out in order for this to work.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.