Hi guys :)
I've browsed through the issues and Googled as best I can, apologies if this is a duplicate/known issue, but I have not been able to find it.
In my case, all users (anon and logged in) can flag nodes, then those nodes are later printed in a view (bookmarking, essentially), but for some reason, only logged in users can view the results of the view.
Anon users can see the view (there is Header content in the view, which can be seen by anon users), just not the actual results. When clicking the flag link, anon users are getting the appropriate messages for adding and removing a flag.
From what I can see, permissions are appropriate for views and for flags.
If anyone could shed some light, I would be most grateful :)
Cheers,
Josh
Comments
Comment #1
jfarry commentedAlso, if i set the output of the view to display "x" text when results are empty, "x" does not display, so the view does not appear to be empty.
Comment #2
mooffie commented(1a) Does this happen for logged in users as well? In othe words: if a logged in user has bookmarked nothing, does he see the "x"?
(1b) Suppose an anonymous user has bookmarked *nothing*, does he see the "x"?
==
(2) Perhaps it's a caching issue. Add "?whatever" to the end of the URL, when you're anonymous on the view page, to ensure that you get a fresh page. Is the view still empty?
(3) Use the Devel module and tell us the SQL query the view generates.
(4) It's a non-global flag, right?
Comment #3
jfarry commentedHi mooffie and thank you for such a quick reply :)
(1a) I've just checked then on both authenticated users and if there are no flags, they do not see "x" either.
(1b) No. If anon user doesn't bookmark anything, they don't see x either. I guess in hindsight that was a bad test :P
==
(2) Unfortunately it's not a caching issue. I've added a url argument like you said, as well as dumped my cache and the problem remains.
(3) When in the view itself (as in, editing it), the query output is as follows:
This is an export of the view itself:
From devel, the closet thing I could find to what I think you're chasing is this:
This is what is generated for authenticated users:
This is what is generated for anonymous users:
(4) Yes. It's a non-global flag :)
Comment #4
mooffie commentedThanks for the additional details.
(Very strange. Something is fishy with your "x". Do you see an "x" (if you define it) in empty views that have nothing to do with Flag?)
The SQL looks fine.
(5) I see that you're using a node access module. Could you please temporary disable it and see if it solves the problem?
(It seems unlikely, because if your Nodeaccess module prohibits anonymous users from viewing these nodes, then anons won't have a chance to see the "Flag this!" link in the first place. But it's worth doing this check.)
(6) Finally: Do you know how to execute SQL queries? In phpMyAdmin, for example? Alternatively, do you have some software that shows you the contents of a DB table?
Comment #5
mooffie commented(One more thing: For the time being, please disable the page cache, if you have it enabled. (Administer › Site configuration › Performance.) It's probably irrelevant to your problem, but it won't hurt to eliminate this factor nevertheless.)
Comment #6
jfarry commentedI feel I may not have been clear with the "x". All the "x" is, is when a field is empty, output "x." In this case it's "EMPTY FIELD".
I have altered another (non-flag) view and yes, both authenticated and anonymous users see "x" when the field is empty. In this case they see "Business Type: OUTPUT OF FIELD IS EMPTY"
(5) I just disabled Nodeaccess then, dumped the cache, removed, then re-added flags again on both authenticate and anon roles and the outcome is the same. Anon still cannot see the result of the view.
(6) Yes, SQL is no problems. I've got phpMyAdmin and Heidi, so you can take your pick :P
The page cache is currently disabled. The only thing that is enabled is page compression, but I have tried disabling that also, no dice :(
Thank you again :)
Comment #7
mooffie commentedI'm not sure what you're trying to do.
(7) Can you show us your exported view? The one you posted previously was mangled for some reason. Perhaps it will be easier to put it on pastebin.com and provide a link.
====
The following SQL returns all the nodes flagged by a certain anonymous user:
(It's a shortened version of the SQL you posted earlier.)
(8) If you execute this query, do you see any rows returned?
Note the number "32" there. It identifies the anonymous user that was active when you did your tests. It's called a "session ID" (or "sid" in short).
(9) If you see no rows (which seemingly means that anonymous #32 flagged nothing), examine the flag_content DB table (e.g., by executing "select * from flag_content;"): Do you see any rows whose "sid" column is "32"? If that table has few rows (or even many rows), feel free to paste it on pastebin (or here) so we can see it.
Comment #8
jfarry commented(7) The exported view is here: http://pastebin.com/Jk1b4bCN
====
(8) No results are returned for UID of 32 :(
(9) There aren't many rows, as the site is still in testing, but no, there are no 32's in there. The pastebin to the sql (for importing) is here: http://pastebin.com/djGkhsm3 and the textual representation of the data is here: http://pastebin.com/FZuwkH5Y :)
Comment #9
mooffie commentedI want you to make Drupal print some diagnostic messages:
(10) In your theme folder you'll find a "page.tpl.php" file. Please add the following to it:
This will print some useful information for anonymous users (e.g., "Hello ... you've bookmarked 3 nodes"). Don't yet tell us what it prints.
Next, edit your view:
(11) Into the Empty text setting type "No flagged nodes were found."
(12) Into the Header setting type:
Choose to "Display even if view has no result". For the "Input format" pick "PHP code" (if you don't have it in the list then you first have to enable the "PHP filter" module).
Now:
Log out. As an anonymous, flag some nodes. Refresh the page.
(13) What does the message we added to page.tpl.php say? (e.g., "Hello ... you've bookmarked 3 nodes") Please paste it here.
(14) Navigate to a page that shows your view. What does its message say? (e.g., "Hi. ... Your SID is ...") Please paste it here. Also paste the other message (the page.tpl.php message) showed on that same page ("Hello ... you've bookmarked 3 nodes"").
(Don't log in yet before doing the following step.)
(15) Put the contents of your flag_content DB table on pastebin and provide the link. (the "textual representation" is enough.)
Comment #10
jfarry commented(13) As an anonymous user:
On the home page: Hello, anonymous! It's 08:24:37 now. Your SID is 52 and you've bookmarked 0 nodes.
On the first page that is flagged: Hello, anonymous! It's 08:24:56 now. Your SID is 53 and you've bookmarked 0 nodes.
On the second page that is flagged: Hello, anonymous! It's 08:25:01 now. Your SID is 54 and you've bookmarked 0 nodes.
(14) The view output: Hi. It's 08:27:19 now. Your SID is 59.
On the view page, the page.tpl (i got the url wrong a few times, that's why it jumps from 54 to 59): Hello, anonymous! It's 08:27:19 now. Your SID is 59 and you've bookmarked 0 nodes.
Also on the view page, it says: "No flagged nodes were found."
(15)The textual representation of the table is here: http://pastebin.com/90DNx1bj
Again mooffie, thank you so much for your help :)
Comment #11
mooffie commentedMmm...
Is seems we've found the problem. The SID should remain fixed. If I understand correctly, in your case it's bumped on every page.
Please confirm my understanding: refresh the page a couple of times (don't bother to flag nodes in between) and tell me if the SID keeps bumping.
The problem is likely in the Session API module.
- What version of it are you using?
- Upgrade to its latest version and check things again.
- Can you check things with a different browser? Perhaps the fault is in some cookie-settings in your browser (seems unlikely, but won't hurt to check).
Comment #12
jfarry commentedHi Mooffie,
Yes, the SID is being bumped on every page. This is not browser specific either, it's happening in Chrome 8, IE 8 and Firefox 3.6.
I was using Session API 6x 1.3, but I have just updated to 6x 1x dev and am having the same problem.
Would you like me to duplicate the problem in their issue queue?
Comment #13
mooffie commented(So this issue has nothing to do with Views.)
Comment #14
mooffie commentedYes, please do so. Thanks. Make the subject "The SID is being bumped on every page" and explain that you put a snippet in page.tpl.php that shows this. (Don't copy our lenthy discussion from here: it's an irrelevant "noise".)
We'll continue the discussion at that new issue.
Comment #15
jfarry commentedDone :) http://drupal.org/node/1005766
Comment #16
mooffie commentedI'm marking this a dup of #1005766: The SID is being bumped on every page.
(Remember: you'll have to upgrade to the "dev" version of Flag if you want to use page caching. It fixes several related bugs.)