0

I need to hide flag link if the logged in user and the author are same. Please find below codes.

function MODULE-NAME_views_pre_view(&$view, &$display_id, &$args)
{
    global $user;
    if ($view->name == 'VIEW-NAME' && $display_id == 'DISPLAY-ID') {
        $node = node_load(arg(1));
        if($node->uid == $user->uid){
            //echo 'hide flag';
        }else{
            //echo 'show flag'; 
        }
    }
}
4
  • 1
    Are you using Flag module? can you please add details. Sep 17, 2014 at 10:10
  • 1
    Yes I am using flag module and displaying flag links using view. I need to show link only to other users other than author.
    – Aswini K
    Sep 17, 2014 at 10:19
  • @akm your last comment should be an edit. Also, if you already tried something, examined some configuration forms etc - please share.
    – Mołot
    Sep 17, 2014 at 10:27
  • @akm I guess what you are trying to achieve can be done through the permission of the flags. However, As stated by the Molot please share your finding. Sep 17, 2014 at 11:00

1 Answer 1

2

If it is a flag on nodes, you just need to set "Users may only flag content of others" in the Flag access by content authorship paragraph of the FLAG ACCESS options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.