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

mooffie - September 1, 2008 - 14:00
Status:active» fixed

excuse me if this has been brought up before

Always speak your mind. This module certainly has flaws.

[...] but the view seems to be the hard part.

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

txcrew - September 1, 2008 - 18:33

Great! Thanks so much for the prompt fix!

#3

Prodigy - September 4, 2008 - 03:50

Yes Sir! I was just about to do a work-around in hook links to do this. Glad I found this!

#4

Anonymous (not verified) - September 18, 2008 - 03:52
Status:fixed» closed

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

#5

Prodigy - September 30, 2008 - 22:12
Status:closed» postponed (maintainer needs more info)

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

dropchew - October 21, 2008 - 09:22

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

mooffie - October 22, 2008 - 11:16

@dropchew,

I have followed the steps for views 1 and renaming the 'bookmarks' part to my flag name in the function but [...]

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

dropchew - October 22, 2008 - 12:12

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

mooffie - October 22, 2008 - 13:21

there's no 'login to flag' on node or teaser

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

dropchew - October 22, 2008 - 14:08

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

najibx - August 24, 2009 - 02:38
Component:Code» Flag core

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

AttachmentSize
flag_login.zip 1 KB

#12

quicksketch - September 28, 2009 - 21:27
Version:5.x-1.0-beta3» 6.x-2.x-dev
Status:postponed (maintainer needs more info)» postponed

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 users

Unfortunately 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.

 
 

Drupal is a registered trademark of Dries Buytaert.