The help text that should display at node/add/project_project is not showing up. Relevant lines in project_module's project_help() function:

    case 'node/add/project_project':
      if (module_exist('taxonomy')) {
        $tree = taxonomy_get_tree(_project_get_vid());
        // Extract the different project types, and, for the first type, up to three categories.
        foreach ($tree as $index => $term) {
          if ($term->depth == 0) {
            $types[] = $term->name;
          }
          elseif (($term->depth == 1) && ($index == 1) && (count($categories)< 3)) {
            $categories[] = $term->name;
          }
        }
        if (count($categories)) {
          $help = t('<p>Properly categorizing your project will help ensure that users can find it easily.  Please follow these steps:</p>
          <ul>
            <li>Select <em>one</em> of the first-level terms (%types) as the project type.</li>
            <li>Then choose <em>one or more</em> categories below this term to classify your project.  For example, for %type, you would choose from the various %type types: %categories, and so on.</li>
          </ul>', array('%types' => implode (', ', $types), '%type' => $types[0], '%categories' => implode (', ', $categories)));
        }
      }
      $help .= variable_get('project_help_node_add', '');
      return $help;

Was there a recent change that would have affected display of help messages on this page?

Comments

webchick’s picture

StatusFileSize
new942 bytes

Hm. This seems to be a logic problem:

elseif (($term->depth == 1) && ($index == 1) && (count($categories)< 3)) {

$index refers to the array index of the taxonomy term tree. When I setup categories like Drupal.org has them on my test site, I ended up with:

0 => Drupal Project
1 => Modules
2 => Third-Party

Because index 1 referred to a top-level term, this logic did not fire, thus $categories was never populated, thus the help text did not display.

Here is a patch that fixes it (and gets rid of a notice), but I'm not sure if it's the right way to go about it.

webchick’s picture

Status: Active » Needs review
webchick’s picture

Status: Needs review » Needs work

Ok I see why it's doing this now. This patch doesn't work as intended because then the message reads:

* Select one of the first-level terms (Drupal Project, Modules) as the project type.
* Then choose one or more categories below this term to classify your project. For example, for Drupal Project, you would choose from the various Drupal Project types: Third-Party, and so on.

Still futzing...

webchick’s picture

Status: Needs work » Needs review
StatusFileSize
new1.68 KB

Ok, let's try this. This could probably stand to be optimized a bit more, but it should at least work, which is an improvement. ;)

webchick’s picture

StatusFileSize
new1.74 KB

Ok, this version is better, I think. It adds a check for if (count($types) == 1) so that it will only fire for the first type's categories. Before, if there were only 2 sub-terms for the first term, it would continue to hit this logic for every single sub-term thereafter because count($categories) < 3.

webchick’s picture

... was not greater-than or equal-to 3. ;P

drewish’s picture

i couldn't really figure out how to test this... or it wasn't working with 5...

dww’s picture

Version: x.y.z » 5.x-1.x-dev
Assigned: Unassigned » dww
StatusFileSize
new2.78 KB

It was still broken, due to bad assumptions about how the taxonomy is structured. New patch fixes those bugs, and also cleans up some of the wonky t() troubles that were trying to be fixed at http://drupal.org/node/155727.

I'm not 100% sure we still need this help text, given the changes in the UI which make this much more self-documenting. But, I guess it doesn't hurt that much. ;) And, either it should work, or it should be removed entirely, not left hidden due to logic bugs.

webchick’s picture

I think remove the text. It's been gone so long that probably no one remembers it was ever there, and the UI has become MUCH better since then so that this is pretty self-explanatory now.

dww’s picture

Status: Needs review » Fixed

Great. In that case, I just ripped out that entire case from the switch() statement on HEAD, DRUPAL-4-7--2 and DRUPAL-4-7. Thanks for the feedback!.

Anonymous’s picture

Status: Fixed » Closed (fixed)