Drupal Musings
My journey into the territory of Drupal development....
I was getting the message An illegal choice has been detected. Please contact the site administrator. when submitting forms, and more annoyingly when doing an AJAX image upload on a form.
The problem is caused by the radio buttons that I have on my form. They are set up without a default value but as required. I believe the issue is that if a radio group dosen't have a value set, it doesn't existing within the DOM for the form in question, therefore leading to an error on the form checking.
The work-around for me was to change the field type from radio group to select list...
Some users on a Drupal site I have can create nodes which aren't published immediately; they need to go through a moderation process by the site admins. The content type in question is set not to publish right away. When I added a new node as a user all I got was the standard Drupal 'Content type Not another story again! has been created.' in a green box:
I want a moderation message in a yellow warning box instead. Something like this:
This can be done by installing the Rules module and then setting up a Rule to act on the After saving new content...
Wednesday, 5 October, 2011 - 11:55 - content permissions, development, Drupal, node access, programming, Views
I was pulling my hair out about some Drupal 7 Views weirdness! For some reason my normal users weren't able to view their own unpublished content even though they had the permission View own unpublished content permission set under the Node section. Users could view and edit the node if they went to the node directly, but it wasn't possible to show the node in a view, unless the user was an Administrator that is. I had got to the point of installing and using the Views Unpublished module, but this seemed like an imperfect solution.
After a lot of back-tracking...
Thursday, 15 September, 2011 - 10:13 - blocks, Drupal, menu attributes, menus, styling
For my Drupal 7 site, I want to have a nice menu that looks like the one to the right, with little styling icons and the like. By default Drupal adds little black triangles to any top-level menu item that has sub-menu items below it. In my example, I've replaced these with nice little custom icons and move the triangles to the sub menu level.
The menu has been already put automatically into a block using the magick of the Menu Block module. The initial problem is that there's no default way in Drupal 7 to address the individual menu items in order to style them...
Wednesday, 14 September, 2011 - 15:37 - customisation, Drupal, themes, theming
Warning: this is a bit of a hack methinks.
A site I'm working on contains a mixture of pages, views nodes and taxonomy results depending on the type of content. I was having problems getting it to display the correct breadcrumb for this mix of types of content. The Menu Breadcrumb won't do the trick as not all my pages are on the menu, especially those that are nodes. I also tried the Custom Breadcrumb module, but it didn't do the trick for me and had quite a cumbersome user interface to boot.
I therefore decided to do it in code, which involves...
I'm still learning about how Drupal works under the hood, so please bear that in mind, but it seems that the comment setting on the Content Type acts as a template for any nodes created using it, therefore as the other poster said, you need to go back and change all your old nodes, which can be a bind.
If you're happy diving into the database and doing it via SQL you can with the following queries, which I've tested on Drupal 7, but looking at the db structure for Drupal 6, should work for it as well:
We need to set the 'comment' column in the table 'node' to...
Friday, 15 July, 2011 - 11:58 - Drupal
Introduction
This article will allow you to support having both login usernames and real (as in natural language) usernames existing simulataneously in Drupal 7. For example, my username might be mbh, but what I'd like is that it appears for myself and everyone else as Mike Harris. There's also some code to link it into your own module. But first some background...
Some background: why I wanted to do this...
For a project I'm doing, I recently migrated to Drupal 7. This was no mean feat in itself: I did try to upgrade from 6 to 7, but the...
Wednesday, 11 May, 2011 - 08:12 - call_user_func_array, Debian, Drupal, PHP
I've been working on a site built in Drupal 6. The site is to integrate with an existing system and therefore I had to integrate into an existing login authentication mechanism. The components are:
Existing front-end login/logout mechanism, written in PHP.
Existing back-end scripts, written in Perl.
New back-end areas, written in Drupal, ultimately in PHP.
I have therefore written my own authentication module based on the code example at this web site and also from the book Pro Drupal Development 2nd Edition.
Amongst other things, I had my own login validation...
Am pleased to say that we finally got the new One Central Place web site launched and live! The new site is built on CiviCRM and Drupal and is a great improvement in functionality over the old version, which was a bespoke site built in Django.
This was my first proper introductin to CiviCRM running on top of Drupal and the pair's ability to deliver bespoke web solutions.
It was an interesting experience. Drupal and Civi seem to be at times both good at delivering rapid web applications, then at other times provide quite an obstruction to writing bespoke functionality.
I...
Thursday, 24 March, 2011 - 13:59 - Drupal
For a web site I'm developing using Drupal 6, I want to produce a nice area of tabbed content. I spotted a nice plug-in called Quick Tabs (http://drupal.org/project/quicktabs) and wanted to get it to look nice on my page. I got quite complex to lay it up like I wanted, with the plethorer of views, blocks, css, mini panels, pages, etc, available to me, all adding to my confusion; eventually I worked it out. So here's what I did:
What we're aiming for
Here's the finished result:
That lovely looking set of tabs is made up of two views set in two...
