I want to avoid that users can vote for their own posts, as it happens on Stack Exchange sites. For this, I created the following rule:
ON event "User votes on a node", the condition is "execute PHP code" and the code is the following one:
global $user; return $node->uid != $user->uid;
Still, users can vote on their own posts. What should I do?
Using the following code, I get an error message given below.
global $user;
dpr($user);
dpr($node);
return $node->uid != $user->uid;
global $user
. You cannot use a function output in the declaration of a global variable.