MP_Addon_SMS_Leads::lead_sms( mixed $post )
Lead Call Metabox.
Contents
Parameters Parameters
- $post
-
(mixed) (Required) post
Return Return
(mixed)
Source Source
File: calculator-sms-add-on/inc/MP_Addon_SMS_Leads.php
public function lead_sms( $post ) {
$phone = get_post_meta( $post->ID, MortgagePlatform::$prefix . 'lead_phone' ) ? get_post_meta( $post->ID, MortgagePlatform::$prefix . 'lead_phone', true ) : null;
$send_sms = isset( get_option( MortgagePlatform::$prefix . 'sms' )['send_sms_to_user'] ) ? get_option( MortgagePlatform::$prefix . 'sms' )['send_sms_to_user'] : false;
if ( $send_sms && $phone ) { ?>
<script>
if (jQuery('.send_message_tabs')) {
$tab = '<li data-tab="send_message_tab_phone"><?php esc_html_e( 'Send SMS', 'CalculatorSMSAddon' ); ?></li>';
jQuery('.send_message_tabs').append($tab);
}
</script>
<div class="send_message__wrapper" id="send_message_tab_phone">
<div class="sms_chat">
<?php
$sms = get_post_meta( $post->ID, MortgagePlatform::$prefix . 'sms' );
$user_name = get_post_meta( $post->ID, MortgagePlatform::$prefix . 'lead_first_name', true ) . ' ' . get_post_meta( $post->ID, MortgagePlatform::$prefix . 'lead_second_name', true );
foreach ( $sms as $message ) {
?>
<div class="sms_chat__<?php echo esc_attr( $message['from'] ); ?>">
<span class="sms_chat__name">
<?php
if ( 'user' === $message['from'] ) {
echo esc_attr( $user_name );
} else {
echo esc_attr( ucfirst( $message['from'] ) );
}
?>
</span>
<span class="sms_chat__date"><?php echo esc_attr( $message['date'] ); ?></span>
<p><?php echo esc_attr( $message['body'] ); ?></p>
</div>
<?php } ?>
</div>
<label><?php esc_html_e( 'Text SMS', 'CalculatorSMSAddon' ); ?>
<textarea name="send_message_phone_text" rows="5"></textarea>
</label>
<input type="hidden" name="send_message_phone" value="<?php echo esc_attr( $phone ); ?>">
<button data-leadid="<?php echo esc_attr( $post->ID ); ?>" id="send_sms_lead"
data-leadid="<?php echo esc_attr( $post->ID ); ?>"
class="button send_message_lead__button"><?php echo esc_html__( 'Send SMS', 'CalculatorSMSAddon' ); ?></button>
</div>
<?php
}
return $post;
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |