Losing my edit tabs on my Usernode

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

Hi All,

I am relatively new to this Drupal malarky, but the instructions I have picked up from reading through this group have been great so far. I have hit a problem now though.

I don't require a complex user profile, and so I have just set up custom fields on the usernode. I want to have two separate links in the menu, one to the user profile (named "my account" to allow users to change private account related information) and one to the usernode (named "public profile").

I have created those links, with the "public profile" path being to the usernode (eg. "/usernode"). When this is done, the usernode displays but without any edit tabs. Also, if I add a "/edit" to the path it still will not display the edit view. If I go to edit the usernode via the administer link, the usernode displays with the edit and view tabs. The path is "node/1/edit"

I can see two possible solutions, neither of which I really know how to do:

  1. Change the path of the menu link I have created to "/usernode/$nid/edit". (Unfortunately I can see that entering in the "$nid" to the path results in strange characters appearing in the string)
  2. Changing the node php template (node-usernode.tpl.php) to display the tabs. However everything I have tried so far in this regard hasn't worked.

Am I missing something obvious? Is there a way of doing either of the options above? Is there another solution? Is this a bug?

Thanks in advance for any help you can give.

Angelus7

Comments

are you sure you have the

heng's picture

are you sure you have the right permissions? have you allowed to "edit own usernode" under "usernode module" in the access control?

Its a good question! I did

angelus7's picture

Its a good question! I did doublecheck the permissions and they are set correctly.

Any other suggestions?

And thanks...

the usernode path doesn't

fago's picture

the usernode path doesn't contain the tabs due to the way the drupal menu system works.
You could recreate the tabs with some custom code that creates appropriate menu items or you could just create a redirect to the normal node page in your usernode template:

if (arg(0) == 'usernode') {
  drupal_goto('node/'.$nid);
}

Excellent!

angelus7's picture

Thanks for that. I am not in a position to try it out right now. However thanks for confirming that I am not going crazy.

Will try it out when I get home, and confirm my (hoped for) success.

Not quite

michelle's picture

I just decided to add this and it doesn't work... You want:

drupal_goto('node/'.$node->nid);

instead.

Michelle

Adding the snippet leaves me

Herbt's picture

Adding the snippet leaves me at http://mysite.net/node instead of http://mysite.net/node/number. Is there a specific place it should be inserted into the template?

So far, I have tried a few

Herbt's picture

So far, I have tried a few different ways to get this to go directly to the actual node, and each time i simply get left at /node. As close as I have come is by adding a chunk of the code Michelle uses in a nodeprofile tutorial ( http://drupal.org/node/130756 ) in a new file 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);
  }
?>

It gets me where i want to go but there is nothing displayed in the view tab, only the edit since the rest of the code is to print nodeprofile output.

Found a solution

Herbt's picture

My workaround is posted in my original thread:
http://drupal.org/node/137787#comment-224254

Responded to that post

michelle's picture

Just letting you know I put a response on that post...

Michelle

Profiles as nodes

Group organizers

Group notifications

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