Flag module: Do not allow users to flag own content
This is a specific use-case so it may be better to approach this using the Flag API. Specifically, try hook_flag_access and add this to your custom module (or create one). This function takes the following parameters:

hook_flag_access($flag, $entity_id, $action, $account)


and what you are specifically interested in is the following:

$entity_id: The id of the entity in question.

$account: The user on whose behalf to test the flagging action.


The $entity_id will allow you to determine what user id created the entity and the account object will already contain the account of the current user so this function will block flag display if they are the same: 

function YOUR_MODULE_flag_access($flag, $entity_id, $action, $account) {

  //load data for the entity 
  $entity = entity_load($entity_type, array($entity_id));

  // if the account that created the entity is the same as the user attempting to flag it then block access
  if ($entity[$entity_id]-&gt;uid == $account-&gt;uid) {
    return false;
  }

}