How to programmatically publish/unpublished node using flag link and without using Rules?
Any module may react to a piece of content being flagged by implementing hook_flag(). Here is the relevant do so:

mymodule_flag($action, $flag, $content_id, $account) {
  if ($action == 'flag') { // Or $action == 'unflag'.
    // Do something in response to the flagging.
  }

  if ($flag-&gt;name == 'yourflagname') {
    //Your custom code to unpublish/publish the content goes here.
  }

}


Source: "Responding to a flagging", located within the Flag's community documentation.