Monthly Archives: July 2010

Dealing with fake users and spam

When fake users sign up for accounts with the purpose of posting SPAM, it is a good idea to:

-block their accounts rather than deleting them, because a bot will typically try and register under same username and with same email address. Thus blocking, disallows it to happen again. Obviously if the user is blocked, a bot can’t register with the same username and/or same email address. If you delete the account, you are allowing that same bot to register again with the same exact information.

-under user mgmt>user settings, switch to “Only site administrators can create new user accounts”. Handy with websites with small amount of users handling content.

-under user mgmt>access rules a rule can be added to deny particular users/email addresses with the use of wildcards, such as ,which would deny any user on that domain.

-use captcha type modules.


Filefield errors when uploading a document

Got an HTTP error 0 occured { “status”: true, “data”: ….} when uploading a file to attach to a node using custom defined filefields. The following worked to solve it (as reported in, but now instead of handling uploads with ajax the page refreshes after uploading the document:

I wanted to know what made the difference between the two releases and stumbled upon
in that file, around line 271 there was something remarkeable going on.

The lines that provided the ahah wrapper where commented out !

/*    '#ahah' => array( // with JavaScript
'path' => 'filefield/ahah/'.   $element['#type_name'] .'/'. $element['#field_name'] .'/'. $element['#delta'],
'wrapper' => $element['#id'] .'-ahah-wrapper',
'method' => 'replace',
'effect' => 'fade',

So, what I did to work things out was :

  1. Just install the latest version of the Filefield module
  2. Open up with a texteditor
  3. and comment out the lines above.

If anyone can shed some light on to what this does and if this kills other functionalities that I’m not aware of, let me know.
But I just have to do it this way, cause nothing else would work.

Troubleshooting WYSWIG editor outputting html tags in the text

I am using CKeditor in my case, but some fields were being outputed as “<p>”´s etc. , after checking input filters and making changes to no avail I read in that the problem was caused by a CCK field, that was configured to plain text when it should have been to filtered text (in admin>content type>schools>manage fields>my_particular_field, under text processing it has to be set to “input filters”).

Custom sql querys in drupal

I wanted to create a view to a block that displays latest 2 news, courses that haven´t started yet and vacancies if existing. This is addressed with a union query that is written into a module. Followed this tutorial:

It is a good idea to debug custom sql queries with phpmyadmin. Correct formatting of the custom made php modules is crucial, as the opening php tag and the commented $Id have to be in different lines, as such:

// $Id: custom_views.module,v 20010/05/07 12:25:24 goba Exp $

…otherwise we can get “cannot modified header information – headers already sent by” error, as detailed in: