Skip Navigation

[Resolved] How to add a link to user profile in messaging system

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 7 replies, has 2 voices.

Last updated by MargeP6083 4 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1475841
user_link_in_messaging_system.png

I would like the user to click a link in the messaging system and go to the "sender's" profile page. (custom post type profile)

I installed the system like here: https://toolset.com/learn/how-to-create-a-messaging-system-with-toolset/

hidden link

Thank you!

#1476649

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Marge,

Thank you for contacting us and I'd be happy to assist.

To suggest the best way forward, I'll need to understand the scope of where exactly this link to the user's profile is needed.

Can you please share temporary admin login detail, along with the link to the page from your screenshot?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1480299

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details.

Since in your first message, you mentioned linking to the "sender's" profile page (custom post type profile), I'll assume you plan to add a custom post for each user, where that user will be the post author and link that post's single page as a profile link.
( the set up that we recommend at https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/ )

If that is correct, you'll create a post view to show that custom post type, but with a post author filter which will accept the author ID, through the shortcode attribute, for example, "author":
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/#post-author-is-set-by-a-views-shortcode-attribute

Inside your view "Related messages", you already have the message sender user's ID through "[types field='message-from'][/types]" shortcode.
( screenshot: hidden link )

You can use that to pass on that user ID in the shortcode for the new view:


[wpv-view name="slug-of-the-view" author="[types field='message-from'][/types]"]

You'll replace the "slug-of-the-view" with the actual slug of the new view and then from inside the loop of that new view, you'll be able to show any information from the user profile post, including the post title, post link, post author etc.

I hope this helps and please let me know if you need any further assistance around this.

#1485973

Thanks, this is very helpful. I think I have the concept. I actually made a view of the post url with <a href="[wpv-post-url]>Visit</a> and the below

[wpv-view name="casting-author-link-to-profile" author="[types field='message-from'][/types]"]

Now, for more complications... I have 3 different user roles with 3 different profile types who all will communicate.
Can I use all 3 views in that shortcode and leave the [wpv-no-items-found][/wpv-no-items-found] blank?

Thanks!!

#1486907

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the update and glad that my message helped.

If each user (regardless of the user role) can only have exactly one profile post in any of these 3 post types, then you can select all 3 post types in your new post view.

Since the user whose ID we will be passing could only be the author of one post from those 3 post types, that view will only return information of one correct profile.

Hope this makes sense.

#1487231

This works great! Inserted that after first_name and last_name on the view. One last question. I'm looking for a css selector that would display the link inline. Any ideas or can I give it a class in the view?

#1488653

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

The "wpv-post-link" shortcode supports "class" attribute, which can be used for this:
( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-post-link )

For example, to include the class "button" to your post link created through the new view, you can update your shortcode to:


[wpv-post-link class="button"]

This should do the trick.

#1489057

My issue is resolved now. This worked great.

Thank you very much!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.