Wondering if there is a way to disable unflag for a certain node type?

Thinking of using CSS to hide the unflag link, but people who turn off CSS in browser can still hit the unflag link.

Any suggestion?

Thanks in advanced.

Comments

joachim’s picture

Status: Active » Fixed

Implement hook_flag_access() in your custom code.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

steveoliver’s picture

Version: 7.x-2.0-beta6 » 7.x-3.x-dev
Status: Closed (fixed) » Active

Hate to open old issues, but we'll see if this is valid.

I considered retitling this to "How to disable flag links for a certain /piece of/ content", since per-type flagging on/off is already supported and works as designed.

I've successfully implemented hook_flag_access in my custom module; The flag links and checkboxes are hidden from regular node view.

However, using the "Flag link" field in Views, the access does not seem to be honored.

I may be missing something, or maybe this is a known/unknown issue we need to resolve.

Will check in again tomorrow.

joachim’s picture

Version: 7.x-3.x-dev » 7.x-2.0-beta6
Status: Active » Closed (fixed)

> However, using the "Flag link" field in Views, the access does not seem to be honored.

If that's the case, please open a new bug report for that.

joachim’s picture

> However, using the "Flag link" field in Views, the access does not seem to be honored.

I've figured this out. For views, hook_flag_access_multiple() is invoked, and not hook_flag_access(). This could be better documented; I'll file an issue for that.