Call Private Message from Data Display Block

Permalink
Hi All,

I've been stuck for days trying to call a private message from the data display block.

The scenario would be: A customer/landlord places an advert, which can be reviewed by prospective tenants. If they like what's on offer, they can contact the landlord via PM.

The issue I am having is replacing the variable Owner ID 2 (below) with the owner of the Ad's ID, e.g. <a title="Respond To Ad" href="https://www.easyroomlets.com/index.php/profile/messages/write/2">Click here to contact <owner /></a>

I have tried various placeholder methods, such as:
<field name="Owner ID" placeholder="ownerid" />
<a title="Respond to Ad" href="https://www.easyroomlets.com/index.php/profile/messages/write/{{ ownerid }}/">Click here to contact <owner /></a>

but these take me back to the profile of the person reviewing the advert, and not the PM of the owner.

Any help getting this resolved would be greatly appreciated.

 
fauners replied on at Permalink Reply
Hi

I registered on your site there and you're right, it doesn't work. But it doesn't work even if you just put in the url.
I tried on a site I have that has public profiles and messaging available. And the url works with /profile/messages/write/2/
Are you sure the user with ID=2 can receive private messages?
Actually I just put in
http://www.easyroomlets.com/index.php/profile/2...
and this error came up
"Invalid User ID."

Soooo, looks like you are puling the wrong user id,
Because if I put this in
https://www.easyroomlets.com/index.php/profile/messages/write/5/...

It works perfect.

So something is going wrong when you get the Owner ID, 2 is coming up for them all.

Hope that helps.

Adam
adminEasy replied on at Permalink Reply
Hi

Thanks for you speedy reply. Profile 2 was a user that was used for testing and now is deleted. I have others i.e ID 38, so entering https://www.easyroomlets.com/index.php/profile/messages/write/38/... will work as you have found out.

The above I know works, but I want to automate it, so that the Owner ID variable for each advert is changed when a prospective customer wants to contact the advert owner.

Is this possible?
enlil replied on at Permalink Reply
enlil
You could easily accomplish this using the Magic Data add-on. It would allow you to do something like:

<a title="Respond To Ad" href="https://www.easyroomlets.com/index.php/profile/messages/write/[%ORIGINAL_PAGE OWNER%]">Click here to contact [%ORIGINAL_PAGE OWNER USERNAME%]</a>
adminEasy replied on at Permalink Reply
So I am clear:

Are there any PHP knowledge overheads to implementing Magic?

How does this integrate with the Advanced Forms/Data Display Add on?
fauners replied on at Permalink Reply
using data display you should be able to do it using owner id
probably have to use a placeholder too.
the documentation doesn't have any examples but says

<owner /> - Display information about the owner of the record.

Attributes

attribute - (optional) Display a specific attribute of the record's owner. Possible values are "email", "id", or a user attribute handle. If no attribute is specified, the username will be returned.


so could be
<owner attribute="id" >

try that with a placeholder like
<owner attribute="id" placeholder="ownerid">

see if that works.
have you asked on the data display page? probably best place
adminEasy replied on at Permalink Reply
Many thanks to Mr Garcia,

And the answer is:

<owner attribute="id" placeholder="ownerid" />
<a title="Search or Place Ad" href="https://www.easyroomlets.com/index.php/profile/messages/write/{{ownerid}}/">Click here to contact <owner /></a>