Link from Views to User

Events happening in the community are now at Drupal community events on www.drupal.org.
liliplanet's picture

Hi Everyone,

I'm using Nodeprofile and Usernode, and all beautiful.

When I create tables in Views with the fields, and have tried :

link to node
node: view link
etc

it all links to the node url .... not the user/ url.

I've tried bio and advanced profile, all with the same results.

Please, how do I link from a table in Views (CCK content) to the user profile and not the node.

Would most appreciate any reply.

Lilian

Comments

Author

greg.harvey's picture

I think you need to include a link to the AUTHOR. Usernode is just that - a node - so viewing it views the userNODE. However, a link to the author should take you to the user account because this is exposed by the User module.

Note, there is some code that comes with Usernode which you can put in your template.php file - if you've done this then I'm not sure if this over-rides the author behaviour or not. Try it.

Thank you Greg so much for

liliplanet's picture

Thank you Greg so much for your reply.

The code for template.php works but it only works for 'users online' and not in views.

I've just tried Author which works fabulously!, the only problem i might have is when I create users directly, will it perhaps not credit me as Author? Also it would be great to be able to use a custom field ie Name, Company, etc.

I"m trying to make another plan, maybe this is possible...

Create a field as a link, say FirstName, but how can I have that link automatically refer to the user page. Is that perhaps an option? Then in Views will just add that field to appear in the table.

There are so many options there (in create link field), would it be something in 'default value' or in the 'php code'.

Look so forward to any reply and thank you.
LIlian

Usernode author always user

greg.harvey's picture

AFAIK, the developers of Usernode thought of that, and the system always makes the author of the usernode the actual user it is assigned to, not the creating user. So you should never be the author of someone else's usernode and the Author link should always work. No workaround required. :-)

Thank you Greg for your

liliplanet's picture

Thank you Greg for your quick reply. Yes, Author is the username.

I've now decided to use the Bio module as it forces just one registration.

Something is up though ... when I create a user, the system adds a bio AND a usernode as content (thus duplicates pointing to the user page and the other to the node).

As I have over 14 000 users to import it's going to be a pretty bloated system.

How do I get around this, do I have to have usernode installed .. presuming so.

Again thank you Greg.
Lilian

Hmmm

greg.harvey's picture

I am not familiar with the Bio module, but looking at the project I would suggest you look at Nodeprofile instead. Bio seems to be a very limited version of Nodeprofile and nowhere near as smart.

Nodeprofile depends on Subform_elements and Nodefamily (I think they're bundled with it these days) and is fully compatible with Usernode. With Nodeprofile you create your own content types to be profile elements (one could be called Bio and have any fields you like, using CCK). When managing your content types, you have to option to specify a content type is a nodeprofile type (it's a checkbox under Workflow). If you do this, Nodeprofile will automatically:

  • only allow users to have one each
  • expose a Nodeprofile tab while editing the Content Type

On this Nodeprofile tab you can choose if you want the content type to be a part of the registration process, which is pretty neat.

And crucially, if there is no data for a Nodeprofile node for a particular user, Nodeprofile will not create it! Instead it will (optionally) add a "Create your Bio content" link in the user's profile and/or Usernode.

99% of being good with Drupal is selecting the right modules. ;-)

Bio and nodeprofile

michelle's picture

" Bio seems to be a very limited version of Nodeprofile and nowhere near as smart."

That's not true. Bio is designed to be a simple module for having one bio node per user. It's designed to be lightweight. That doesn't make it "less smart". Nodeprofile is great if you need multi node, complex profiles. They serve different purposes. If she's worried about her system being bloated due to having both bio and usernode, using both nodeprofile and usernode is not going to solve that.

"99% of being good with Drupal is selecting the right modules"

Definitely.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

Thank you Greg and

liliplanet's picture

Thank you Greg and Michelle,

I have been struggling with usernode, nodeprofile, bio since October having tested all trying to find a solution to my database before I continue building.

My aim is that all my users (14 000 +) will be available in directories through searchable views and have just gone back to usernode.

Still this problem though, why is there a duplicate of the information as nodes, a basic profile (my content type) AND a usernode ... in my content?

Also, if the user 'edit account' it is a different node number to 'edit basic profile' (2 different nodes).

With usernodes as profiles, is that what I can expect or am I perhaps doing something wrong?

Just if I could solve this .. would be a massive step in the right direction.

Thank you so much! for your input.

Lilian

...

michelle's picture

You have duplicate information because you are using usernode and a profile solution. Usernode is an empty node meant to be used with views, not a profile.

This is what I reccomend given the aim you listed:

1) Install either bio or nodeprofile (not both). I think bio would be best for your needs, but it doesn't matter a lot as they are both capable modules.

2) Uninstall usernode.

3) If using bio, set it to have at least 1 field on the registration screen. If using nodeprofile, you have to put the entire node there. This will ensure you have a profile node for every user. (Warning: this won't back-fill existing users)

4) Create your views to use the profile node type. Because of step 3, this will hit all users without using usernode.

Pro: You only have 1 node per user, not 2 because of usernode. You can make your own views using that node no problem.
Con: Some contrib modules, like buddylist, have usernode specific code in them and you won't be able to do that view.

Does that help?

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

You are an angel, thank you

liliplanet's picture

You are an angel, thank you Michelle!

I will try that first thing in the morning, that is, install only Bio module. Also will follow your Advanced Profile with great interest.

All the best,
Lilian

Uh oh...

greg.harvey's picture

I beg to differ. It is true and you just said it. ;-)

If Bio is designed to be a simple module, then it IS a limited version of Nodeprofile. And if it creates a Bio node whether there is data or not, where Nodeprofile doesn't, then it IS less smart, by definition.

Potato, Tomato, or somesuch... ;-)

It seems Bio fulfills a very simple use case, but one which Nodeprofile also fulfills effortlessly, but unlike Bio, Nodeprofile will not restrict you in the future. I see no reason why anyone would restrict themselves by using Bio. That would be silly, no? Even if I had a client who said "no, I only want one node of bio info for each user" then I'd think "uh huh... you only want one node now...!" Point being, they change their minds later and you'll probably have to install Nodeprofile alongside Bio to meet the requirement and now you're maintaining two modules, when one is all you need.

Unless I'm missing some subtle additional thing that Bio does which Nodeprofile cannot do??

...

michelle's picture

"If Bio is designed to be a simple module, then it IS a limited version of Nodeprofile."

Bio isn't a version of nodeprofile, limited or not. It's a separate module built for a separate purpose. "Limited version" implies the same module with a reduced feature set.

"And if it creates a Bio node whether there is data or not, where Nodeprofile doesn't, then it IS less smart, by definition."

It doesn't. It creates the node in the same circumstances as nodeprofile.

"It seems Bio fulfills a very simple use case, but one which Nodeprofile also fulfills effortlessly"

No, actually, to get the same features as Bio requires a bunch of custom code. I know; I wrote it for my tutorial. I've been using nodeprofile since last May so I am well acquainted with the module.

"they change their minds later and you'll probably have to install Nodeprofile alongside Bio to meet the requirement and now you're maintaining two modules, when one is all you need."

No, in that case you would uninstall bio and install nodeprofile. There's no point in running both of them.

"Unless I'm missing some subtle additional thing that Bio does which Nodeprofile cannot do??"

It lets you make one node which replaces the user view tab, lets you edit the node from the user page, and lets you select which fields (if any) you want on the registration page. All of this is much more complicated with nodeprofile. If you want a simple 1 node per user profile, bio lets you do it much easier than nodeprofile. Both modules have their place and making bio out to be not as good as nodeprofile is misleading. Which to use depends on your needs.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

Not convinced

greg.harvey's picture

"It doesn't. It creates the node in the same circumstances as nodeprofile."

But Liliplanet raises this as a specific issue she's having - Bio is creating a node regardless of whether there is data or not for her. Is it a bug? It is not behaving the same way as Nodeprofile, if it's behaving as she describes. Odd.

Anyway, I come from the position that the Profile module is a bad apple. I'm not going to repeat what others have said. It's all here: http://drupal.org/node/160546

As such, I wouldn't recommend Bio to anyone because it is trying to integrate with a core module which is widely agreed to be rubbish. I appreciate Bio saves profile data as a node, which is great and, as you point out, means you could easily switch later if necessary.

But I don't care that Bio can do cool things with the Profile page, because I won't use it and I wouldn't recommend anyone else does either. So all those cool things Bio does mean nothing to me and I'm back with the more flexible Nodeprofile, combined with Usernode to provide an alternative profile page, and ditching the Profile module completely.

BTW:
"All of this is much more complicated with nodeprofile. If you want a simple 1 node per user profile, bio lets you do it much easier than nodeprofile."

This is just not true - it is so, so, so easy to do this with Nodeprofile:

  • Create a content type for your profile
  • Use CCK to create your fields
  • Check the Nodeprofile checkbox in the Workflow part of the content type form
  • Click the Nodeprofile tab to set options, such as if you want the profile to appear in the reg form

Done! It takes about 5 minutes. I really don't know what you think is so grossly complicated about Nodeprofile or the steps above.

Everyone else can make up their own minds. Everyone I know developing with Drupal here in London uses Nodeprofile. I still maintain Bio is not as good a solution as Nodeprofile, and you won't change my mind, I'm afraid. My conscience is clean that I'm not "misleading" anyone. ;-)

...

michelle's picture

"But Liliplanet raises this as a specific issue she's having - Bio is creating a node regardless of whether there is data or not for her. Is it a bug? It is not behaving the same way as Nodeprofile, if it's behaving as she describes. Odd."

Bio creates a node if you put fields on the registration page or if you click the link to create/edit it. Same as nodeprofile. Her issue was that she was getting both a bio node (which she needed) and a usernode (which she didn't need). The solution to that is to ditch usernode, not switch to nodeprofile/usernode which will get her the same problem.

"As such, I wouldn't recommend Bio to anyone because it is trying to integrate with a core module which is widely agreed to be rubbish. I appreciate Bio saves profile data as a node, which is great and, as you point out, means you could easily switch later if necessary."

Bio has nothing to do with the core profile module so I don't see how that has anything to do with this. It uses a node type same as nodeprofile does.

"But I don't care that Bio can do cool things with the Profile page, because I won't use it and I wouldn't recommend anyone else does either. So all those cool things Bio does mean nothing to me and I'm back with the more flexible Nodeprofile, combined with Usernode to provide an alternative profile page, and ditching the Profile module completely."

This is where I consider you to be misleading. You obviously have no clue how the bio module works and yet you're reccomending against it.

"This is just not true - it is so, so, so easy to do this with Nodeprofile"

I know how to use it. I've been using it nearly a year and wrote tutorials on it in use by thousands of people.

"I really don't know what you think is so grossly complicated about Nodeprofile or the steps above."

For me it's not terribly complicated. But, then, I've been using Drupal for some time and know what I'm doing. The many support requests I've gotten tell me that not everyone finds nodeprofile easy to use. And if you want it to take over the user page, it gets even more complicated. Bio is just easier. Less flexible, yes. Less powerful, yes. But much easier for people with simple needs.

"Everyone else can make up their own minds."

Of course. I just want to make sure they have accurate information to do that.

"I still maintain Bio is not as good a solution as Nodeprofile, and you won't change my mind"

You're welcome to your opinion. But please get your facts straight before trying to spread that opinion.

"My conscience is clean that I'm not "misleading" anyone."

Well, we'll just have to agree to disagree here. I think the position that "My preferred solution is better even though I don't know how the other solution works so just take my word for it" is not a good one.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

...

michelle's picture

You don't need usernode to use bio. Usernode comes in if you want to make views of all users and don't have a bio for each user (that's optional). It's also used with some things like buddylist. I'm going to be trying soon to make it so you can use bio in place of usernode in views if you have a bio for each user, which will eliminate that.

You may be interested in Deciding which modules to use for profiles which I just went and updated after reading this thread. :)

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

2 nodes for user profile

liliplanet's picture

Thank you everyone for your support.

Please would you be so kind to look at the following link which shows that there are 2 nodes created for a profile.

http://www.filmmaker.co.za/planet/tracker

Basic Profile is my content type and then the usernode as well.

Excuse the mess, but first have to figure this out before continuing.

Is that the way it is supposed to be? So every content type will create a new node with usernode/# and the link from the username goes to user/#.

Just seems to be so many links to the same content ...

Look forward to your reply.

Lilian

Usernode

michelle's picture

If you have usernode installed, yes, you will get a node for every user that's just an empty node. The only purpose it serves is for making views of users. If you have a bio node for every user, you don't need usernode unless you want the buddylist view, which hardcodes usernode.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

Friends of friends

liliplanet's picture

Thank you Michelle,

Actually I do need buddylist as I'm intending a similar business network as http://www.linkedin.com. Friends, friends of friends, invite, etc.

Great! now I can move forward.

Most appreciate your help.
Lilian

Buddylist view

michelle's picture

Yeah, unfortunately the view of buddies is hardcoded to work with usernode. I want to change that to work with bio as well but it's not something I'm likely to get to for a couple weeks. So if you need to use that particular view, you need usernode.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

Walt Esquivel's picture

I took a look at a poll on User Relationships vs. Buddylist vs. Friend (D6).

So, has anyone considered or is anyone using User Relationships instead of Buddylist? I just installed it on my site at wellnessgame.com and it seems like something I should test more thoroughly to see if it's something I want to use in lieu of Buddylist.

Lilian, I'm not certain yet, and I'm hoping someone with more knowledge can comment, but it appears that since I can use User Relationships, I can do away with both Buddylist and Usernode. Wouldn't this help keep that dreaded bloat down a bit?

People's thoughts?

Thanks in advance!

Walt Esquivel, MBA; MA; President, Wellness Corps; Captain, USMC (Veteran)
$50 Hosting Discount Helps Projects Needing Financing

Walt Esquivel, MBA; MA; President, Wellness Corps; Captain, USMC (Veteran)
$50 Hosting Discount Helps Projects Needing Financing

...

michelle's picture

Buddylist uses usernode (it's hardcoded) for the view to show buddies of a user, which is why they are tied together. The last time I looked at user relationship, it didn't have much (any?) views support. I do plan on having a good look at it so I can add it to advprofile. I'm also going to look at using bio instead of usernode in the buddylist view. There's lots of options. :)

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

What modules are you using?

Walt Esquivel's picture

Hi Lilian,

Wow, your initial post sure has resulted in lots of interesting comments! It's good to see the different ideas and healthy debate that folks such as Michelle and Greg bring to the table.

Anyway, I see from your initial post that you're using Nodeprofile and Usernode. However, would you be so kind as to list for me the other specific contributed modules you're using? I visited your site just to take a look and am curious, among other things, as to what you used for the different roles.

Finally, is http://www.filmmaker.co.za/planet/ your test site and, if so, can I play around on it by creating a few new accounts? Again, I'm just curious about testing the different roles in the sign-up process and the flow from sign-up to actual user (authenticated, platinum, and premium). And if not your test site or you prefer no testing other than your own, I understand completely. :)

Thank you!

Walt Esquivel, MBA; MA; President, Wellness Corps; Captain, USMC (Veteran)
$50 Hosting Discount Helps Projects Needing Financing

Walt Esquivel, MBA; MA; President, Wellness Corps; Captain, USMC (Veteran)
$50 Hosting Discount Helps Projects Needing Financing

re modules

liliplanet's picture

Dear Walt,

Thank you for your message.

Walt, I have not as yet figured out how to get users to register for different roles, and actually testing http://drupal.org/project/rolesignup, and presume it will have to work with http://drupal.org/project/pageroute. Also have different registration pages for each user.

Will keep you updated as soon as I get back to that, but first I have to figure out taxonomy/term in the next couple of days.

Have a great weekend.
Lilian

Importing users as nodes

liliplanet's picture

Hi All,

I'm starting to become despondent now. It's been 5 months just trying to make profiles for my users.

The current problem is that when you import users as nodes with http://drupal.org/project/node_import (I just did about 500 instead of my 14 000), and it automatically makes the author Admin (user 1).

I've deleted and started again several time with Author as 'blank', 'guest', all to no avail. The user does not import as 'Author'.

Naturally this is a big problem as all users redirect to the Admin (user 1) page.

please see :

http://www.filmmaker.co.za/planet/member_directory.php
http://www.filmmaker.co.za/planet/tracker

I've considered going through each profile and fixing the 'Author', but 14 000 is going to take months.

Another question, if my new site will be based on these profiles (a large directory of film services), and every page has to redirect with

<?php
// We don't ever want to go to the nodeprofile itself. Always redirect to the user page.
if (arg(0) == "node") {
drupal_goto("user/$node->uid", NULL, NULL, 301);
}
?>
(thank you Michelle)

will it not have a performance issue and will it affect search engines?

Going back to the basic Profile module loses taxonomy capability, Bio is not available with buddylists and I'm really stuck now.

Please, do you perhaps have any solution for me here?

Look forward to any reply and thank you.
Lilian

Update: I think I've made Author import ... installed the http://www.drupal.org/project/authorship and it creates a new field to import when importing to usernode. Will see in a couple of hours what's what. Thank you all!

...

michelle's picture

I'm looking at the description of that module and I don't think that's what you need. It doesn't look like it actually changes the author of the node internally but rather how it's displayed when you view it.

So it sounds like you need:

1) A way to set the author when creating the bio nodes with node_import. That could probably be done with a small change to the module. What are you using as a source for this? Do the users already exist in the system when you do the import?

2) A way to make buddylist work with just the bio so you can skip the usernode. This is coming, but probably not in the next couple of weeks. You could always use usernode for now and delete them all when you don't need them anymore. They don't store any actual data (as long as you don't add fields to them) so that shouldn't hurt anything. It won't bother the search engines because that code uses a 301 redirect but having an extra 14K nodes that you don't need will bloat your database a bit.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: