We are using bio module and views to create a very nice directory of profiles on a Drupal site. We want to add a link or icon directly to a user's contact page to the view. To do this I created a new field in views/modules/views_user.inc.

Comments

Zack Rosen’s picture

StatusFileSize
new11.22 KB

What the field looks like.

Zack Rosen’s picture

StatusFileSize
new11.22 KB

Field options.

Zack Rosen’s picture

StatusFileSize
new55.27 KB

oops. THIS is what the field looks like.

Zack Rosen’s picture

StatusFileSize
new1.43 KB

I probably shouldn't send null in the $absolute param.

merlinofchaos’s picture

Should this check to see if the user has permission to even visit the contact form?

Zack Rosen’s picture

Good point Earl. The easy way to do this is with the _contact_user_tab_access($account) function. Should I call this function directly even though it is internally declared as a helper function?

merlinofchaos’s picture

Should probably call it directly. But that leads to another issue: This should probably be in views_contact.module rather than views_user.module since this feature won't exist if contact.module isn't enabled.

That means creating a new file for this feature.

merlinofchaos’s picture

Status: Needs review » Needs work
joshk’s picture

StatusFileSize
new1.44 KB

Here it is as it's own .inc file.

The _access_user_contact_tab() thinger seemed to be for HEAD, so I've copied DRUPAL-5's definition for access on the contact_menu $item, which checks to see that the global $user->uid is non-zero.

joshk’s picture

Just pinging this to see if there's any progress. 6.0 perhaps?

karens’s picture

Version: 5.x-1.6-beta5 » 6.x-2.x-dev
Assigned: Zack Rosen » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.07 KB

Pulling out this old request. I needed a way to put a link to the user contact page into a view, so I got this working in Views 2. You can create your own text for the link or use the icon image. It turns out to be pretty simple to do in Views 2 using the older code as a starting point.

Per the comments above, it's in a separate contact.inc file and we test user access with _contact_user_tab_access($account).

karens’s picture

It also works nicely if you create a view based on the user table of your users to show a contact link next to each name.

karens’s picture

StatusFileSize
new3.3 KB

One more time, the previous patch had another patch in it, this one is clean.

jfkelley’s picture

Apologies in advance for being a total newbie (and probable ignoramous)...

I applied the 2/6/2009 patch above to my Drupal 6.9 views/includes/handlers.inc (which also created 2 new files contact.views.inc and views_handler_field_contact_link.inc)

I'm looking all over the Edit View page for my user_list view (straight out of the examples that came with the views module) and I'm not seeing anything like the configuration objects shown in contact_view.png above.

I'd love to have a contact link on my table of users/profiles like in the example above.

What step am I missing?

merlinofchaos’s picture

You probably need to flush your cache. You can go directly to mysql and TRUNCATE cache_views;

merlinofchaos’s picture

Status: Needs review » Fixed

Commited to 2.x and 3.x branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.