Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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;
}
Comment | File | Size | Author |
---|---|---|---|
#4 | fix-undefined-index-1508988-4.patch | 606 bytes | teroelonen |
Comments
Comment #1
jhr CreditAttribution: jhr commentedDrupal loves you, but Drupal love patches even more ;)
http://drupal.org/node/707484
Comment #2
jasonsavino CreditAttribution: jasonsavino commentedThe 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"
Comment #3
kraigory CreditAttribution: kraigory commentedI 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.
Comment #4
teroelonen CreditAttribution: teroelonen commentedApparently the previous patch has disappeared somewhere. Here is the same patch again =) If you add this patch to repository, credit quiptime.