I am displaying Flag links via Views. By default the Flag module provides settings to control whether the Flag link appears eg. only appear on own content, only appear on others content etc.
The dilemma is that when displaying the Flag links via Views this no longer has any effect, and the Flag link will always display in the View. I have two Flags; one for owners of content and another for non-owners of the content. Depending on whether the user viewing the content owns the content or not I would like to display one Flag link or the other. This will allow owners for example to "delete" their own content, while non-owners to only hide content which is not theirs. If Views fields respected permissions this would be straight forward, but they don't seam to at least in my experience. How can this be done?
Take global php field in view and write below logic in.
print flag_create_link('flag_machine_name', $nid); // flag for author
print flag_create_link('flag_machine_name', $nid);//flag for other users.
Hope this will help.
NOTE : replace flag_machine_name with your specific flag's machine name which you want to display.