nts = ( new EmailData() )->get_recipients();
if ( null === $key ) {
$new_array = array();
foreach ( $recipients as $recipient ) {
$new_array = array_merge( $new_array, $recipient );
}
return $new_array;
}
$admin_url = admin_url( 'admin.php' );
$array = $recipients[ $key ];
$fields = array();
foreach ( $recipients[ $key ] as $event => $mail ) {
$tooltip = ( isset( $mail['tooltip'] ) && ! empty( $mail['tooltip'] ) ) ? $mail['tooltip'] : null;
$email_edit_url = add_query_arg(
array(
'page' => 'tutor_settings',
'tab_page' => 'email_notification',
'edit' => $event,
'to' => $key,
),
$admin_url
);
$fields[] = array(
'key' => $key,
'event' => $event,
'type' => 'toggle_switch_button',
'label' => $mail['label'],
'template' => $mail['template'],
'tooltip' => $tooltip,
'default' => isset( $mail['default'] ) ? esc_attr( $mail['default'] ) : esc_attr( 'off' ),
'buttons' => array(
'edit' => array(
'type' => 'anchor',
'text' => __( 'Edit', 'tutor-pro' ),
'url' => $email_edit_url,
),
),
);
}
return $fields;
}
/**
* Email option and types
*
* @since 2.0.0
*
* @param mixed $attr attributes.
*
* @return array
*/
public function add_options( $attr ) {
$template_path = null;
$template_data = null;
if ( 'settings' === Input::get( 'edit' ) ) {
$template_path = TUTOR_EMAIL()->path . '/views/pages/settings.php';
}
if ( 'mailer' === Input::get( 'edit' ) ) {
$template_path = TUTOR_EMAIL()->path . '/views/pages/mailer.php';
}
if ( Input::has( 'edit' ) && ! in_array( Input::get( 'edit' ), array( 'settings', 'mailer' ), true ) ) {
$template_path = TUTOR_EMAIL()->path . '/views/pages/email-edit.php';
$to = Input::get( 'to' );
$edit = Input::get( 'edit' );
if ( 'email_to_students' === $to ) {
$to_readable = __( 'Email to Student', 'tutor-pro' );
} elseif ( 'email_to_teachers' === $to ) {
$to_readable = __( 'Email to Instructor', 'tutor-pro' );
} elseif ( 'email_to_admin' === $to ) {
$to_readable = __( 'Email to Admin', 'tutor-pro' );
} else {
$to_readable = ucwords( str_replace( '_', ' ', $to ) );
}
$template_data = array(
'to' => $to,
'key' => $edit,
'edit' => $edit,
'to_readable' => $to_readable,
'mail' => $this->get_recipient_array()[ $edit ],
'back_url' => add_query_arg(
array(
'page' => 'tutor_settings',
'tab_page' => 'email_notification',
),
admin_url( 'admin.php' )
),
);
$placeholders = array();
if ( isset( $template_data['mail']['placeholders'] ) && is_array( $template_data['mail']['placeholders'] ) ) {
$placeholders = array_values( $template_data['mail']['placeholders'] );
}
wp_localize_script( 'tutor-pro-email-template', '_tutorEmailPlaceholders', $placeholders );
}
$attr['email_notification'] = array(
'label' => __( 'Email', 'tutor-pro' ),
'slug' => 'email_notification',
'desc' => '',
'template' => 'basic',
'icon' => 'tutor-icon-envelope',
'template_path' => $template_path,
'edit_email_data' => $template_data,
'blocks' => array(
array(
'label' => null,
'slug' => 'email-settings-options',
'block_type' => 'custom',
'placement' => 'before',
'template_path' => TUTOR_EMAIL()->path . 'views/email-settings-options.php',
),
array(
'label' => __( 'Email to Students', 'tutor-pro' ),
'slug' => 'email_to_students',
'block_type' => 'uniform',
'fields' => $this->get_recipient_array( 'email_to_students' ),
),
array(
'label' => __( 'Email to Instructors', 'tutor-pro' ),
'slug' => 'email_to_teachers',
'block_type' => 'uniform',
'fields' => $this->get_recipient_array( 'email_to_teachers' ),
),
array(
'label' => __( 'Email to Admin', 'tutor-pro' ),
'slug' => 'email_to_admin',
'block_type' => 'uniform',
'fields' => $this->get_recipient_array( 'email_to_admin' ),
),
array(
'label' => __( 'Email Cron Settings', 'tutor-pro' ),
'slug' => 'email_sending',
'block_type' => 'uniform',
'fields' => array(
array(
'key' => 'tutor_email_disable_wpcron',
'label' => __( 'WP Cron for Bulk Mailing', 'tutor-pro' ),
'type' => 'toggle_switch',
'default' => 'off',
'desc' => __( 'Enable this option to let Tutor LMS use WordPress native scheduler for email sending activities', 'tutor-pro' ),
),
array(
'key' => 'tutor_email_cron_frequency',
'label' => __( 'WP Email Cron Frequency', 'tutor-pro' ),
'type' => 'number',
'min' => 10,
'default' => 300,
'desc' => __( 'Add the frequency mode in Second(s) which the Cron Setup will run', 'tutor-pro' ),
),
array(
'key' => 'tutor_bulk_email_limit',
'label' => __( 'Email Per Cron Execution', 'tutor-pro' ),
'type' => 'number',
'number_type' => 'integer',
'min' => 1,
'default' => 10,
'desc' => __( 'Number of emails you\'d like to send per cron execution', 'tutor-pro' ),
),
),
),
),
);
return $attr;
}
}
Fatal error: Uncaught Error: Class 'TUTOR_EMAIL\Init' not found in /home/rahjooian/public_html/wp-content/plugins/tutor-pro/addons/tutor-email/tutor-email.php:62
Stack trace:
#0 /home/rahjooian/public_html/wp-content/plugins/tutor-pro/classes/Init.php(238): include_once()
#1 /home/rahjooian/public_html/wp-content/plugins/tutor-pro/classes/Init.php(112): TUTOR_PRO\Init->load_addons()
#2 /home/rahjooian/public_html/wp-includes/class-wp-hook.php(324): TUTOR_PRO\Init->load_constructors_asset('')
#3 /home/rahjooian/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#4 /home/rahjooian/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /home/rahjooian/public_html/wp-content/plugins/tutor/classes/Tutor.php(545): do_action('tutor_loaded')
#6 /home/rahjooian/public_html/wp-content/plugins/tutor/classes/Tutor.php(437): TUTOR\Tutor->__construct()
#7 /home/rahjooian/public_html/wp-content/plugins/tutor/tutor.php(158): TUTOR\Tutor::instance()
#8 /home/rahjooian/public_html/wp-content/pl in /home/rahjooian/public_html/wp-content/plugins/tutor-pro/addons/tutor-email/tutor-email.php on line 62