Whenever I add a comment on a node type that does not have a separate Talk page enabled (such as a Forum topic), it redirects me to the /talk page anyway, which results in an Access denied error.

Comments

jarodms’s picture

Assigned: Unassigned » jarodms

verified

jarodms’s picture

Status: Active » Needs review

Fixed in beta 3.

jarodms’s picture

Version: 7.x-1.0-beta2 » 7.x-1.0-beta3
Status: Needs review » Needs work

The "add a comment" piece appears to be working.

However, when a user clicks on "1 comment", still getting access denied.
Link generated: "http://sitename/node/2/talk#comments"

aze2010’s picture

subscribing for drupal 6, too (latest release!)

cborromeo’s picture

I was seeing the same issue. Drupal 7.10 using Talk 7.x-1.0-beta3. I modified the talk_form_alter code and this appears to fix the problem. The code needs to check if the content type has talk enabled before changing the submit button to talk_comment_hijack.

function talk_form_alter(&$form, $form_state, $form_id) {
  // Add option to comment options of node types.
  if ($form_id == 'node_type_form' && isset($form['#node_type'])) {
    $form['comment']['comment_talk'] = array(
      '#type' => 'checkbox',
      '#title' => t('Display comments on separate talk page'),
      '#prefix' => '<strong>'. t('Talk pages:') .'</strong>',
      '#weight' => 5,
      '#default_value' => talk_activated($form['#node_type']->type),
    );
  }
//MODIFIED THE IF STATEMENT TO CHECK IF talk_activated IS TRUE
  if (isset($form['#node']->type) && $form['#form_id'] == 'comment_node_' . $form['#node']->type . '_form'
    && talk_activated($form['#node']->type)) {
    $form['#submit'][] = 'talk_comment_hijack';
  }
}
jarodms’s picture

Could you send me your patch file? this looks like the same code that is in beta3 with the talk_activated placed at the end of the IF instead of the middle.
Thanks!

jarodms’s picture

Priority: Major » Normal
jarodms’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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