I have tried 7.x-2.0-beta6 and the 7.x-2.0-dev and in both of them anonymous users get the error "You are not allowed to flag, or unflag, this content.'

It works correctly for the admin user.

I have ticked all the permission boxes in the flag edit screen and carefully checked the other permissions on the page. It looks right to me. No errors are showing up in the Drupal logs and I'm not sure how else to check what's happening. I have session_api installed and have tried the most recent stable and dev versions of that too.

Is this a bug? Or is it possibly something I've missed during configuration?

Does anonymous flagging work in D7 for others?

I've attached a screenshot of my permissions page and I can PM a link to a test site if that will help.

CommentFileSizeAuthor
flag-permissions_1329873214104.png46.48 KBJmsCrk

Comments

JmsCrk’s picture

Can anyone help even by letting me know if they have Anonymous flagging working in D7??

JmsCrk’s picture

We managed to fix this problem by editing flag/flag.module

Replaced:

if (module_exists('session_api') && session_api_available() && $uid == 0) {

With:

if (module_exists('session_api') && $uid == 0) {

The problem actually seems to be session_api_available() in session_api.module which determines if cookies are enabled was returning FALSE

function session_api_available() {
   return !empty($_COOKIE);
}

To check if the cookies are enabled, the code should be something along these lines?

setcookie('mycookie', 'cookie value', time() + 3600);
// Page refresh
return (isset($_COOKIE['mycookie']) ? TRUE : FALSE;
coloryan’s picture

Thanks, the solution in #2 worked for me.

pol’s picture

joachim’s picture

Status: Active » Closed (duplicate)

Thanks for the info. I assume that makes this issue a duplicate of that one.

*sigh at people hacking modules*