What's been on my mind

Disable tinymce for fields in drupal module: webform

Submitted by Charles on Fri, 05/23/2008 - 12:51
I normally disable tinymce for certain textareas by overriding the tinymce function theme_tinymce_theme. This allows me to target textareas by their name attribute. For example, to disable the editor for all cck fields that I have named 'description', and all the devel modules 'php code' block textareas, one would put the following in that function: function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) { switch ($textarea_name) { // Disable tinymce for these textareas - using the field's name attribute

Make a user agree to a drupal site's terms and conditions

Submitted by Charles on Sun, 04/20/2008 - 07:54
Came across a module that does exactly this, the Legal module. When an anonymous user registers to use a drupal site, they get presented with the normal registration form with the terms and conditions of the site below. If an administrator adds a user, the first time the user logs in, before they can go any further, they need to accept the terms and conditions. In both cases, it's just a checkbox at the bottom of the terms and conditions that they must check before being allowed to continue.

Drupal support irc channel

Submitted by Charles on Thu, 02/28/2008 - 09:49
If you can't find what you're looking for on the drupal site, you might want to try the drupal support irc channel, and ask your question there. Using your irc client, login to: /server irc.freenode.net [after connecting successfully] /join #drupal-support

Firefox images getting extra space when in table cell

Submitted by Charles on Mon, 08/27/2007 - 11:28
Disclaimer: OK - so I know I shouldn't be using tables, but sometimes, I just have to. Was trying to figure out this extra space around an image that was sitting in a table cell. Came across this article which explains why. It's to do with using a strict doctype, and the fact that the images are by default inline which display on top of the baseline. Quick fix for me was to apply the following style to the offending images: .header-image {display:block}

Drupal CCK email field errors: "doesn't have a default value query"

Submitted by Charles on Mon, 08/20/2007 - 11:10

Ran into this error a couple of times before when adding content to a CCK email field in MySQL 5.0.27: user warning: Field 'field_email_email' doesn't have a default value query: It seems the email field is initially set up to not allow null values. To fix this check out this patch or just update the field in phpMyAdmin: ALTER TABLE `table_name` CHANGE `field_email_email` `field_email_email` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL

How Drupal's CCK already provides a safely formatted cck field for display

Submitted by Charles on Thu, 08/16/2007 - 10:58

Came across an interesting post when investigating some "n/a" text appearing in a CCK node field when not logged in. I was using the code echo content_format('field_description', $field_description[0]); to safely format and output the description field. Not sure exactly why it happens but it turns out that there's no need to actually do it that way as CCK already provides a safe string of that field for outputting to the browser that is already formatted accordingly.