Showing posts with label drupal. Show all posts
Showing posts with label drupal. Show all posts

Thursday, October 30, 2014

Find Drupal Installs on Your Server

Need to find Drupal installs on your 'Nix webserver? Run this on your docroot:

sudo find . \( ! -path '*/sites/*' ! -path '*/profiles/*' ! -path '*/themes/*' ! -path '*/modules/*' \) -iname 'CHANGELOG.txt' | xargs grep -m 1 'Drupal' -s1

Output will look something like this:

./cms/core/d7/drupal-7.32/CHANGELOG.txt-
./cms/core/d7/drupal-7.32/CHANGELOG.txt:Drupal 7.32, 2014-10-15
./cms/core/d7/drupal-7.32/CHANGELOG.txt-----------------------
--
./cms/core/d8/drupal-8.0.0-beta2/core/CHANGELOG.txt:Drupal 8.0, xxxx-xx-xx (development version)
./cms/core/d8/drupal-8.0.0-beta2/core/CHANGELOG.txt-----------------------
--
./cms/core/d6/drupal-6.33/CHANGELOG.txt-
./cms/core/d6/drupal-6.33/CHANGELOG.txt:Drupal 6.33, 2014-08-06
./cms/core/d6/drupal-6.33/CHANGELOG.txt-----------------------

Monday, November 25, 2013

Drupal Block Title vs. Subject

I couldn't find a post about the use of a "title" versus a "subject" in a custom block when building a module in Drupal 6. Running across this funny quirk in code and figured I'd share.

I have a module that defines a custom (navigation) block and was trying to change the title. I found that when I tried editing the title through the admin UI (

admin > build > blocks > custom block name
) nothing changed. That is the default title of the block as defined in the module was still there.

Here's how the block was defined in code:
// start navigation_block() function super_events_navigation_block($op = 'list', $delta = 0, $edit = array()) { ... $blocks = array(); switch($op){ case 'list': $block[0] = array( 'info' => t('Events Archive Navigation'), 'region' => 'right', 'status' => 1, 'weight' => 0, 'cache' => BLOCK_NO_CACHE, ); return $block; case 'view': switch($delta) { case '0': $block['title'] = t('Event Archives'); $block['content'] = theme('super_events_navigation_events'); break; } return $block; } } // end navigation_block()

Note the following line:
$block['title'] = t('Event Archives');

Apparently this works for displaying a title for a custom block, however it cannot be modified. Change this line so instead of "title" as the key you have "subject" as follows:
$block['subject'] = t('Event Archives');

Now the block's (display) title is changeable through the admin user interface.

Sunday, March 04, 2012

Drupal 7 + OpenID: First Attempt

So it worked, but with caveats. Here's what worked:
  • associating exiting account with Google profile for OpenID (e.g. https://profiles.google.com/profilename)
  • logging into existing account using Google profile OpenID
  • OpenID Selector module for logging into existing account
Here are the caveat:
New logins using OpenID did not create new account. My attempts to login were met with the message:
Complete the registration by filling out the form below.
Unfortunately, for said form...and for me, no form below to be found. I am using a custom theme, to which I've added a custom (very simple) maintenance page template. So at this point, I'm trying to figure out what variables and custom functions I need to add to get the registration working. No luck yet (and marginal incentive as there's other more pressing stuff to finish), but here are some links I'll be checking out when I have a moment:

Thursday, March 01, 2012

Drupal 7 Notice: undefined index node workflow_tokens()

Was getting the following messages on my Drupal 7 site:
Notice: Trying to get property of non-object in workflow_tokens() (line 189 of /var/www/drupal/sites7/all/modules/contrib/workflow/workflow.module).

Notice: Undefined index: node in workflow_tokens() (line 188 of /var/www/drupal/sites7/all/modules/contrib/workflow/workflow.module).
First I tried updating the workflow status for all the content I'd created for the site (about 12 nodes of sample content) to publish. Still saw the error, then remembered that earlier, I was getting notices from the Page Title module:
Notice: Trying to get property of non-object in views_page_title_pattern_alter() (line 47 of /var/www/drupal/sites7/all/modules/contrib/page_title/modules/views.page_title.inc).
I redefined the default for the page title settings to use the content page title token rather than the node title. Then defined the titles (using the node title token) for the custom nodes I'd defined on my site. This seemed to resolve the workflow_tokens notices.
Lookinig at the code it seems like the node argument required for the workflow_tokens function was not properly defined by the time lines 188 and 189 were reached in the processing. Not sure why this was occurring or how the Page Title module was impacting the function so if anyone can shed some light on that it could be helpful down the line.

Friday, September 16, 2011

Drupal Coding Lifeline

dpm(get_defined_vars());

That little bit of PHP is an absolute lifeline for module and theme coding in Drupal. If you need to know what variables are available in a given context, that's what to use. Works in .tpl.php files and in .module or .inc files, especially where hook_theme may be in use. print_r and var_dump are of course reliable standbys, but time and time again, dpm() has rescued me from hours of very painful head banging against desk.


Far better explanations and listings of Drupal debugging tools and their usage are both here

- http://www.thingy-ma-jig.co.uk/blog/02-10-2007/hugely-useful-hugely-undocumented

and here

- http://blog.anselmbradford.com/2009/03/14/2-invaluable-drupal-development-tips-list-all-available-variables-and-backtrace-a-page/