Hi
As I installed 6.x2.0 beta 4 (idem for dev. one) and Session API, I can see now the 'bookmark this' link on nodes.
But when I go to 'My bookmarks' the list is empty. I've got a message saying that I haven't bookmarked any content.
It's said in Views to create a special one for anonymous users.
1) how ? I dont know how to add this condition
2) If I would succeed, how to display only one menu entry 'My bookmarks' for everybody, logged or not.
If someone could help...
thx
Comments
Comment #1
mooffie commentedFirst, do you have page caching turned on for anonymous users? (beta4 has known bugs with this, which are already fixed in "dev".) If so, please turn it off.
Go to some node page. (As an anonymous user.)
You see a "Bookmark this" link. Click it. The link has changed to "Unbookmark this", right?
Now refresh the page. Has the link stayed as "Unbookmark this"? Or has it reverted to "Bookmark this"?
You don't need to. (You already have a special page for the view. Whatever, this is irrelevant for our discussion.)
Please don't speak in codes.
Comment #2
mooffie commented(I'd appreciate your reply. This will tell us if you fell victim to this Session API bug.)
Comment #3
artatum commentedThanx to be there! (and Happy New Year)
But I dont see where I can set page caching 'for anonymous user'.
Generally I go to 'performance' for cache, but there is nothing specific for anonymous user !?
Should I go somewhere else in the admin ?
Anyway I disabled everything in performance for caching and cpage compression and i still have this bug :
I can see Bookmark this; if i click it changes to unmark this; but if I F5, it turns back to Bookmark this.
Yet, I can see in Phpmyadmin that this node has been marked in the table.
Strange isnt it?
Comment #4
mooffie commentedYes, it's the "Performance" page.
Just set "Caching mode" to "Disabled".
(The text there explains that it's for anonymous users. Use your browser's "find" command to see this, it you aren't convinced. This page was revamped in Drupal 7 to make this (and other things) clearer.)
Good.
Thanks for the report.
I have one little thing I want you to try.
Please add the following to your 'page.tpl.php' (it's in your theme's folder):
This is a short diagnostic message. (The time it prints is just to make sure your page cache is turned off.)
Please tell us what it says (you'll have to be anonymous). Then refresh the page a couple of times and tell us if the "SID" number keeps changing. It shouldn't change. If it keeps changing then it means that there's a critical bug in the Session API module, which we ought to know about.
(The SID is printed twice: "Your SID is" and "In other words ...", please make sure these two numbers are the same.)
Comment #5
artatum commentedHi mooffie
I have one little thing I want you to try.
Everything you want : you're like a Mother for me.
I did what you said and my SID is each time different:
Hello, anonymous! It's 11:14:00 now. Your SID is 71 In other words, your SID is 71
Hello, anonymous! It's 11:14:00 now. Your SID is 72 In other words, your SID is 72
Hello, anonymous! It's 11:14:00 now. Your SID is 73 In other words, your SID is 73
etc.
So I think there is a bug in Session API and in the near future of my life... Sob...
PS (due to my location, France, our discussion is quite slow, but very useful for me! Thx again.)
Best wishes.
Comment #6
mooffie commentedGood. The more people encounter this bug, the better: it makes it easier to fix it.
The Session API module is tiny. Let's try something with it:
In its folder you'll find the file "session_api.module". Open it in an editor. You'll find two setcookie() calls that look like this:
Please change these two lines to:
In other words, delete the last ", $cookie_domain". Save the file and see if this solves the problem. If it doesn't, there are more things to try (let me know which browser you're using).
Comment #7
mooffie commentedHey, how is it that the time is always the same? 11:14:00.
Does the time in France go *that* slow?
Comment #8
artatum commentedHey, IMHO you're the boss Mooffie : it WOOOOOOOOOOOORKS.
Great and quick job. And specially useful for everybody it seems.
THX
Another question : is it a debugger for Drupal : I'm an old VB6_ist, and I could go line by line, and see variables and objects.
I've bought 'Pro Drupal Developments' but I really dont copy.
How did you learn ? Is it a framework ?
Does the time in France go *that* slow?
lol.!! ... Yes : time is very slow here : that is good for Weekends, but when you're at works it sucks....
(it's due to copy/paste/mess! :)
Comment #9
mooffie commentedGreat. But wait, we need to investigate this a big more to tell the Session API maintainer what's the problem.
Please put the following in your page.tpl.php and tell us what it says:
==
I don't think a debugger like this is in itself useful (I used one for a short period of time). Why? Because it's more important to be familiar with the overall picture (and then you use "print" or "dsm" in strategic places). If you don't have this familiarity, you don't know what to look for. Or how to interpret the variables.
Each person has its own learning style.
When I use a book it's usually (depends on the book) in the later stages of the study process. I use it as a kind of summary. That's because book authors nowadays are extremely careful not to "frighten" the user. So they make up stories. Instead of quoting five simple lines of code from Drupal they stretch some prose over twelve pages, foolishly believing we enjoy reading it as much as they enjoyed writing it. Instead of giving the three lines of code that show how Form API does redirection they tell a metaphorical story about buying a present for their wife. Or telling you how yesterday they ordered food from Guadalajara for their parrot. You end up not fully understanding the subject. That's exasperating (and therefore: the book is harmful). Not to mention that it bloats the books (who has the energy to read through 800 pages?!)
When I started with Drupal it was at 4.7 and small. So reading its source code was a very natural choice. Today too I recommend this.
Comment #10
mooffie commented(BTW: later, if you want to turn page caching on, you'll have to upgrade to the "dev" version of Flag: it fixes a few related bugs (but none is related to the problem we're discussing now).)
Comment #11
artatum commentedfor our affair it says:
Your cookie_domain is [.localhost]. Its type is string. Your HTTP_HOST is [localhost]
And for learning Drupal, could you tell me how to display objects content and structure? (I dont see this 'dsm' token in my php handbook...)
Comment #12
mooffie commentedLaurent, thanks for the feedback.
I posted a patch for the Session API module. You may want to "subscribe" there.
Well, in the beginning we were printing objects (or arrays) in this manner:
Then came the Devel module, which provides some utility functions. After installing it you can use dsm() instead of that print statement. It comes with a widget that lets you browse large objects more conveniently: http://drupal.org/files/issues/full_var_1.jpg . Devel also adds tabs to nodes (and some other objects) so you can examine them quickly. It has some more utilities.
(Try googling "debugging drupal".)
Comment #13
mooffie commentedI'm marking this a dup of #1005766: The SID is being bumped on every page..
Comment #14
artatum commentedI'm afraid things go bad :
I've tried everything on my current site, but mysteriously nothing works any more :
no 'bookmarks this' any more, no more 'my bookmarks' menu when not logged.
with the new session api module.
I've began again as we did, by putting the 2 php lines in page.tpl :
worse, our previous solution (remove $cookie_domain) doesn't do the trick anymore.
(This site is my N°7 and I was editing with you N°5. They are basically build on the same modules : when I'm stable, I export mysql and copy folders to go on without crashing what already works... But I added in N°7 six new languages, including chinese and japanese)
But everything still works once logged.
I'm puzzled.
Comment #15
mooffie commentedPerhaps you've installed Flag 1.x? You need Flag 2.x for anon flagging.
Edit the "Bookmarks" flag. Do you have "anonymous users" turned on in the allowed roles? If this option isn't there at all, it's Flag 1.x.
(Another sign: Flag 1.x doesn't have "export". Do you have this command on the admin page?)
Comment #16
mooffie commentedAre you still using beta4? If so, please upgrade to "dev". We'll then continue the discussion.
Comment #17
artatum commentedYes I've done a lot of messing! Was using flag 1.3. Sorry
I've coming back to beta4 but I've still an issue : 'my bookmarks' doesnt appear anymore in 'navigation' when not logged.
Re-puzzled.
Stay tuned
Comment #18
artatum commentedI've go back to N°6 without i18n and all languages, put
Flag 6.x-2.x-dev
Session API 6.x-1.x-dev.
At each reinstall I remove-uninstall both.
Everything is ok except that 'My bookmarks' doesnt appear in Navigation for anon. I can see other links in it.
I've checked in Views. See nothing.
Dont copy
Comment #19
artatum commentedComment #20
mooffie commentedEach view has access settings. Edit this view: make sure you gave anonymous users permission to access this view. If they don't have access to it, they won't see it in their menu.
Comment #21
artatum commentedThat was this! I was beginning to desperate because all these chinese and japanese translations would have been lost!
Thx again and again...:)