University of Oregon

Drupal – modify the forum listing

We’ve decided not to display the commenter’s name on our forum comments. Initially I tried to accomplish this with css:


But that only takes care of hiding from view when reviewing comments. It also doesn’t remove it from the source and it shows up in the comment lists and rss feed as well.
So while I’m still using this on the forum post directly more drastic measures were needed to take care of the forum comment list pages…

Drupal dhtml_menu accommodate non-javascript viewers

I wanted to find a solution for using dhtml menus while accommodating non-javascript viewers.
Turns out it was an easy fix.

The menu currently uses drupal’s: drupal_add_css to append the css document which collapses all the menu items by default. Since the menu module relies on jQuery, I changed the append method to use jQuery instead.
Here’s my suggested fix: (more…)

Conditional menu behavior in Drupal

I added some code to the page.tpl.php to change the behavior of the elearning page on ODT for logged in vs anonymous viewers.

    $(document).ready(function() {
uid) {?>
				$('.expanded').each( function(){Drupal.dhtmlMenu.toggleMenu($(this));}); //Close all
				Drupal.dhtmlMenu.toggleMenu($('#skillport-login')); //Open login button section

				$('.collapsed').each( function(){Drupal.dhtmlMenu.toggleMenu($(this));}); //Open all



Drupal: Expand / collapse all dhtml menu items

Like dhtml menus in Drupal? Then you’ll love this.
Two jquery functions that expand or collapse all dhtml menu items in Drupal in link/bookmarklet format:

javascript:$('.collapsed').each( function(){Drupal.dhtmlMenu.toggleMenu($(this));});void("Open all");
javascript:$('.expanded').each( function(){Drupal.dhtmlMenu.toggleMenu($(this));});void("Close all");

Drag this to your bookmark tool bar and enjoy menu control like never before:
Expand all menus
Collapse all menus

Inserting a custom menu group into a drupal suckerfish menu

We have a huge anchored document with and equally huge TOC. There’s also a traditional drupal menu on that page.
My goal was to get the inline menu into the drupal menu.

Div swapping didn’t work ie: div1.innerHTML = div2.innerHTML. The menu showed up but the open / close functionality was lost.

So moving the node was the key.

		$(document).ready(function() {
			document.getElementById('dhtml_menu-254').parentNode.className='first dhtml-menu collapsed start-collapsed';

		//create function, it expects 2 values.
		function insertAfter(newElement,targetElement) {
			//target is what you want it to go after. Look for this elements parent.
			var parent = targetElement.parentNode;
			//if the parents lastchild is the targetElement...
			if(parent.lastchild == targetElement) {
				//add the newElement after the target element.
			} else {
				// else the target has siblings, insert the new element between the target and it's next sibling.
				parent.insertBefore(newElement, targetElement.nextSibling);

dhtml-menu functionality w/o the menu module

So why would you want to take advantage of dhtml-menu functionality w/o using the built in Drupal menu module?
In this case we want to use the nested menus style for the content while employing consistent show-hide functionality. Here’s the catch: The content isn’t a list of links it’s paragraphs where each section heading collapses and expands the sub-content. (more…)

Step-by-step: Add dhtml menu items in Drupal

We use the dhtml menu module in Drupal and luckily Nargas walked me through the step-by-step for adding menu items. (more…)