jRating disables per theme block assignments
| Project: | jRating |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
We running Drupal 5.1 and have multiple subthemes being applied to different sections of our site. Each subtheme has a distinct set of blocks assigned to it. Some blocks are shared between sections however we had to go in to each theme individually and assign the blocks to the proper positions. After enabling jRating, none of the block assignments where accessible on the Blocks page using the Theme tabs. Only the default theme was able to receive block assignments which then didn't carry over to any of the subthemes. After disabling jRating, things went back to normal and the original block assignments were applied correctly.
Similar to the issue being detailed in this post for a different module, http://drupal.org/node/59702 Maybe a factor in the admin theme issue for jRating?

#1
hi
I got the same problem with the official version (i.e not dev).
and I don't understand why such important bug was not fixed yet.
Anyway, I found a quite easy fix:
near line 38 of file jrating.module,
replace the following code:
drupal_add_js('function rating_postsubmit(nid){' . theme('jrating_postsubmit') . '}', 'inline');by this one:
drupal_add_js('function rating_postsubmit(nid){ return true; }', 'inline');Seems that the call of the function "theme" is unnecessary here, and is inducing the problem.
#2
The use of theme is necessary here, as it allows you to set the action that should be called in javascript after the vote is made.
What I don't understand is why this is interfering with other theme functions.
(It hasn't been fixed yet because I'm not using multiple themes, so haven't got this problem).
Perhaps this could be made configurable by including a javascript file from the theme folder instead...
#3
hi hickory,
The use of theme is necessary here, as it allows you to set the action that should be called in javascript after the vote is made.If I'm not wrong , the function theme_jrating_postsubmit always return true by default. I looked trough all the code of jrating , searching for the string "jrating_postsubmit" , and found nowhere a code that modify such behavior.
Also, It seems to work, so I don't know what dysfunctions my fix introduce.
It hasn't been fixed yet because I'm not using multiple themes, so haven't got this problemWell, I like to use at least two different themes one for frontend, and one for backend. I think that's important to make a clear distinction, especially, if you begin to use drupal.
What I don't understand is why this is interfering with other theme functions.I just began to use drupal, and I'm not very familiar with API. However , according to this thread my guess is that the problem comes from the call of the init_theme function by the theme function itself. Perhaps , you should take a look at the actual implementation of the theme function here
#4
It's a themeable function, so you can override it in your theme file to change the action that happens after a vote is placed.
#5
I'm experiencing the same problem. I confirm the patch from #1 works for me.
#6
same problem......
#7
Another workaround would be to _not_ add the JavaScript on admin pages.
<?phpif (arg(0) != 'admin') {
drupal_add_js('function rating_postsubmit(nid){' . theme('jrating_postsubmit') . '}', 'inline');
}
?>
#8
The explanation for this is in http://drupal.org/node/64409#comment-408346 - I'll have to move the theme function out of hook_menu or hook_init.
#9
Removed the theme function call. jrating_postsubmit can now be defined in a javascript file included by an individual theme or module.
#10
Automatically closed -- issue fixed for two weeks with no activity.