The latest update has caused the following errors on two of my sites and I had to upload previous version to correct for now.

Notice: Undefined variable: nid in _exclude_node_title() (line 273 of /home/public_html/sites/all/modules/exclude_node_title/exclude_node_title.module)

CommentFileSizeAuthor
#3 2512804-undefined-variable-1.patch655 bytesfizk

Comments

drupal-son’s picture

Same error after updating to 7.x-1.8.

Drupal8’s picture

same here!

fizk’s picture

Status: Active » Needs review
StatusFileSize
new655 bytes

Here's a patch, please let me know if it works for you.

  • fizk committed 0b771cd on 7.x-1.x
    Issue #2512804 by fizk: Undefined variable
    
Phil.Levy’s picture

I see the same. Just ran the update.

Definitely a bug since $nid isn't defined in the function at all

$nid_list = array($nid => $nid);

fizk’s picture

Status: Needs review » Fixed

I'm going to assume the patch works. This is fixed in dev, and will be available in 7.x-1.9.

kbrinner’s picture

Patch worked for me - no more errors and exclude node title works again.

fizk’s picture

7.x-1.9 has been released.

@kbrinner Thanks for testing.

Phil.Levy’s picture

Patch worked for me also. No obvious problems.
Thanks!

Alan Oliveira’s picture

Patch worked for me too. But eventually i had to use // instead of - and + on the patch code

// $nid_list = array($nid => $nid);
$nid_list = array($node_info['nid'] => $node_info['nid']);

fizk’s picture

@Alan Oliveira, the - means remove the line, and + means add the line. You apply patches using patch -i name-of-patch-file.patch -p1 on the command line.

Alan Oliveira’s picture

this is linux right? im using Windows Server 2012 R2, so i had to manually edit the file

modiphier’s picture

Alan, when you manually patch a file I review each line of the patch and I locate the function listed in the patch by the line number listed although sometimes the line numbers vary a bit and then where you see the - that is a line in the current LIVE file that you remove and then the + lines are the line to replace what you removed.

this is the same whether on a linux or windows server..

so for example

@@ -270,7 +270,7 @@ function _exclude_node_title($param, $view_mode = 'full') {
 
       // we look for the nid list
       $nid_exclude_list = variable_get('exclude_node_title_nid_list', array());
-      $nid_list = array($nid => $nid);
+      $nid_list = array($node_info['nid'] => $node_info['nid']);
 

search the live file for this line
function _exclude_node_title($param, $view_mode = 'full'

then remove this line
- $nid_list = array($nid => $nid);

- means remove
then replace the line or lines with

+ $nid_list = array($node_info['nid'] => $node_info['nid']);

you must also remove the + from the beginning of the line.

Hope this helps.

Status: Fixed » Closed (fixed)

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