To Extend the HelpEdit Functionality?

Things have been and still are quite 'shop-ish' these days, meaning long hours in the shop working on some exciting sites. Therefore, apologies if this post is a bit 'shop-ish'. The discussion starts where Eric and I are talking about HelpEdit not showing up on path aliased pages in Drupal, which sparks some ideas...

Ok, couple of things were happening here. I’m going to document it well since it covers a couple aspects of drupal, and I want to further develop this module – i’m gonna say it—- it is the most useful yet least developed module in Drupal…and will only get more-so useful as Drupal continues to hit the masses, and the masses have to deal w/ working w/ drupal.

Helpedit was not designed to deal w/ path aliases set by the user, as far as I could tell. Also, I forgot to get rid of some permissions I inserted into the helpedit module. I thought I got rid of all of them, but I did not – I left one around the part that loads the help message on the page – a simple if (user_access(‘admin’)) { dothis }.

First, the idea with adding the permissions was to limit who sees a help message. For example, I only wanted admins to see help messages. However, there are several pages where admins and other roles can access alike, even administrative pages like the edit user page, because each user can edit their own page (user/#/edit) where # is the user id. What we need to do in the short future is build in the ability to select what role
can view which help messages. Then, also the ability to display multiple help messages on a page, depending on the user’s role. Another idea is to have the ability for a help message you create to also create an associated block in admin/block, and appear there instead of at the top of the page where the help message is assigned. Taking this even further, a dynamic link could be used where instead of publishing the help message in a block or on the page, it publishes it in a book, and instead assigns a url to a help icon on the given page which will take the user directly to the help section in the book related to the page they are currently on. A module that does all of the above is ideal, as sometimes you want a help message on a page as a banner, sometimes you want it in a block, sometimes you want it in a book and out of the way and really only available as a Save Our Ship! link. The idea for this module is to help admins of a drupal site personalize
their help documentation for the site to offer on top of drupal help documentation.

Finally, moving back to talking about the fix I made in the module, I created a new variable in the module’s helpedit_help function called $path2 and assigned it like so:

$path2 = drupal_get_path_alias($_GET[‘q’]);

Then, I modified the db query to also look for exact and fuzzy matches using the admin or user-defined path alias like so:

db_query(’
SELECT body
FROM {help}
WHERE
(path_type = 0 AND ”%1$s” = path OR ”’.$path2.’” = path) OR
(path_type = 1 AND ”%1$s” LIKE path OR ”’.$path2.’” LIKE path)
’, $section);

Now, the module will look for matches to the path before the admin/user defined alias, as well as with the alias.

Comments