I defined a CCK Link called it view_my_profile.

I want this to be a default value that the user cannot touch, view, or modify. Only the admin can modify or see it.

I installed CCK permission and set create, edit, view for admin only.

I thought that I could use tokens and enter user/[author-id] into the default field.

In a separate view when I show "view_my_profile" I would be taken to user/88 (if 88 was the author of the node or the user for example).

But that does not happen.

I get the actual text for "view_my_profile" in my view "user/[author-id]" without any token replacement if I set it to "plain, as text URL". So i know that the text value is present.

If set "view_my_profile" as "default to link with title", I get nothing.

Thanks,
Chris

Comments

quicksketch’s picture

The Link Views integration works as far as I've been using it. Have you tried disabling the CCK permission module to see if it helps? I wouldn't be surprised if Link didn't operate perfectly with the module as it's a little more complicated than a textfield or other basic CCK elements.

Other than that, I'd like to know why you don't just use the Node: Author Name to make a link to the user's profile. If you need to change the text, you can use the Views Theme Wizard to over-ride the default output and change that link text to whatever you like.

Another alternative (but similar to trying to use link) would be to use computed field and using some code like this in the field settings:

$node_field[0]['value'] = l(t('Profile'), 'user/'. $node->uid);

At the same time though, this would be similar to using link module. If you ever decided to change the text, you'd have to edit and save every node because the values are figured on insert/update, not on display. Your best option is doing it right and using the Node: Author Name view field and theming the view to make it display the way you want.

socialnicheguru’s picture

I wanted to be able to have all the links I wanted to be defined as part of the content type so that in the theme layer there would be little need for additional programming. But I am not locked to this idea especially after having tried to do it all day :(

How do I use views for each of these items below? i wanted to see if i could generalize your approach to other links that I wanted to create as part of a user's control panel or for an event control panel. I think that the RSVP items are not available in Views yet.

Add me as a buddy:
add/uid?destination=user/uid

or to view my RSVPs
user/uid/rsvp

or to create an rsvp for an event type:
node/nodeID/rsvp/create

I also have custom views and content types for each user that i would like to have linked directly from their profile.

Thanks for brainstorming with me.

Chris

quicksketch’s picture

After looking at what you want to accomplish, I think theming only makes more sense. As you add more fields that means more unnecessary JOINs in your query just to output different links for which you already have all the necessary information. All that you need is the author name, uid, and nid (the nid is automatically included in all theme items though).

Basically, by adding that single Node: Author name, you'll have all the information necessary to build as many links as you want. Additionally, you'll be able to change these links at any time by changing a few lines. If you go with stored data approach, you'll have to make sweeping and complicated SQL queries just to change the title of the link.

$output .= l(t('Add me as a buddy'), 'buddy/add/'. $node->node_uid, 'destination=user/uid');
$output .= l(t('RSVP Event'), 'user/'. $node->node_uid .'/rsvp');
$output .= l(t('Create Event'), 'node/'. $node->nid .'/rsvp/create');

Note that when theming views the $node object you get isn't actually a real node, it's all the individual fields that you've chosen in your view.

socialnicheguru’s picture

It seems like there is a problem with the CCK link implementation of Token?

I am not the only one who has had this problem it seems.

http://drupal.org/node/213548#comment-820798

Chris

quicksketch’s picture

Status: Active » Closed (duplicate)

Let's consolidate to that other issue, which is a bug report, rather than the suggestions I've made here for a support request.