I have a brand new site and am trying to show a list of users with a link to their contact page. So far, I'm having no luck getting it to show! Any suggestions?

Comments

mariusz.slonina’s picture

Component: Miscellaneous » user data
Category: support » bug
Status: Active » Needs review
StatusFileSize
new1.25 KB

This patch should fix the problem, however, be sure to check permissions. In D7 Anonymous users are able to use personal contact forms, thus I removed all D6 logic and test access with user_access('access user contact forms'), Also, we should check $account->data['contact'] instead of $account->contact (for case when user disabled own contact page). Hope this helps.

dawehner’s picture

Perhaps it's just the patch


+    // Build a pseudo account object to be able to check the access.
+    $account = new stdClass();
+    $account->uid = $user->uid;
+    
+    return user_access('access user contact forms');

But you dont' use $account anymore later?

mariusz.slonina’s picture

StatusFileSize
new1.27 KB

You're right, the $account in access() isn't needed. The new patch uses only user_access().

dawehner’s picture

   function access() {
-    global $user;
-
-    // Only registered users can view other registered user's contact page.
-    if (empty($user->uid)) {
-      return FALSE;
-    }
-
-    return TRUE;
+    return user_access('access user contact forms');
   }

This was the d6 logic of contact, right?

mariusz.slonina’s picture

Yes. In D7 with "access user contact form" we can allow Anonymous users to use personal contact forms. So the access() in Views7-3 should be different than Views6-3, I believe.

The _contact_personal_tab_access() checks at the end for "access user contact form", however, using it in access(), will totally hide contact link.

+    $this->options['alter']['make_link'] = TRUE;

might be missing in both branches (without it we obtain only plain text).

I manually tested the patch for site administrator, authenticated user and anonymous user on D7.0.

dawehner’s picture

What about changing the signature to a static?

The advantage: less code change
The disadvantage: This can't be applied to 6.x-3.x

mariusz.slonina’s picture

StatusFileSize
new1.03 KB
new691 bytes

This is probably much cleaner solution:
- patch (a) applies both to D6/D7-3 branches, since the contact link (if access is true) is made only when icon option is choosen -- plain text otherwise, even if we have access. For D6-2 branch link is made in both icon/text option.
- patch (b) applies only to D7-3 branch, and is D7 specific: 1) we have a permission to use personal contact forms 2) the user may still choose to enable personal contact form, but the setting for that lives now in $account->data['contact'].

Anonymous’s picture

Is there a patch for this that fixes 6.x-2.x? (the latest patch doesn't work for me)
Would love to get this working on my site...

mariusz.slonina’s picture

The patch 1021590_7a should work on 6-3. I thought that the contact link is working for 6-2 branch, I will look at it later today.

mariusz.slonina’s picture

StatusFileSize
new696 bytes

reattaching 7a patch for latest dev

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev

We need this to 6.x-3.x, too.

mariusz.slonina’s picture

StatusFileSize
new1.5 KB
new698 bytes

Patches against current 6-dev/7-dev

Sborsody’s picture

Status: Needs review » Reviewed & tested by the community

RTBC for D7 patch only.

Sborsody’s picture

Status: Reviewed & tested by the community » Needs work

The patches refer to a removed image.

$text = theme('image', 'misc/forum-new.png');

The forum icons were consolidated into a sprite: #1008580: Fix image references in forum.css Perhaps a new icon is needed so this doesn't have to rely upon the forum module.

BTW, it would be great for this to be made available via a theme function like something similar to theme_feed_icon.

tim.plunkett’s picture

sub

roam2345’s picture

Sub

AdamGS’s picture

sub

danepowell’s picture

sub- interested in and able to review any 7.x patch

llslim’s picture

Status: Needs work » Reviewed & tested by the community

i have applied the 1021590_12_d7 patch to the latest 7.x-3.0-rc1 release, and it works well for making the textual, but the icon picture still depends on the forum module. I say the icon should be the user's profile picture instead of random icon. Just my opinion.

llslim’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new3.18 KB
new2.53 KB

This fix enables views to display links to users' with both text
and icon types and gives site developers to theme the contact
link icon.

The changes made by the patch in comment #12 are included.

Site Developers can customize the display of the icon by overriding
the base theme_views_contact_link_icon function from with in their theme.
This base theme function is located at the bottom of ~/views/theme/theme.inc

In development the following lulla icon is set as the default icon
located in the image directory of the views module (~/views/images):
- http://www.lullabot.com/files/icons/lullacons_pack1/doc-option-edit.png

I feel this free GPL licensed icon should be included in the views package.
As suggested here: http://drupal.org/node/35416

As the library project matures image resources of the module should
implement that way, but that's a feature request it's beyond the scope
of fixing this issue.

The D6 patch was made against the views git repository commit with sha aa2b24e9982c29bd9dc6235e440b7c336458fa81 made on June 25th 2011

The D7 patch was made against the views git repository commit with sha f9af377bfcdd19d3a047d76d956a1871e1c0aed3 made on June 28th 2011

llslim’s picture

Status: Needs review » Needs work
StatusFileSize
new3.68 KB
new2.52 KB

Sorry the attached fixes the white space errors in previous files. This is my first time using git to submit a patch. here are working patches that can be applied cleanly.

llslim’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Needs work » Needs review

same patch in #21 works with latest dev version.

mariagwyn’s picture

I applied the patch (worked) but am now getting the following error anytime I visit a view that should show a contact link:

Theme key "views_contact_link_icon" not found.

llslim’s picture

StatusFileSize
new3.68 KB

@mariagwyn did the patch apply the modifications to the views.module file where the array key is set?

In the patch review it still shows an eol error before the part in the patch modifying the views_theme function in the views.module file. After submitting the last patch I did changed my eclipse settings to handle unix files. re-rolling my patch for d7 attached to see if the EOL disappears.

llslim’s picture

@mariagwyn that message also may happen if you don't clear the theme cache after applying the patch. you can clear cache by going to the performance page located admin/configuration/development/performance in drupal 7. in drupal 6 you can clear it at admin/settings/performance

mariagwyn’s picture

I have been using drupal for 6 years, and I still forget to flush the cache. It seems to work for me, though I haven't re-applied #26. Thanks llslim.

mariagwyn’s picture

I am having some trouble overriding this in my theme. I simply want to change the graphic, but it doesn't seem to be working. And yes, I am sure my template.php file is being registered because if I put the function in and do not change the name, it throws an error. Is there something new in D7 about theming this link?

Here is my renamed function:

function acquia_marina_views_contact_link_icon($variables) {
		$contact_image = drupal_get_path('module', 'views') . '/images/mail.png';
	return theme('image', array('path' => $contact_image, 'alt' => $variables['alt'], 'title' => $variables['title']));
}

I tried it with phptemplate_views_contact as well. No change.

roam2345’s picture

Can we get a rerolled patch against D7 ill test?

llslim’s picture

@mariagwyn

It worked on my test with acquia_marina, but you do have to install the fusion base theme with the skinr module, and clear the theme registry cache after creating and saving the new template.php file. Without the base theme and clearing the cache it won't work at all.

For other themes when using the override feature in your theme please follow the procedure as described in the "How to change HTML the Drupal way" on this page: http://drupal.org/node/341628 . Remember to clear the theme registry cache after editing and saving your theme's template.php.

Also you can put the overriding contact link icon image in your theme directory that way you can keep everything together. Using "mythemename" as the theme name of your favorite theme and '/path/to/image.png' as the path with in your theme directory to the overriding image.

function mythemename_views_contact_link_icon($variables) {
   $contact_image = drupal_get_path('theme', 'mythemename') . '/path/to/image.png';
  return theme('image', array('path' => $contact_image, 'alt' => $variables['alt'], 'title' => $variables['title']));
}

Note: if you're copy and pasting the above into a new template.php. Remember to remove the trailing "?>" in the file.

Hope this helps.

llslim’s picture

StatusFileSize
new3.43 KB

@jucalme for your review

Just pulled down the new changes to views this morning from the git repository

Attached is the D7 patch against the views-7.x-3.x branch with the commit hash b99032a1019d2100062ddb344c9f95ba01919d87

Please refer to [#20] for full instructions / parameters and [#29] for overriding instructions.

YOUR review is very appreciated.

The re-roll for D6 patch is on it's way soon.

llslim’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
StatusFileSize
new2.35 KB

Pulled down the new changes to viiews 6.x-3.x from the git repository

Attached is the D6 patch against the views-6.x-3.x branch with the commit hash: a27f545805b2e6973516cba05b1884a8ad39a31a

Please refer to [#20] for full instructions / parameters and [#29] for overriding instructions.

YOUR review is very appreciated.

roam2345’s picture

Status: Needs work » Needs review

@llslim unfortunately you will need a further re-roll of the patches there is trailing white space and a tab should be two spaces.. http://drupal.org/coding-standards#indenting will post back after test.

$this->options['alter']['attributes'] = array('title' => t('Contact %user', array('%user' => $account->name)));
+    $this->options['alter']['attributes'] = array('title' => $title_text);

7.x-patch this is wrong should remove the previous line, no need to set something then straight away overrider it. Assume this was oversite in D7 version as in D6 its correct.

roam2345’s picture

Status: Needs review » Needs work
StatusFileSize
new16.24 KB

Patch does not work, for D7
running
- drupal 7.4
- ctools 7.x-1.x-dev 2011-Jun-24
- views 7.x-3.x-dev 2011-Jul-07 with patch #30

link fails to display I see the label text but no link, set the text to contact link and it never displays.

llslim’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
StatusFileSize
new2.35 KB

I completely by hand patched #30 trying to remove whitespace errors in patch and over looked the double rewrite. Sorry about that.

Here is the re rolled D7 patch. The link and icon both worked for me.

llslim’s picture

StatusFileSize
new3.45 KB

Dis regard #34. use this instead

mariusz.slonina’s picture

Hi, sorry for late response -- I tested new patches and it seems to work well (D7.4, latest ctools+views), however I'm not convinced with this edit icon, maybe kind of a mail icon would be better?

llslim’s picture

StatusFileSize
new3.61 KB

Okay first I finally figured out how to change tabs to spaces and print white spaces as characters in Eclipse so my patches avoid white space errors. Celebrating small victories. I also apologize for fumbling through this with so many posts, but learning a lot.

Second @marlusz.slonina it can be whatever image you want with it now being themed, but by default I do agree the lulla mail icon (http://www.lullabot.com/files/icons/lullacons_pack1/mail.png) would be a better choice to ship in the views images directory. The edit icon was used in development as a second option to test and force me to override in the theme. Anyhow the final image would be up to the dev who commits the patch I guess.

@jucallme the patch does work as expected, but you have to set the contact form as available in each user profile before the view can access it. Also for the theme function to display the icon the image file has to exist. In the use case I presented in [#20], the image would come with the views module in the images directory as discussed last paragraph. I did add a check to print a message to admins who have 'administer users' access to say "User contact page is not available to be viewed" to help admins know what is wrong in the view.

@jucallme your image does point out another error that the field label shouldn't print when there's no data. That's out the scope of this issue.

Anyway this patch is rolled against the July 7th commit with the hash ba94ee107d639cfc530f652ea99b8faf7a62db5d of the 7.x-3.x branch.

llslim’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
StatusFileSize
new2.63 KB

This is the D6 port of the patch posted in #37 rolled against the July 7th commit with the hash of a27f545805b2e6973516cba05b1884a8ad39a31a of the 6.x-3.x branch.

llslim’s picture

just checking in to see if other people had the chance to review the patches in comment #37 and comment #38 . So this issue can be closed.

dawehner’s picture

Sorry but please keep it simple. If there is no image availible, we basically shouldn't use one and not add one into views. Isn't a link + text enough here?

llslim’s picture

@dereine This issue didn't introduce the icon option as a new feature, but fixed what was already committed to the views project in order to make it work as expected. If the icon option is available, then I just think it should work out of the box no matter what we as developers think trivial. Yes the text + link is sufficient for the majority, but we are just fixing the broken option.

Also as #14 states the image referenced before the fix was outside of views and subject to be more likely missing and can be changed without notice to views,or to the maintainer of the outside referenced image knowing it is being referenced.. With the the image with in the views package changes to the image can be tracked and attached to the changes of code that uses it..

If the image cannot be included, the maybe a warning concerning 'no file exist ' should be presented with in the current theme directory. That way it can tell people to put their icons in the right place.

What do you think?

roam2345’s picture

My two cents but I defer this to @dereine, views should not be inserting a default image. If a page needs an image on this its a little simple css.
For example.

.field-example-mail {
  display: block;
  background: url('path-to-image/example.png') no-repeat;
  height: 10px; /*height of image*/
  padding-left: 10px; /*width of image to move text right so not over image*/
}

there is no need for a full tpl...especially since we can now add our own classes on fields, all that overhead. I would rather remove it.

llslim’s picture

StatusFileSize
new3.64 KB

Solves contact page link issue #1021590

Customizes the display of a link to a user's contact page by adding an
icon next to the text link instead of replacing it with an image tag.
This is done with the css trick that jucallme suggested here
http://drupal.org/node/1021590#comment-4736618.

This patch changes the 'Type of link' select box to an 'Add icon'
checkbox. When checked, the css class 'contact-link-icon' is applied
to the contact page text link to show an 16px by 16px PNG image to the
left of the text link. The image is referenced from the 'misc' directory
located in the drupal top-level directory where many of the images for
drupal core modules are stored. AS explained in the description of the
checkbox, the name of the image file has to be contact-link-icon.png.

Site developers can customize the size and name of the icon image by
defining their own 'contact-link-icon' class in a stylesheet of the active
theme. Which will override the css definition in the views.css file.

This eliminates the overhead of using template files, and eliminates
the need to add an image to the views module by having clear
instructions in the checkbox description. As both @dereine and
@jucallme pointed out.

this patch is based on the commit with the hash ac214b2e made on july 20th.

Check the patch out and let me know further thoughts.

llslim’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
StatusFileSize
new4.59 KB

this is the d7 port of the patch above. this patch based on commit with the hash 46b999e25 made on july 20th.

llslim’s picture

StatusFileSize
new4.55 KB

Fixed whitespace errors in #44 sorry about multiple posts.

dawehner’s picture

Assigned: Unassigned » merlinofchaos

This seems to be a decision for merlinofchaos

Personally i don't like such specific things in views.

llslim’s picture

@derenie I understand, just making it functional for those who choose it.

dawehner’s picture

Just spend some time with this. There is still this icon provided by drupal, but it's part of a sprite,
so why isn't it possible to write some css which takes this icon and use it?

You don't have to care of the relative path to views, because you could use ctools/includes/css.inc
to write dynamic css.

Vasu’s picture

sub

llslim’s picture

Just getting back to this. The issue of using the forum sprite for the image. Is that the sprite is arranged horizontally and not vertically. In order to represent the single icon the width of the element (link) would be reduced to 16px and cutting out the text link. If the sprite was stacked vertically it would work just fine. I thought about adding an extra element to make use of the sprite, but couldn't let site developers override the image element without creating the over head of a theme template. Also adding a empty element just to use a background image I feel would be unnecessary bloat to a page for aesthetics was not a good thing. So while it's a pain to download a new icon,it's the best option I can see. Unless we can convince the forum maintainers to use change the orientation of the sprite, or even to move the "new" icon to the far right position with in the sprite. I am open to suggestions of a way to implement this with the sprite and its current orientation.

I haven't used the ctools functions to write dynamic css before. Can you point me in a good direction for examples? I'll research that soon. Thanks for looking at it and giving comments. I appreciate it.

dawehner’s picture

I don't know of an example, but the api is really not hard to use and the file itself has a lot of great documentation.
But this is just an idea.

llslim’s picture

StatusFileSize
new5.84 KB

Here's the latest drupal 7 revision for your review.

Significant updates:
-With using ctools. dynamic css I got the changes limited to only one file
- Using the forum-icons.png by default
- added a check box option for site developers to put their custom icon in the default theme directory.

Dynamic css makes the ctools module a requirement for this scheme to work. It's either that or add to views.css

CSS Background clipping is not standard yet or as prevalent as regular image clipping. Also because css url referencing is relative. The trick that @jucallme suggested in #42 wouldn't work on all installs with symlinks.

I am still debugging the drupal 6 port and will explain those issues in separate comment. Let me know your opinions. Also thanks to those who gave me suggestions. Even though this issue was simple or should be. I've learned a lot. Full commit message below.

#1021590 fixes contact link and adds icon

Customizes the display of a link to a user's contact page by adding an
icon next to the text link instead of replacing it with an image tag.
This is done with using the forum-icons sprite and ctools dynamic css.

This patch changes the 'Type of link' select box to an 'Add icon'
checkbox on field configuration page. When checked, an 16px by 16px PNG
image is placed to the left of the text link. The default image is the
new forum icon from the forum-icons.png image. The image is referenced
from the 'misc' directory located in the drupal top-level directory where
many of the images for drupal core modules are stored. The new
forum-icons.png sprite image comes with all drupal 7 core install.

A second sub-sequent 'customize icon' checkbox has been added to allow for
a customized icon to be placed in the base directory of the drupal theme.
The name of the image file has to be contact-link-icon.png, and preferrably
16px by 16px in size.

Site developers can customize the size and style of the icon image by
defining their own 'contact-link-icon-custom' class in a stylesheet of
the active default theme. Which will override the dynamically created
css definition.This eliminates the overhead of using template files,
and eliminatesthe need to add an image to the views module by having
clear instructions in the checkbox description.

dawehner’s picture

Status: Needs review » Needs work

Dynamic css makes the ctools module a requirement for this scheme to work. It's either that or add to views.css

views already requires ctools in drupal7. That's okay :) Does this bug exist on drupal6 as well?

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -56,22 +63,58 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+      if ($this->options['custom_icon']) { // 'custom icon' is marked

I'm wondering whether it would make sense to be able to define the path in the view, so any kind of icon could be used. But i guess the per-theme is better

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -56,22 +63,58 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+        $icon_path = drupal_get_path('theme', variable_get('theme_default',0)) . '/contact-link-icon.png';

Better use the current theme global $theme instead of the variable.

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -56,22 +63,58 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+        $icon_path = '/misc/forum-icons.png';

The path shouldn't be absolute here. theme('image')/url should handle it as well. Alternative you could use base_path()

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -56,22 +63,58 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+      $output = theme_image($image_attributes) . $this->options['text'];

Please call theme('image') here

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -56,22 +63,58 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+      $filename = ctools_css_store($icon_class,$contact_link_css,FALSE);

It would be cool if you could use drupal code style here as well: Add a new space after each argument: foo($bar, $baz, $foo);

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -56,22 +63,58 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+      $filename = ctools_css_store($icon_class,$contact_link_css,FALSE);
+      $css_list = drupal_add_css($filename);
+    } else { // else if the add_icon is NOT checked
+      $output = $this->options['text'];
+    } // end of add_icon else
 
-    return $text;
+    return $output;
   }
 }
 

There are other code style problems here as well. else {, comments after the line etc. Please also take sure that the output of 'text' is escapped right.

llslim’s picture

Status: Needs work » Needs review
StatusFileSize
new5.96 KB

I fixed the drupal code style standard errors suggested by dereine, and made use
of the theme() function instead of theme_image(). Also added base_path to image
paths. Still have to test when drupal is not installed at rot of domain.

The reason I used the theme_default variable and not the global $theme variable
is to take into account for Administration themes. For example 'rootcandy' is a
popular administration theme, and using the $theme variable would reference the
administration theme 'rootcandy' and not the default theme such as 'garland'. I
think that would confused people as I haven't found a global variable that
references the default theme. I may be over looking something though.

I also wonder if defining the path to the image is a good thing to do in the
view, but the priority was getting the functionality to work before focusing on
that. Also since this is not a 'critical' feature the less thinking site
developers have to do the better. Just my thoughts. I can look into it after
everything else is squared away.

@dereine what do you mean? by escape the output? by putting t() around it?

llslim’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
StatusFileSize
new4.49 KB

This is the Drupal 6 version. Functionally works like the Drupal 7. The issue I'm having is getting the ctools dependency work on the views form. I tried to look at documentation, but I'm not having any joy. If someone can point out what I'm doing wrong. That will be great.

kehan’s picture

subscribing

infines’s picture

Subs

llslim’s picture

StatusFileSize
new3.38 KB

Here is the d6 patch for review to be committed. Since I couldn't get dependency to work in D6 like I can in D7 (which #54 needs reviewed also) I removed the custom icon option from D6. Works eautifully. Let me know your thoughts.

infines’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev

Shouldn't we commit this to D7 dev before moving on to D6?

dawehner’s picture

Well at least for d6 this patch will not work because we don't! have ctools available.

justmagicmaria’s picture

Subscribing. (Need D7 fix.)

infines’s picture

I don't understand. Is the patch in #54 for Drupal 7? Let me know and I'll test it. And if so then it probably needs to be tweaked and adjusted against the latest dev.

dawehner’s picture


@dereine what do you mean? by escape the output? by putting t() around it?

I thought of using check_plain.

infines’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

I can confirm that the patch in #54 works wonderfully. It was tested on Views 3.x rc-3.

infines’s picture

Status: Reviewed & tested by the community » Needs work

Reopening to say that the patch in #54 needs a bit of work as it doesn't disappear if the user unchecks the Personal Contact Form option. It shouldn't render if thats the case.

ahmetucar’s picture

Subscribing.

dawehner’s picture

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -6,21 +6,21 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
-    $options['link_display'] = array('default' => 'link', 'translatable' => FALSE);

Would it be possible to write some code in the init() function to take care to migrate existing settings?

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -60,19 +60,44 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+    $user_title = t('Contact @user', array('@user' => $account->name));

Mh this seems to change the string, why not using %user here as well?

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -6,21 +6,21 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
-    $options['link_display'] = array('default' => 'link', 'translatable' => FALSE);

Would it be possible to write some code in the init() function to take care to migrate existing settings?

+++ b/modules/contact/views_handler_field_contact_link.incundefined
@@ -60,19 +60,44 @@ class views_handler_field_contact_link extends views_handler_field_user_link {
+    $user_title = t('Contact @user', array('@user' => $account->name));

Mh this seems to change the string, why not using %user here as well?

In general it would be cool to have some kind of issue summary here.

infines’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.5 KB

I tested the patch in #12 against current 7.x-3.x-dev and it works wonderfully. I'm reattaching both patches to these posts, however I'm not rerolling them against the current dev as I have no idea how to do so but this issue has been open for far too long and needs closure. For any further issues, I vote for people to open up a new one. The 6.x patch needs to be tested against the 6.x dev still.

Marking as RTBC.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Needs work

Since one of the maintainers (dereine) posted a list of things that need to be improved about the patch, it seems odd to RTBC it without addressing those things.

infines’s picture

Those changes were for more recent patches, I'm saying that an old patch works fine. The newer patches when tested have removed and changed so much that when tested they don't respect whether a user has their contact form enabled or not. This is an attempt to scale things back and move the issue forward. However let the maintainers do what they feel is right.

infines’s picture

Those changes were for more recent patches, I'm saying that an old patch works fine. The newer patches when tested have removed and changed so much that when tested they don't respect whether a user has their contact form enabled or not. This is an attempt to scale things back and move the issue forward. However let the maintainers do what they feel is right.

dawehner’s picture

+++ views_handler_field_contact_link.inc.b	2011-02-21 11:02:57.000000000 +0100
@@ -57,16 +50,16 @@ class views_handler_field_contact_link e
-      $this->options['alter']['html'] = TRUE;

I'm a bit confused about this line. The text is set to an image, so it will always need html...

The total issue was about getting the icon back, which requires quite some effort see comment 58.
I'm wondering whether we could try to keep the focus of that issue.

I'm pretty sure that this patch doesn't work for 6.x as it's using $account->data instead of $account->foo directly.

infines’s picture

I dont understand the big hub bub about the icon. I think this issue is more about getting a functioning contact link in views. If people want an icon they can theme the link with css. Views is for generating queries and lists of objects. Icons and formatting come second hand. That's why i'm trying to move the issue forward. Any issues about an icon for the 1 link that people want it for and the only link that seemingly has it in drupal, should be opened up in a seperate issue.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new2.62 KB
+++ views_handler_field_contact_link.inc.b	2011-02-21 11:02:57.000000000 +0100
@@ -57,16 +50,16 @@ class views_handler_field_contact_link e
     if ($this->options['link_display'] == 'icon') {
       $text = theme('image', array('path' => 'misc/forum-new.png'));

What about simply dropping the feature?

You are right about don't care about the icon, if drupal doesn't have a simple icon anymore that's not our fault.
Here is a patch which uses the approach from above but drops the configuration at all.

Maybe someone could write a contrib module with a contact field which has all the features you need.

dawehner’s picture

I'm somehow wondering why _contact_personal_tab_access isn't used, just because it's not a public function?

dawehner’s picture

Status: Needs review » Fixed

So committed the current version, even it's not perfect. Things can ALWAYS be improved later, so it's actually important to get something working in.

Status: Fixed » Closed (fixed)

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

dianacastillo’s picture

Status: Closed (fixed) » Needs work

i just overrode my views module with the 7.x-3.x-dev version, ran update (it said nothing to update) and my Views field "User: Link to contact page" still doesnt find the contact page of the user, even though if you go to the user page the contact page exists.

dawehner’s picture

@dianacastillo
Can you please describe your scenario with a little bit more details? One small interesting details could be to know, whether the user has explicit disabled/enabled the contact page?

dianacastillo’s picture

The contact page is enabled explicitly. I made a view and one of the fields I added was the "User: Link to contact page" but the link doesnt appear.

sparker888’s picture

I too am running Drupal 7.22 with Views 7.x-3.7, and have enabled contact permissions (for all roles) as well as having (test) users explicitly allow the use of the contact form. the "User: Link to contact page" field is enabled in Views yet nothing is showing up for this field in the view. I'm willing to help describe any further settings or site set up info to help with this issue.

Edit: Tried the latest dev version of Views with the same result.

jippie1948’s picture

For this to work the Token module needs to be enabled.

- Create a new view based on User.
- Add a field User:Uid
- In field settings:
- Untick 'Link this field to its user'
- Tick 'Rewrite the output of this field'
- Add some text e.g. 'contact user'
- Tick 'Output this field as a link'
- Set 'Link Path' to 'user/[uid]/contact'

For me it works. Best wishes, JP