Complete error message:

Undefined index: href in mobile_jquery_links__node() (line 328 of ...foo .../themes/mobile_jquery/includes/modules/theme.inc)

The error occurs only for anonymous visitors

Fix it:

function mobile_jquery_links__node($vars) {
  $links = $vars['links'];
  $output = '<div data-role="controlgroup" data-type="horizontal">';
 
  foreach($links as $link => $value) {
    if(!isset($links[$link]['attributes'])) {
      $links[$link]['attributes'] = array();
    }
    if($link != 'comment_forbidden') {
      $links[$link]['attributes']['data-role'] = 'button';
      $links[$link]['attributes']['data-icon'] = $link;
    }
    // Fix it:
    if ($link == 'comment_forbidden') {
      $links['comment_forbidden']['href'] = '/user/login';
    }
 
    $output .= l($links[$link]['title'], $links[$link]['href'], array('attributes' => $links[$link]['attributes'], 'html' => TRUE));
  }
 
  $output .= '</div>';
 
  return $output;
}
CommentFileSizeAuthor
#4 fix-undefined-index-1508988-4.patch606 bytesteroelonen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhr’s picture

Drupal loves you, but Drupal love patches even more ;)
http://drupal.org/node/707484

jasonsavino’s picture

Status: Active » Closed (cannot reproduce)

The comment module handles trapping that issue. When the user is not logged in then the following is added: "Log in or register to post comments"

kraigory’s picture

Version: 7.x-1.x-dev » 7.x-2.0-beta1
Status: Closed (cannot reproduce) » Active

I have this same exact issue, except it happens for admin users (logged in) as well, and the error message says line 335 instead of 328. The fix listed worked for me, although I don't completely understand it. Here is a patch.

teroelonen’s picture

Issue summary: View changes
FileSize
606 bytes

Apparently the previous patch has disappeared somewhere. Here is the same patch again =) If you add this patch to repository, credit quiptime.