LLMS_Notification_View_Upcoming_Payment_Reminder::set_merge_data( string $code )

Replace merge codes with actual values.


Parameters Parameters

$code

(string) (Required) The merge code to get merged data for.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/notifications/views/class.llms.notification.view.upcoming.payment.reminder.php

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
protected function set_merge_data( $code ) {
 
    $order = $this->post;
 
    switch ( $code ) {
 
        case '{{CUSTOMER_ADDRESS}}':
            $code = $order->get_customer_full_address();
            break;
 
        case '{{CUSTOMER_NAME}}':
            $code = $order->get_customer_name();
            break;
 
        case '{{CUSTOMER_PHONE}}':
            $code = $order->get( 'billing_phone' );
            break;
 
        case '{{NEXT_PAYMENT_DATE}}':
            $code = $order->get_date( 'date_next_payment', get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) );
            break;
 
        case '{{ORDER_ID}}':
            $code = $order->get( 'id' );
            break;
 
        case '{{ORDER_URL}}':
            $code = esc_url( $order->get_view_link() );
            break;
 
        case '{{PAYMENT_AMOUNT}}':
            $code = $order->get_price( 'total' );
            break;
 
        case '{{PLAN_TITLE}}':
            $code = $order->get( 'plan_title' );
            break;
 
        case '{{PRODUCT_TITLE}}':
            $code = $order->get( 'product_title' );
            break;
 
        case '{{PRODUCT_TITLE_LINK}}':
            $permalink = esc_url( get_permalink( $order->get( 'product_id' ) ) );
            if ( $permalink ) {
                $title = $this->set_merge_data( '{{PRODUCT_TITLE}}' );
                $code  = '<a href="' . $permalink . '">' . $title . '</a>';
            }
            break;
 
        case '{{PRODUCT_TYPE}}':
            $obj = $order->get_product();
            if ( empty( $obj ) ) {
                $code = __( '[DELETED ITEM]', 'lifterlms' );
            } elseif ( is_a( $obj, 'WP_Post' ) ) {
                $code = _x( 'Item', 'generic product type description', 'lifterlms' );
            } else {
                $code = $obj->get_post_type_label( 'singular_name' );
            }
            break;
 
    }
 
    return $code;
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.4.0 Account for deleted products.
5.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.