Hi there...

I needed a way to extract the node id for a node a user created.... The users are only allowed 1 creation of the node type, limit made with nodelimit, I needed to create a custom token so I could use it in a menu token to make a "edit node" menu
My custom PHP for the token looks like this

global $user;  
$result = db_query('SELECT nid FROM {node} WHERE uid = :uid AND type = :type', array(':uid' => $user->uid, ':type' => 'nodetype'))->fetchField();
return $result;

And it wors like a charm, Got my menu now, but occasionalily I get this error

Warning: extract() [function.extract]: First argument should be an array i eval() (linje 2 af D:\Apache2.2\htdocs\booking\modules\php\php.module(80) : eval()'d code)

Anyone who could finetune my code s this does not happen?

Comments

gaspaio’s picture

I released a 2.0-beta1 version that should correct this.

acoustika’s picture

Component: Miscellaneous » Code
Category: support » bug
Status: Active » Needs review

Thx alot....

I downloaded the latest dev from 7 May and will let you know how it behaves :-)

acoustika’s picture

Okay.... This seems to work properly now, thx alot...... Did the commit instead, the change wasn't refelcted yet in the version I downloade.... Thumbs up

gaspaio’s picture

Status: Needs review » Closed (fixed)