1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89:
<?php
class Inbound_Automation_Lead_Profile {
public function __construct() {
self::add_hooks();
}
public static function add_hooks() {
add_action('add_meta_boxes', array(__CLASS__, 'define_metaboxes'));
add_action('save_post', array(__CLASS__, 'save_data'));
}
public static function define_metaboxes() {
global $post, $wp_meta_boxes;
if ($post->post_type != 'wp-lead') {
return;
}
$toggle = get_post_meta( $post->ID , 'inbound_automation_mute' );
add_meta_box('wplead-automation-emails-mute', __("Inbound Automation", 'inbound-pro'), array(__CLASS__, 'display_inbound_automation_settings'), 'wp-lead', 'side', 'low');
}
public static function display_inbound_automation_settings() {
global $post;
$toggle = get_post_meta( $post->ID , 'inbound_automation_mute' , true);
?>
<table>
<tr>
<td>
<?php _e('Mute all automation emails' , 'inbound-pro'); ?>
</td>
<td>
<input type="checkbox" name="inbound_automation_mute" <?php checked(true , $toggle);?> >
</td>
</tr>
</table>
<?php
}
public static function save_data($post_id) {
global $post;
if (!isset($post) || $post->post_type != 'wp-lead') {
return;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (isset($_POST['inbound_automation_mute'])) {
update_post_meta($post_id, 'inbound_automation_mute', (bool) $_POST['inbound_automation_mute']);
}
}
}
new Inbound_Automation_Lead_Profile;