Usernode link to actual node
Usernode seems to be the best fit (over nodeprofile) for a project I'm working on. The only thing that would be preferable is if it went directly to the node. I've read these two posts
http://drupal.org/node/113196
http://drupal.org/node/124772
and the first snippet leaves me at http://mysite.net/node instead of http://mysite.net/node/number.
Since I've never dug this deep into drupal before, I've used these two examples as a jumping off point, combined the two and came up with this:
if (arg(0) == 'usernode') {
drupal_goto("node/{$GLOBALS['user']->uid}");
}and it redirects fine, except there's no real connection to the actual usernode. If user 4 doesn't use node 4, it falls apart.
Am I on the right track, or is there another way to do this?
Thanks

I've never used usernode,
I've never used usernode, but I take it it is creating actual nodes for a user profile and thus, as you said, there is no real correlation other than luck between a user id matching a node id. I'd imagine the usernode module creates a table somewhere matching the two. I'd look at the code for the module/ and or the DB and try to find what the table and fields are. If the usernode module itself provides a page listing all users&profiles the code should be there for this.
Modern Jurist: A Site For Lawyers
hey there, you should check
hey there, you should check out the profiles as nodes group on groups.drupal.org... there a couple of noce tutorials over there.
Patchak
If you have usernode
If you have usernode installed, the user-object should have a property node_id.
Otherwise check out the function usernode_get_node_id($user) or use a straight node_load(array('uid' => $uid, 'type' => 'usernode')).
--
best regards
Ray
----------------------------------------------------------
If you need a drupal developer contact me!
Workaround found
I used part of the tutorial that combines usernode and node profile
( http://drupal.org/node/130756 ) to create a new template: node-usernode.tpl.php
<?php// Redirect the /usernode link to the actual usernode so we get the tabs on top
if (arg(0) == 'usernode') {
drupal_goto('node/'.$nid);
}
?>
This gives me a blank usernode under the view tab, while all of my fields exist under the edit tab. From there I was unsure how to populate the view tab, which is where the content template
( http://drupal.org/project/contemplate ) came in handy. Because of the redirect, listed above using the content template module wasn't going to work, but it did provide me with the code to paste into my new node template. All together it looks like this:
<?php// Redirect the /usernode link to the actual usernode so we get the tabs on top
if (arg(0) == 'usernode') {
drupal_goto('node/'.$nid);
}
?>
<?php print $node->content['group_contact_information']['field_full_name']['#value'] ?>
<?php print $node->content['group_contact_information']['field_email']['#value'] ?>
<?php print $node->content['group_contact_information']['field_phone']['#value'] ?>
<?php print $node->content['field_brief_resume']['#value'] ?>
Redirect & contemplate
Sorry for the delay... I've been on the computer sporadically since last Thursday and missed your posts in the group. I'm a little confused on something... That redirect is actually working for you? As I posted in the group thread, it didn't work when I tried it. I needed to use drupal_goto('node/'.$node->nid); instead.
Also, you can use contemplate with usernodes no problem. Keep an eye on my tutorial in progress as I use it: http://dev.shellmultimedia.com/node/41
Michelle
--------------------------------------
My site: http://shellmultimedia.com
Yup, it works for me. I just
Yup, it works for me. I just had a look at what I was doing before adding the new template page and it seems that ('node/'.$nid) didn't work from inside my existing template, but when it was put into the external node-usernode.tpl.php it works fine.
Thanks for the new tutorial link, I'll definitely have a look.
Interesting...
I had it in a separate .tpl and it didn't work. I assumed it was a typo in the code but it looks like it's actually a variable that I didn't have for some reason. When I get some more time to work on profiles, I'll look into why it didn't work for me.
Thanks,
Michelle
--------------------------------------
My site: http://shellmultimedia.com