Hello, I'm having a hard time getting the is_flagged function to work within a contemplate "Body" template. Here is the code I am currently using (I have tried it with and without the $node-nid variable):

<?php
	$flag = flag_get_flag('sold');
	if ($flag->is_flagged($node-nid)):
?>
<li class="sold">Sold</li>
<?php else: ?>
<li class="price"><?php print $node->field_asking_price[0]['view'] ?></li>
<?php endif; ?>

I'm getting this error message:

warning: Missing argument 1 for flag_flag::is_flagged(), called in C:\wamp\www\*****\sites\all\modules\contemplate\contemplate.module(765) : eval()'d code on line 10 and defined in C:\wamp\www\*****\sites\all\modules\flag\flag.inc on line 397.

Am I not doing this correctly, or are these two modules not compatible with this function?

Thanks

Comments

sirkitree’s picture

Category: bug » support

$node-nid is not a valid variable. try $node->nid.

XBleed’s picture

Status: Active » Closed (fixed)

Wow.. I feel really embarrassed. I could have sworn that I was using $node->nid.. I just gave it a go again and it seems to work now. I must have completely entered that wrong. My apologies.