This module integrates into the Help module (using the hook_help() hook) to add help messages based on the URL. There is an administration form that allows users to set the messages and where they appear on the site. Multiple help messages can be added to the same page at once, the administration form can be ordered to sort the order that these messages appear.

There are a couple of similar modules on Drupal.org but they are appear to work in different ways and are all dead projects and have never received a full release. This module integrates directly with the Drupal help API and is designed to be as simple as possible, whilst still having a good feature set.

Project Page:
http://drupal.org/sandbox/philipnorton42/1193750

Comments

mikebell_’s picture

Hi,

Just a couple of notes:
- Use 2 spaces instead of 4 spaces per "tab" as per the drupal coding standards.
- Considering changing the tab name in the admin area to something short e.g. List. This also follows similar conventions that other drupal modules use. Same with add.
- Line 14 in hook_help.module looks unfinished
- Rather than defining your own submit button you can use "return system_settings_form($form);" instead.

Nice inclusion of a test file, my test setup is currently broken but will get it up and running soon. If you drop by #drupal-uk there are a few people who are willing to review as well.

philipnorton42’s picture

Thanks digital, I'll take a look at those notes and probably submit a new version.

Thanks for your time :)

joachim’s picture

Status: Needs review » Needs work

Setting to needs work as per comments above. Please move back to needs review when you're ready for a reviewer to look at this.

philipnorton42’s picture

Status: Needs work » Needs review

Right, I have gone through and made the changes you suggested. Apart from the use of system_settings_form(). I just wasn't sure if it was the correct way to use this function here.

I have also added the ability to assign help messages to certain roles and added unit tests to test this functionality out.

klausi’s picture

Status: Needs review » Needs work

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:

  • Run coder to check your style, some issues were found (please check the Drupal coding standards):
    Severity minor, Drupal Commenting Standards, Internationalization, Drupal Security Checks, Drupal SQL Standards, Drupal Coding Standards
    
    sites/all/modules/pareview_temp/test_candidate/hook_help.module:
     +9: [minor] Comment should be read "Implements hook_foo()."
     +30: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +76: [minor] Comment should be read "Implements hook_foo()."
     +86: [minor] Comment should be read "Implements hook_foo()."
     +90: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +91: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +98: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +99: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +106: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +113: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +114: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +121: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +122: [normal] Menu item titles and descriptions should NOT be enclosed within t().
     +133: [minor] Comment should be read "Implements hook_foo()."
     +267: [minor] Comment should be read "Implements hook_foo()."
     +292: [normal] The $message argument to drupal_set_message() should be enclosed within t() so that it is translatable.
     +358: [minor] Comment should be read "Implements hook_foo()."
     +382: [normal] use stdClass caseCapitalization, it's the one exception to the mixed case style standard
     +391: [normal] else statements should begin on a new line
     +454: [normal] use stdClass caseCapitalization, it's the one exception to the mixed case style standard
     +488: [normal] use stdClass caseCapitalization, it's the one exception to the mixed case style standard
     +494: [normal] else statements should begin on a new line
     +534: [minor] Comment should be read "Implements hook_foo()."
    
    sites/all/modules/pareview_temp/test_candidate/hook_help.install:
     +3: [minor] Commits to the Git repository do not require the CVS $Id$ keyword in each file.
     +11: [minor] Comment should be read "Implements hook_foo()."
     +18: [minor] Comment should be read "Implements hook_foo()."
    
    Status Messages:
     Coder found 1 projects, 3 files, 16 normal warnings, 10 minor warnings, 0 warnings were flagged to be ignored
    
  • Lines in README.txt should not exceed 80 characters, see the guidelines for in-project documentation.
  • Bad line endings were found, always use unix style terminators. See http://drupal.org/coding-standards#indenting
    ./help.html:                                              ASCII English text, with very long lines, with CRLF line terminators
    
  • Remove all old CVS $Id tags, they are not needed anymore.
    hook_help.install:3:// $Id$
    

This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.

philipnorton42’s picture

Status: Needs work » Needs review

Neat. I didn't know Drupal.org had an automated coder review script, and it appeared that I was doing things a little wrong! :)

Anyway, I brushed up on git and figured out how to swap branches and things. I then passed everything through Coder to make sure everything passes to the strictest standards.

All test still pass as well so I haven't broken anything in making these changes.

klausi’s picture

Status: Needs review » Needs work

wrong branch name, 6.x-1.x-dev should be 6.x-1.x. And you should remove all contents from the master branch, step 5 in http://drupal.org/node/1127732

philipnorton42’s picture

Status: Needs work » Needs review

This issue has now been corrected.

klausi’s picture

Status: Needs review » Needs work

Review of the 6.x-1.x branch:

  • ./hook_help.module: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
        // Function is called twice, return false here on second call to prevent multi printing.
    
  • ./hook_help.test: The description for the @param/@return documentation is either missing or not formatted correctly. See http://drupal.org/node/1354#functions
    24-   *  The array of options
    
  • ./hook_help.install: The description for the @param/@return documentation is either missing or not formatted correctly. See http://drupal.org/node/1354#functions
    25- */
    
  • ./hook_help.module: The description for the @param/@return documentation is either missing or not formatted correctly. See http://drupal.org/node/1354#functions
    477- *  The path data element.
    479- *  The contents of the help item.
    482- *  The new hid of the inserted record.
    

This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.

manual review:

  • remove the 6.x-1.x-dev branch to avoid confusion (master cannot be removed)
  • hook_help_schema(): hook doc block missing
  • hook_help_schema(): do not run any DB descriptions through t(), this will only create overhead for translators
  • "$path_results = db_query("SELECT hh.hid, hh.path FROM {hook_help} hh INNER JOIN {hook_help_roles} hhr ON hh.hid = hhr.hid WHERE hhr.rid IN (0, " . implode(', ', array_keys($user->roles)) . ")");": do not use the SQL IN statement like this, see http://drupal.org/writing-secure-code or db_placeholders()
  • hook_help_admin_page(): you don't need that page callback if you just want to display a form. Use drupal_get_form() as callback in hook_menu() directly.
  • "filter_xss(l(t('edit'), 'admin/build/hook_help/edit/' ....": why do you need filter_xss() here? There is no user data involved and the l() functions sanitizes with check_plain() already.
  • "drupal_set_title(t('Edit help message for path "!path"', array('!path' => check_plain($hook_help['path']))));": you can use t() with the @ placeholder here, which will do a check_plain() automatically. See http://api.drupal.org/api/drupal/includes--common.inc/function/t/6
philipnorton42’s picture

Thanks for looking over this form me klausi, I really appreciate the time you have taken to review this. I have learnt a lot through this process (especially about using git properly).

Automated:
I think these are mostly to do with single instead of double spaces. I have corrected these issues and re-ran Coder to double check everything was ok.

Manual:
- I had removed the 6.x-1.x-dev branch locally, but hadn't pushed it. Sorted now.
- Added schema doc block..
- Removed the t() on db descriptions.
- Corrected this statement to use db_placeholders().
- Removed callback function and replaced with drupal_get_form.
- Overzealous filtering on my part. Removed the extra call to filter_xss().
- I had forgotten about the @ placeholder, thanks for the reminder :)

philipnorton42’s picture

Status: Needs work » Needs review
beanluc’s picture

Status: Needs review » Needs work

Regression since the above changes reveals new (or remaining) coding-style flaws:

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

beanluc’s picture

Besides that, may I suggest a different name for the module?

Because hook_help() is the name of a core hook, I believe that it would be very easy for there to be confusion. That name also does not really communicate what the module is for. Something like (just an idea) "Custom Help Text" is descriptive.

philipnorton42’s picture

Strange about the line endings not being correct. Rather than leave it to chance I think it would be prudent for me to run the PAReview.sh script myself before asking for review again.

You have a good point about the name; it's always best to avoid confusion wherever possible :) I'll play around with a few ideas (I quite like your one) and change it.

Am I right that in order to change it I would need to create another sandbox for a different module?

beanluc’s picture

No, thats not necessary. This sandbox's title can be changed, so can this issue's title. You woukd need to change the module's filenames and function names. If you're not familiar, the right way to rename files in git is to run "git mv oldfile newfile". If you just use mv, git is not aware and treats oldfile as deleted and newfile as without history.

misc’s picture

@philipnorton42 has been contacted to ask if the application is abandoned.

After ten weeks with a status of needs work: the applicant may be contacted by a reviewer to determine whether the application was indeed abandoned. The action taken by the reviewer should be documented in the project application issue.

http://drupal.org/node/894256

misc’s picture

@philipnorton42 writes back that the application is not abandoned.

philipnorton42’s picture

Title: Hook Help » Custom Help Text
Status: Needs work » Needs review

Finally got around to changing the name of the project. After some deliberation I went for "Custom Help Text" instead of "Hook Help". As a precaution I have run everything through SimpleTest and coder to check that I haven't changed the functionality at all.

tyler.frankenstein’s picture

Status: Needs review » Needs work

I have downloaded and installed the 6.x-1.x version on my localhost D6 site. The module works well and is very useful. I was able to easily add help messages to the top of various forms and nodes.

One strange thing that I noticed here for example (admin/build/custom_help_text/edit/2), I am unable to get the 'user role' checkboxes to stay checked. I tried turning on/off the 'view custom_help_text' perm to see if that would get the checkboxes to stick, but that didn't work either.

Basically, I was unable to get the 'user roles' checkboxes to do anything. This would be a nice feature, so you could limit the visibility of the help text to certain roles.

Also, the text 'Leave empty to add to all user roles ('view custom_help_text' permission will prevent certain users from seeing it).' near the checkboxes mentioned above is confusing to me. It seems vague/contradictory... this could use some clarification.

Other than that, nice job on this module. The only thing I would recommend is adding another field to allow the user to specify a drupal message box class (status, warning, error) along with each custom help text. That way when the custom help text is displayed it can 'stand out' a bit more, and user's won't have to write any css to spice up the custom help box. But perhaps this could be added later as a new feature once the project is up and running officially.

philipnorton42’s picture

Status: Needs work » Needs review

Hi Tyler,
Thanks for taking the time to look at this module.

I did a complete rethink on the way that user roles are assigned and saved and I think this mechanism makes more sense. Essentially, when creating a help message you need to assign user roles that the help message will be displayed to. The permission 'view custom_help_text' controls access to the help messages on a permission level, so I have taken this into account and only load in the roles that have this permission.

Good idea about the custom class I'll have a think about that :)

tyler.frankenstein’s picture

Status: Needs review » Needs work

Hi Philip,

I gave your module another try with a fresh Drupal 6.24 install. Again I used it to add some custom help text messages to places like the contact page, the user login and registration pages, as well as the node add story page. The custom text appeared for all cases. I then tried flipping on/off the new user role mechanism you setup (much better by the way) and visiting each page as an anonymous/authenticated user to make sure it worked as expected, it did.

In my opinion this module is good to go, except there are some coding standard issues that should be cleaned up:

http://ventral.org/pareview/httpgitdrupalorgsandboxphilipnorton421193750git

philipnorton42’s picture

Status: Needs work » Needs review

I have sorted all of the issues and re-run the PAReview.sh report via the ventral.org site.

http://ventral.org/pareview/httpgitdrupalorgsandboxphilipnorton421193750git

beanluc’s picture

Status: Fixed » Reviewed & tested by the community

Nicely done. RTBC for me. I'll use a module like this regularly - currently I just write a module on a per-project basis with explicit, specific custom helptext messages in it as aids for my clients and their content-authors and site-admins. A re-useable generic solution is brilliant.

This is great in its current state. I will share one detail which has recently been pointed out to me. That's that any strings in the module which go through t() would be best wrapped in double quotes rather than in single quotes with escape-slashes behind any single quotes in the string. That's because the code and string are easier to read but more importantly the presence of escaping-slashes can introduce reliability problems if those strings ever are translated.

Suggestions for improving this module:
Obviously, porting to D7.
Making help-texts and mapped paths exportable.
Providing token support in the messages or the paths.
Providing for drupal_set_messages as well as help text (you can do this with things like Rules and Context, but, what overkill just to set status message and mode).
Providing for contextual links on the messages, for admin tasks.

Just suggestions! It just goes to show that your module has lots of potential because it's such a good idea.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Would you like to take part in the review bonus program? I personally only review/approve applications with a review bonus, but of course you can also wait for other git administrators to take a look at your code.

mlncn’s picture

Status: Reviewed & tested by the community » Fixed

Congratulations philipnorton42 on a long review process and learning a lot about Git and d.o idiosyncracies too! You are now a vetted Git user and can promote this and other projects you create to full project.

Status: Reviewed & tested by the community » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.