Getting data on email trigger

Hello,

I’m trying to send SMS to vendosr when their listing is approved. Currently vendors are getting an email. I have used hook as below

add_action( ‘hivepress/v1/emails/listing_approve/send’, ‘membership_activated_sms’);

I have created SMS functionality but want to fetch following details

  1. Phone Number (vendor provided on their profile)
  2. Listing URL

I have used function like like

membership_activated_sms($a) and getting data from $a as below

 [headers:protected] => Array
        (
            [content-type] => text/html; charset=UTF-8
        )

    [tokens:protected] => Array

When I tried to access token I got error

Fatal error : Uncaught Error: Cannot access protected property

Required:
Help me resolve Fatal error so I can grab the values or how can get the Phone number and listing URL directly.

Sorry for the delay. This hook accepts the email object, so you can get tokens this way:

$email->get_tokens()

It’s an array of tokens that should contain the vendor object and other data, depending on the email type.

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