Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By cliffskier on
I am trying to create a member directory using Views. It is visible to members and shows contact information for other members. Instead of showing an e-mail address, I would like to have a link to the user's contact page. I have added the field User:Link to contact page. All of the other fields are listed, but I see no link to a contact page, even if I know the member's contact form is enabled. Am I missing something?
Comments
Is this the user personal
Is this the user personal contact form? If so, check the permission settings (admin path: /admin/people/permissions) and see who has access to contact form and update the permission to what you want.
-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien
I think the permissions are right
I am the administrator, and I have permission to "Use users' personal contact forms." Members also have that permission. As administrator I can click on any users and access their contact forms. But I still don't see the link to the contact form in my view.
There is another way wihch i
There is another way wihch i use:
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'
-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien
That worked
Perfect! Do you know a way to show the link only if the member's contact form is enabled?
In the field where you
In the field where you created the link. Check the "Hide if empty" box. I think that might work?
-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien
That didn't do it
Nice idea, but the field always returns a link. Following the link leads to an Access Denied page if the form is not enabled.
Actually, there's no need for
Actually, there's no need for the poor workaround.
I've just tested adding a User Views and the User: Link to contact page field. It works fine. You need to add Text to display and under 'No results behavior', check 'hide if empty'.
What Views version are you running?
This is the setup i have:
Drupal 7.50
views 7.x-3.14
-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien
I didn't think of including Text to display
I assumed there just would be a visible link. You are right. If I include text, the link is visible. Thank you. That solves it.
I have the same versions you have.