I'd like to execute hook_comment() only when a comment action is being performed on let's say 'image' node type. How do I retrieve node type when executing hook_comment() ?

I have something like:

function mymodule_comment($a1, $op) {

	if ($op == 'insert' OR $op == 'delete') {
		$var = 'display_album_';
		cache_clear_all($var, 'cache', TRUE);
	}
}

So I dont need this to be executed when commenting on any node type... just 'image' node type.

Thanks,

k.

Comments

BruceyB’s picture

i think the comment stores the node id.

<?php
function mymodule_comment($a1, $op) {
    if ($op == 'insert' OR $op == 'delete') {
        $node=node_load($a1->nid);
        if( $node->type=='image){
            $var = 'display_album_';
            cache_clear_all($var, 'cache', TRUE);
        }
    }
}
?>

batbug2’s picture

subscribing