Create message: "Login to [flagname] [nodetitle]"
txcrew - August 29, 2008 - 19:38
| Project: | Flag |
| Version: | 6.x-2.x-dev |
| Component: | Flag core |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed |
Description
Please excuse me if this has been brought up before or if this functionality already exists.
But I'm trying to display a message to an anon user looking at a view with flag ops that they must login in order to flag that node.
I can do it on the page without a problem using contemplate, but the view seems to be the hard part.
TIA,
txcrew

#1
Always speak your mind. This module certainly has flaws.
I've started a bookpage explaining this:
Having a "Please login to flag" link. (You should use the "views 1.x" instructions.)
Let me know whether it works for you.
#2
Great! Thanks so much for the prompt fix!
#3
Yes Sir! I was just about to do a work-around in hook links to do this. Glad I found this!
#4
Automatically closed -- issue fixed for two weeks with no activity.
#5
People who are using images as the bookmark text won't be able to benefit from this feature. So I thought of a better one.
What about displaying the image to all users and if the user has inadequate permissions redirecting to the login/register page , or displaying a message telling the user the must log in to to use this.
We could also do the same for the original problem in this post? What do you think?
#6
Hi, I have followed the steps for views 1 and renaming the 'bookmarks' part to my flag name in the function but its not showing when a user is not logged in, anyone having the same problem?
#7
@dropchew,
Let's suppose you take the code shown on that handbook page and paste it as-is into your template.php. Will it work for your *bookmarks* flag?
#8
Hi mofiffie
Nope, I tried using the default created 'bookmarks' flag and copy the code as it is into template.php but it doesn't work, same for the flag that I created myself..there's no 'login to flag' on node or teaser....its working fine after logging in....
#9
Ah. Is your view of a "teaser / full" type?
The views recipe in the handbook is good only for views that are styled as tables or fields. When the data is styled as "teaser / full", it's Drupal itself that prints the nodes (not Views), and in this case you need to use the instructions under "Instructions for node.tpl.php".
#10
Oh ic , but how do I do it in node.tpl.php? In your recipe its still stated as [TODO]? If it too much trouble I can wait until you release the docu : ) Thanks!
#11
base on http://drupal.org/node/302623 I just created the module.
Yes, it works fine. but not generic. how if I have new/edit the flag, I have to edit the module. my module is for flag "signup_clinics"
Furthermore, it does not follow the "Placing a flag link on a page".
Hope someone can come up with more generic modules and added features
#12
I'm considering a "You must login" option, which may be enabled if a user cannot flag unless logged in. Something just like:
[x] Show login to flag message for anonymous usersUnfortunately this would almost certainly require a text field to go with it, because the verb might change, i.e:
- You must Login or Register to flag content
- You must Login or Register to favorite content
So the textbox would probably look something like:
Login to flag message:[ You must <a href="@login">Login</a> or <a href="@register">Register</a> to flag content ]
Which we could then run through t() with @login/@register as hard-code URLs that are available.
Anyway I'm not super-keen on that approach because of the additional complexity it adds to the admin form. When such functionality could be added fairly easily in the theme layer or by a contrib module, I'm not sure it's worth the overhead.
Thanks najibx for sharing your code, that's probably the general approach I'd use also.