Closed (fixed)
Project:
Flag
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Sep 2008 at 16:48 UTC
Updated:
21 Sep 2008 at 16:32 UTC
I made a flag for users but don't know how to proceed. There is no View been created and I use tpl files for user pages and all node types so am not seeing any links on user pages. When I go to create a new view, there are no fields/arguments based on the new flag, only on the existing "bookmarks" flag I created before.
any tips about the next step?
Comments
Comment #1
mooffie commentedThis is a major documentation flaw.
I've just created a handbook page explaining this:
Limitations of the Drupal 5 version.
Indeed, being able to flag users in the Drupal 5 version is not very useful.
I'm not yet closing this issue: I'll right away put an explanation in the UI of the module itself.
(It's possible to use some custom code to generate a list of flagged users, but I don't think it's worth the bother.)
Comment #2
mooffie commentedBTW, this is a different issue, which you'd have encountered even if you used Drupal 6. In these cases you can display the link manually, as explained in Placing a flag link on a page.
Comment #3
esllou commentedon the tpl issue, no problem, I'm used to it...I just need to know the URL structure for flagging users. I already do it on all node types using Flag module. (and other tools such as print module, forward module, etc)
I just have this in all my node templates for the standard node bookmarking:
but then your first answer makes me think that because of the views 1.x limitations, the fact you can flag users even in D5 can't be exploited, correct? So, technically, I can flag users but I can't get lists of flagged users showing because Views 1.x (i.e. D5) can't list out anything except nodes?
Comment #4
mooffie commentedI added explanation to the UI. The "Add flag" screen now contains a collapsed fieldset titled "Important note concerning the limitation of Views 1.x".
http://drupal.org/cvs?commit=137801
Comment #5
mooffie commentedOops. I haven't noticed your new reply. I'll soon answer.
Comment #6
mooffie commentedYou shouldn't. It's best to simply do:
You don't need to know the URL for bookmarking a node (or any other object).
The flag_create_link() also adds some Javascript magic to the page.
Sort of.
For most admins, the ability to flag users, in D5, indeed can't be exploited, because there isn't a very easy way to list flagged users.
But if you know some SQL you can generate the list of flagged users yourself.
HOWEVER,
Drupal 5 admins usually use modules such as Bio or NodeProfile. So they can still flag and list "users": you flag, and list, their "profile" nodes instead. I should add this to the documentation.
Comment #7
mooffie commentedI added this info to both the handbook and the UI.
http://drupal.org/cvs?commit=137823
Comment #8
esllou commentedOK, I understand that. Could I have a "bookmark user" link on user/2 page which bookmarks profile/2 (using nodeprofile module)?
my standard user pages are: user/[uid]
my profile pages are: profile/[uid] (even though they may actually be node/654)
the way my site is set up, it makes more sense for me to have "Add/Bookmark User" link on my user pages, not on the profile pages themselves. Is that doable?
Comment #9
esllou commentedBTW, I do the constructed-URL method because I don't want text links, I have a whole set of custom-made icons for forwarding, printing, bookmarking, reporting, etc so I just need to build the URLs, not the anchor text, etc.
Comment #10
excell commentedThanks for listing this information. I have just spent ages trying to figure out what I was doing wrong with Flag & 5x & Views!
Giving up on trying to flag comments!
Comment #11
esllou commentedI had a bit of a play around this morning.
I would like to put a link saying "Add User" on the user/x pages but actually bookmarking that user's nodeprofile. I have the flag and the view all set up and they're working great when I hardcode something like
into the template but I don't know how to do it dynamically. User 6 has a nodeprofile of /node/328 as in the above example. Is there a way of finding out the nid of a user's nodeprofile where user/6 has their nodeprofile at the url profile/6 (but node/328). Otherwise, I'll have to add the code on the nodeprofile page itself which I don't really want to do.
Comment #12
mooffie commentedYes, that's the only challenge.
Put the following in your template:
Let me know if it works. The rest is easy.
However, you need to change two things in the code:
1. I assumed the "machine name" of the node's content-type is "bio". Change it to whatever name you use for it.
2. I assumed the user ID can be reached by doing `$account->uid`. If you don't have a variable `$account` in your template, change that line to read `$uid = arg(1);`
===
Note that you should arrange for every user to have a profile node. (If you have several node types serving as profile nodes, you should pick the one you consider the primary.) Modules such as 'bio' and 'usernode' can enforce the creation of such node, but, IIRC, Node Profile doesn't have this feature. So you should either put that node form on the user registration page (so it gets created), or install usernode. There might be other options; It's been a long time since I touched these modules, so the information I give here may not be accurate.
Comment #13
esllou commentedI've actually got usernode installed as Nodeprofile depends on it, so I put "usernode" instead of "bio" but I get an error:
and line 64 is:
Comment #14
mooffie commentedOops. The line before is missing a semicolon.
Chnage:
to:
Comment #15
mooffie commentedAnd if you get "Can't find the node of user number" ---note the user number is missing-- it means that the variable $account doesn't exist in your template. In that case, change:
to:
(Here we assume the user ID is the second argument in the URL.)
Comment #16
esllou commentedOK, works fine. For each user, I'm getting the nid of their usernode.
Now, I presume after the next step, it will be those usernodes that are going to get flagged, right? At the moment, I don't actually use those usernodes for anything and they are pretty much empty pages with just links to the user's userpage, profile and blog. I suppose, if users are going to start flagging them, I can jazz them up a little.
Comment #17
mooffie commentedYes.
You can leave them empty. Their only purpose is to get listed by Views.
Let's suppose you named your flag "friends". You now have a "My friends" menu item and if you click it you'll see all users you've flagged. What you're seeing is the titles of these 'usernode' nodes.
=======
The next step it to print the flag/unflag link.
The easiest solution is to simply add the following (after the existing code):
(Make sure this works.)
Now, you want to change the appearance of the link. There are two ways to do this:
1. You can theme the link to show however you like.
2. But if you want to go the "old" way of doing things, you can do:
Comment #18
esllou commentedthat all seems to be working pretty smoothly. One other question. I've made a view at friends/$arg and used the argument "Flags 'Friends' for UID". As it is a list of users that a member has flagged, I think there may be privacy issues with some members not being happy at all other users being able to see their friends list.
so is it possible to create the same view at /friends and for it:
a) to be invisible to logged out users (this seems pretty simple), basic visibility setting of the View.
b) show friends only of currently logged in user (rather as Buddylist does at the URL /buddylisting from memory). In other words, no need for args. If John goes to /friends, he sees his friends, if Lily goes to /friends, she sees hers only.
I don't see any filter that is similar to "flagged nodes of currently logged in user" which I think I would need.
Comment #19
esllou commentedok, I found the correct filter. If I have any other questions, I'll be sure to ask, but it looks pretty much 100% up and working now.
Comment #20
esllou commentedactually, I do have one question. Is there a way of using views to list out all content created by the users I've managed to flag using this method?
so --> other content created by the author whose usernodes are flagged by this user.
is that doable?
Comment #21
mooffie commentedIt's easily doable in Views 2.
As for Views 1: it might be doable, but it's not very trivial. You'll have to use NodeFusion/NodeFamily. If you're using 'bio' it might be easier: that module duplicates, in the Views interface, all the fields/filters so you can operate on the usernode.
Comment #22
esllou commentedthat's a shame. Is there a way of getting a "tracker/[uid]" link into the view somehow or altering the target link so the current /user/2 goes to /tracker/2.
building this list of flagged members would lose a lot of its usefulness if I can't have users see that member's content without having to use a couple of other clicks. As things are now, using the usernode listing through views, I have a list of the usernode authors...ie. the users. To view their content, users would have to click on the user name, and then on another link to see what content had been created.
Comment #23
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.