On admin/structure/forum after creating a container and a forum, the Edit links take you to forum/id (i.e. the page where you can start adding discussions) rather than an edit page (which would let you edit the name/description of the forum).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Ah.

The problem is in function forum_overview() in module/forum/forum.admin.inc.

It is asking taxonomy to build the edit page, and then attempting to modify the editing links, so:

      $form[$key]['view']['#markup'] = l($term['name'], 'forum/' . $term['tid']);
      if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
        $form[$key]['edit']['#markup'] = l(t('edit container'), 'admin/structure/forum/edit/container/' . $term['tid']);
      }
      else {
        $form[$key]['edit']['#markup'] = l(t('edit forum'), 'admin/structure/forum/edit/forum/' . $term['tid']);
      }

However, if you look at $form, you find that both the 'view' and 'edit' components that are being modified have #type='link':

Note: this is print_r output...
           [view] => Array
                (
                    [#type] => link
                    [#title] => (name of my forum container)
                    [#href] => taxonomy/term/1
                )

Then in http://api.drupal.org/api/function/drupal_pre_render_link/7 when this element is pre-processed, the #markup property added by our forum_overview function is being overwritten by the pre-processing step, so it goes back to what the Taxonomy module set up. So the forum module either needs to override the title/href propoerties, or set the type to markup, for this to work as intended.

Now it just needs a patch. :)

jhodgdon’s picture

Status: Active » Needs review
FileSize
1.29 KB

This patch will probably do the trick... I'll make sure in a sec and make a screen shot, meanwhile letting the testing bot loose on it.

jhodgdon’s picture

FileSize
1.29 KB

This one works better.

Dries’s picture

Priority: Critical » Normal
Status: Needs review » Needs work
Issue tags: +Needs tests

Confirmed that this patch fixes the bug. Committed to CVS HEAD. I'm marking this 'needs work' because we should have tests for this.

jhodgdon’s picture

Tests, what a good idea! So that if the structure of the taxonomy list changes again, the forum links won't break without us knowing about it? What a concept! :)

Sorry, must be punchy this morning.... I am seriously in love with the testing framework though, and I think getting that into D7 and setting up the test bot was the single greatest achievement for D7. Even better than Fields in Core, though that's a close second.

indytechcook’s picture

Status: Needs work » Needs review
FileSize
910 bytes

Here is a patch with a test.

jrbeeman’s picture

FileSize
1.33 KB

I've re-rolled the patch with:
- a different order of operations (last one was checking the container link after the container was deleted);
- added assertion messages;
- Reset the nav back to /admin/structure/forum

Test passes locally, but needs review.

baronmunchowsen’s picture

Hi. I have reviewed the patch in #7. Test passes and looks good.

baronmunchowsen’s picture

Status: Needs review » Reviewed & tested by the community

changing status

paulmckibben’s picture

Status: Reviewed & tested by the community » Needs work

The above patch verifies that the links exist, and that they go *somewhere* (200 result code). However, they do not verify that the links actually go to the respective edit pages.

On lines 143 and 149, instead of assertResponse() (which only verifies the response code), I suggest that you use assertRaw() or assertPattern(), and verify the content returned by the clicked link. Perhaps look for the titles "Edit container" and "Edit forum" respectively.

indytechcook’s picture

Status: Needs work » Needs review
FileSize
1.34 KB

@pmckibben. Agreed. I thought I did that in the patch. Looks like I took it out for some reason. This version has it.

paulmckibben’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, indytechcook! Thanks!

jrbeeman’s picture

Latest patch with test case was applied to a clean CVS checkout and verified to pass.

Thanks, @pmckibben - I was worried about that as well and wasn't sure the best way to check.
@indytechcook, nice work!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Looks good. Code comments need to end with a point, so I added those and committed your patch to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

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

bobcallahan’s picture

I have tried to find the link structure so I can make the links in main menu "blank" "nofollow" so I can keep the consumer on the main content page. I have tried a couple of different things, but it breaks the site. Need to know where I can structure the site to blank meta tags.