I need to send the listing url to the user email adress after adding the listing

by php snippet
or
some little help? what to use? something like get_current_user_id() ?

'hivepress/v1/emails/listing_submit/send',
 function($email){
  $user_id = get_current_user_id();

pls pls pls help

Hi,

Please note that the hook you use above in the php snippet is an email that is sent to the admin when a new listing is submitted, and there is no point in adding a token code there because this email is sent to the admin anyway.

As for the email that is sent to the user when the listing is published, its name is Listing Approved, and it already contains the %listing_url% token. Therefore, you can simply edit it using this doc: How to customize emails - HivePress Help Center

​I hope this is helpful to you.

@andrii It’s not being sent because I don’t have an listing approval requirement
image

I set up the template. But the problem is that the email is sent only after the listing has been approved. But I have approval turned off.

Hi,

I see. Then, most likely, such an email is not supported, and you will need a custom implementation to add it. If you are familiar with coding or you have a developer, you can use this hook hivepress/v1/emails/listing_submit/send and add conditions there, for example, send an email to the user using this function wp_mail.

i know but i need something like get_current_user_id(); … for url of listing it is what?

Hi,

Please try to use error_log or var_dump as a variable in the $email hook you are using so you can understand whether there is content or tokens; if there are tokens, then you can get the listing: $listing=$email[‘tokens’][‘listing’];. After that, you will be able to get a user ID: $listing->get_user__id(), or use $listing->get_user__email() and send wp_mail to it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.