Just upgraded textsize and got this error:

Fatal error: Call to undefined function jquery_plugin_add() in textsize/textsize.module on line 326

It's fine to add in the requirement for this plugin module, but it's important to check for it first, this would be better for the last line:

if (function_exists('jquery_plugin_add')) {
  jquery_plugin_add('cookie');
} else {
  drupal_set_message(t('Drupal\'s jQuery Plugin Module Required for textsize functionality'));  
}
CommentFileSizeAuthor
textsize_check.patch491 bytesmgifford

Comments

CZ’s picture

Status: Active » Fixed

Thanks. Fixed in the 6.x-1.x-dev version.

mgifford’s picture

Excellent.. Glad this little module is maintained..

Status: Fixed » Closed (fixed)

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

dkruglyak’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Closed (fixed) » Needs review

Oops, wrong solution!

The fatal error (or "Required" message) happens because textsize_jq_plugin() is called when the module is loaded, which is BEFORE other modules may be loaded, including jquery_plugin. Perhaps not everyone can reproduce this since the load order of file depends on their file system structure.

The solution is to move the following chunk of code, called at the end of textsize.module inside textsize_init() hook:

textsize_print_html();
textsize_print_js_css();
textsize_jq_plugin();
textsize_check();

The fix is tested and works. The same problem needs to be fixed in pagestyle.module.

dkruglyak’s picture

I should add that the problem is not with "multisite install" per se, even though I do run multiple sites.

Simply under certain filesystem structure (determining the module code loading order?) the module causes the bug.

mrfelton’s picture

the fix at #4 works here also.

CZ’s picture

Status: Needs review » Fixed

Done.

Status: Fixed » Closed (fixed)

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