In testing the AF module, the New Topic links are relative instead of absolute (to Drupal) causing 404s (Page Not Found)
New Topic link website/forum/node/add/forum/6
should be website/node/add/forum/6
Setup
Drupal 6.19
Advanced Forum 6.x-2.x-dev 2010-Nov-17
Author Pane 6.x-2.0
CCK 6.x-2.x-dev
CTools 6.x-1.8
Pathauto 6.x-1.5
Token 6.x-1.15
Views 6.x-2.11
I'm digging through the code of the Advanced Forum module and I noticed that some functions have been moved between the 6.x-2.0-alpha3 and 6.x-2.x-dev 2010-Nov-17 versions of AF.
In core-overrides.inc (alpha3), the function advanced_forum_get_forum_post_links($tid) existed and in core-overrides.inc (dev) the function doesn't exist and I haven't been able to find it in any of the other AF files.
Portion of the function advanced_forum_get_forum_post_links in advance_forum/includes/core-overrides.inc 6.x-2.0-alpha3
...
// Push the link with title and url to the array.
$forum_types[$type] = array(
'title' => t('New @node_type', array('@node_type' => $node_type)) . '<span class="image-replace"></span>',
'href' => 'node/add/'. str_replace('_', '-', $type) .'/'. $tid,
'html' => TRUE);
...
New theme function theme_advanced_forum_node_type_create_list in 6.x-2.x-dev 2010-Nov-17
$type_list = advanced_forum_node_type_create_list($forum_id);
if (is_array($type_list)) {
foreach ($type_list as $type => $item) {
$output .= '<div class="forum-add-node forum-add-' . $type . '">';
$output .= t('<a href="!href" class="af-button-large"><span>New @node_type</span>', array('!href' => $item['href'], '@node_type' => $item['name']));
$output .= '</div>';
}
} else
...
The function advanced_forum_node_type_create_list is also new and is defined in advance_forum.module
...
// Loop through all node types for forum vocabulary.
foreach ($vocabulary->nodes as $type) {
// Check if the current user has the 'create' permission for this node type.
if (advanced_forum_node_type_allowed($type)) {
// Fetch the "General" name of the content type.
$node_type = node_get_types('name', $type);
// Remove the word "Forum" out of "Forum topic" to shorten it.
// @TODO: this is a little dodgy and may not work right with
// translations. Should be replaced if there's a better way.
$node_type = str_replace('Forum', '', $node_type);
// Push the link with title and url to the array.
$forum_types[$type] = array(
'name' => $node_type,
'href' => 'node/add/'. str_replace('_', '-', $type) .'/'. $tid,
);
}
}
...
Before I go any further, will anyone confirm that this issue is a bug?
Comments
Comment #1
MichelleYeah, it is. #935322: Remove and replace primary and secondary links
Now really isn't a good time to test the dev. I'm in the middle of some major and messy changes that are being committed incrementally. I normally try not to commit broken code but I'm doing so many things that are all interconnected and I don't want to wait until everything is done and risk messing up and losing it all.
Michelle
Comment #2
Michsk CreditAttribution: Michsk commentedThere is still a bug in the new formtopic link. It now is
node/add/forum/#
. And that is good unless your site is in a subfolder, as my test enviroment is. So i guess we should be usingl('node/add/forum/#');
.Comment #3
pumpkinkid CreditAttribution: pumpkinkid commentedFYI, this may not be how Michelle plans on fixing this, but for now I added a slash on line 21 of the includes/theme.inc file.
$output .= t('<a href="!href" class="af-button-large"><span>New @node_type</span>', array('!href' => $item['href'], '@node_type' => $item['name']));
becomes
$output .= t('<a href="/!href" class="af-button-large"><span>New @node_type</span>', array('!href' => $item['href'], '@node_type' => $item['name']));
Comment #4
MichelleThat code isn't even there anymore in my copy. I don't know wtf I was thinking sticking an href in code like that. Anyway, it's all being replaced by the new custom advanced_forum_l().
Michelle
Comment #5
pumpkinkid CreditAttribution: pumpkinkid commentedLOL!
Like I said, not how you intended to fix it, but it was why I was having the problem... for now I'll wait until you call for testers as everything else seems to be working well enough :-)
Comment #6
MichelleYeah, I know people are chomping at the bit. But I'm making some pretty big changes and I don't want to waste peoples' time testing stuff that is getting moved around. Even the stuff I commit isn't really done. I'm just committing periodically because I don't have any version control set up and I don't want to risk losing several days of work by leaving too much uncommitted.
Michelle
Comment #7
AnybodySee #1506628: New [Content Type Name] Button not Localized