File: /mnt/data/dev/dev-mentoring-wp/wp-content/plugins/mentoring/init.php
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link https://themeforest.net/user/dreamstechnologies/portfolio
* @since 1.0
* @package mentoring Core
*
* @wordpress-plugin
* Plugin Name: Mentoring
* Description: This plugin is used for creating custom post types and other functionality for mentoring Theme
* Version: 1.2.9
* Author: Dreams Technologies
* Author URI: #
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: mentoring_core
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if( !function_exists( 'mentoring_load_last' ) ) {
function mentoring_load_last() {
$wp_path_to_this_file = preg_replace('/(.*)plugins\/(.*)$/', WP_PLUGIN_DIR."/$2", __FILE__);
$this_plugin = plugin_basename(trim($wp_path_to_this_file));
$active_plugins = get_option('active_plugins');
$this_plugin_key = array_search($this_plugin, $active_plugins);
array_splice($active_plugins, $this_plugin_key, 1);
array_push($active_plugins, $this_plugin);
update_option('active_plugins', $active_plugins);
}
add_action("activated_plugin", "mentoring_load_last");
}
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-elevator-activator.php
*/
if( !function_exists( 'activate_mentoring' ) ) {
function activate_mentoring() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-system-activator.php';
mentoring_Activator::activate();
}
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-elevator-deactivator.php
*/
if( !function_exists( 'deactivate_mentoring' ) ) {
function deactivate_mentoring() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-system-deactivator.php';
mentoring_Deactivator::deactivate();
}
}
register_activation_hook( __FILE__, 'activate_mentoring' );
register_deactivation_hook( __FILE__, 'deactivate_mentoring' );
/**
* Plugin configuration file,
* It include getter & setter for global settings
*/
require plugin_dir_path( __FILE__ ) . 'config.php';
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-system.php';
require plugin_dir_path( __FILE__ ) . 'chat/class-chat-system.php';
include mentoring_template_exsits( 'hooks/hooks' );
include mentoring_template_exsits( 'helpers/EmailHelper' );
include mentoring_template_exsits( 'shortcodes/class-authentication' );
include mentoring_template_exsits( 'libraries/mailchimp/class-mailchimp' );
require plugin_dir_path( __FILE__ ) . 'widgets/config.php';
require plugin_dir_path( __FILE__ ) . 'libraries/mailchimp/class-mailchimp-oath.php';
require plugin_dir_path( __FILE__ ) . 'helpers/register.php';
require plugin_dir_path( __FILE__ ) . 'admin/metaboxes/classes/class-metaboxes.php';
require plugin_dir_path( __FILE__ ) . 'admin/metaboxes/classes/class-form-attributes.php';
require plugin_dir_path( __FILE__ ) . 'demo-import/importer.php';
/**
* Get template from plugin or theme.
*
* @param string $file Template file name.
* @param array $param Params to add to template.
*
* @return string
*/
function mentoring_template_exsits( $file, $param = array() ) {
extract( $param );
if ( is_dir( get_stylesheet_directory() . '/extend/' ) ) {
if ( file_exists( get_stylesheet_directory() . '/extend/' . $file . '.php' ) ) {
$template_load = get_stylesheet_directory() . '/extend/' . $file . '.php';
} else {
$template_load = mentoringGlobalSettings::get_plugin_path() . '/' . $file . '.php';
}
} else {
$template_load = mentoringGlobalSettings::get_plugin_path() . '/' . $file . '.php';
}
return $template_load;
}
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
if( !function_exists( 'run_mentoring' ) ) {
function run_mentoring() {
$plugin = new mentoring();
$plugin->run();
}
run_mentoring();
}
/**
* @init Save rewrite slugs
* @package Rewrite Slug
* @subpackage combo-wp-rewrite-slugs/admin/partials
* @since 1.0
* @desc This Function Will Produce All Tabs View.
*/
if (!function_exists('mentoring_set_custom_rewrite_rule')) {
function mentoring_set_custom_rewrite_rule() {
global $wp_rewrite;
$settings = (array) mentoring_get_theme_settings();
if( !empty( $settings['post'] ) ){
foreach ( $settings['post'] as $post_type => $slug ) {
if(!empty( $slug )){
$args = get_post_type_object($post_type);
$args->rewrite["slug"] = $slug;
register_post_type($args->name, $args);
}
}
}
if( !empty( $settings['term'] ) ){
foreach ( $settings['term'] as $term => $slug ) {
if(!empty( $slug ) ){
$tax = get_taxonomy($term);
$tax->rewrite["slug"] = $slug;
register_taxonomy($term, $tax->object_type[0],(array)$tax);
}
}
}
$wp_rewrite->flush_rules();
}
add_action('init', 'mentoring_set_custom_rewrite_rule');
}
/**
* Load plugin textdomain.
*
* @since 1.0.0
*/
add_action('wp_loaded', 'mentoring_load_textdomain');
function mentoring_load_textdomain() {
load_plugin_textdomain( 'mentoring_core', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
add_action( 'widgets_init', 'mentoring_register_widget' );
function mentoring_register_widget() {
register_widget( 'Mentoring_Widget_Recent_Posts' );
}
/**
* Upload temp files to WordPress media
*
* @throws error
* @author Dreams Technologies<[email protected]>
* @return
*/
if (!function_exists('mentoring_temp_upload_to_media')) {
function mentoring_temp_upload_to_media($file_url, $post_id) {
global $wp_filesystem;
if (empty($wp_filesystem)) {
require_once (ABSPATH . '/wp-admin/includes/file.php');
WP_Filesystem();
}
$json = array();
$upload_dir = wp_upload_dir();
$folderRalativePath = $upload_dir['baseurl']."/mentoring-temp";
$folderAbsolutePath = $upload_dir['basedir']."/mentoring-temp";
$args = array(
'timeout' => 15,
'headers' => array('Accept-Encoding' => ''),
'sslverify' => false
);
$response = wp_remote_get( $file_url, $args );
$file_data = wp_remote_retrieve_body($response);
if(empty($file_data)){
$json['attachment_id'] = '';
$json['url'] = '';
$json['name'] = '';
return $json;
}
$filename = basename($file_url);
if (wp_mkdir_p($upload_dir['path'])){
$file = $upload_dir['path'] . '/' . $filename;
} else {
$file = $upload_dir['basedir'] . '/' . $filename;
}
//Rename file before update
if (file_exists($file)) {
$i = 1;
$new_path = $file;
while (file_exists($new_path)) {
$extension = pathinfo($file, PATHINFO_EXTENSION);
$actual_filename = pathinfo($file, PATHINFO_FILENAME);
$new_filename = $actual_filename . '-' . $i . '.' . $extension;
$new_path = $upload_dir['path'] . '/' . $new_filename;
$i++;
}
$file = $new_path;
}
$filename = basename($file);
$actual_filename = pathinfo($file, PATHINFO_FILENAME);
//put content to the file
file_put_contents($file, $file_data);
$wp_filetype = wp_check_filetype($filename, null);
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_title' => sanitize_file_name($actual_filename),
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment($attachment, $file, $post_id);
require_once(ABSPATH . 'wp-admin/includes/image.php');
$attach_data = wp_generate_attachment_metadata($attach_id, $file);
wp_update_attachment_metadata($attach_id, $attach_data);
$json['attachment_id'] = $attach_id;
$json['url'] = $upload_dir['url'] . '/' . basename( $filename );
$json['name'] = $filename;
$target_path = $folderAbsolutePath . "/" . $filename;
unlink($target_path); //delete file after upload
return $json;
}
}
/**
* Get Booking meta
*
* @throws error
* @author Dreams Technologies<[email protected]>
* @return
*/
if (!function_exists('mentoring_get_booking_value')) {
function mentoring_get_booking_value($val='',$key='' ,$cart_data = '') {
if( !empty($key) && $key === 'institute' ) {
global $mentoring_options;
$posttype = get_post_type($val);
if( !empty($posttype) && $posttype === 'institute_team' ){
$institute_id = get_post_meta($val,'institute_id',true);
$val = esc_html( get_the_title( $institute_id ) );
} else {
$val = esc_html( get_the_title( $val ) );
}
} else if( $key === 'mentor_id' ) {
$val = mentoring_full_name( $val );
} else if( $key === 'slots' ) {
$time_format = get_option('time_format');
$slot_key_val = explode('-', $val);
$val = date($time_format, strtotime('2016-01-01' . $slot_key_val[0]) );
}else if( $key === 'consultant_fee' || $key === 'price' ) {
$val = mentoring_price_format($val,'return');
} else if( $key === 'myself' ) {
$val = !empty($val) && $val === 'someelse' ? esc_html__('Other Person','mentoring') : esc_html__('My Self','mentoring');
}
return $val;
}
}
/**
* load booking
*
* @throws error
* @author Dreams Technologies<[email protected]>
* @return
*/
if ( !function_exists( 'mentoring_get_booking_byID' ) ) {
function mentoring_get_booking_byID() {
global $current_user,$mentoring_options;
$json = array();
$booking_id = !empty( $_POST['id'] ) ? intval( $_POST['id'] ) : '';
$is_dashboard = !empty( $_POST['dashboard'] ) ? esc_html( $_POST['dashboard'] ) : '';
$is_type = !empty( $_POST['type'] ) ? esc_html( $_POST['type'] ) : '';
$hide_prescription = !empty( $mentoring_options['hide_prescription'] ) ? esc_html( $mentoring_options['hide_prescription'] ) : 'no';
$url_identity = $current_user->ID;
if( function_exists('mentoring_validate_user') ) {
mentoring_validate_user();
} //if user is logged in
if(!empty($is_type) && $is_type === 'mentee') {
if( function_exists('mentoring_validate_privileges') ) {
mentoring_validate_privileges($booking_id);
} //if user is logged in and have privileges
}else if(!empty($is_type) && $is_type === 'mentor') {
$mentor_id = get_post_meta($booking_id,'_mentor_id', true);
$mentor_user_id = mentoring_get_linked_profile_id($mentor_id,'post');
if( isset($mentor_user_id) && intval( $mentor_user_id ) !== $current_user->ID ){
$json['type'] = 'error';
$json['message'] = esc_html__('You are not authorized to view this booking details', 'mentoring');
wp_send_json( $json );
}
}else{
if(!is_admin()){
$data = get_userdata($current_user->ID);
if(isset($data->roles) && is_array($data->roles) && in_array('administrator',$data->roles)){
//do nothing
}else{
$json['type'] = 'error';
$json['message'] = esc_html__('You are not authorized to view this booking details', 'mentoring');
wp_send_json( $json );
}
}
}
//security check
$do_check = check_ajax_referer('ajax_nonce', 'security', false);
if ( $do_check == false ) {
$json['type'] = 'error';
$json['message'] = esc_html__('Security check failed, this could be because of your browser cache. Please clear the cache and check it againe', 'mentoring');
wp_send_json( $json );
}
$width = 100;
$height = 100;
$current_user_type = apply_filters('mentoring_get_user_type', $url_identity );
if(!empty($booking_id)) {
ob_start();
$date_format = get_option('date_format');
$time_format = get_option('time_format');
$mentor_id = get_post_meta($booking_id,'_mentor_id', true);
$booking_date = get_post_meta($booking_id,'_am_booking', true);
$institute_id = get_post_meta($booking_id,'_booking_institute', true);
$slots = get_post_meta($booking_id,'_booking_slot', true);
$slots = !empty( $slots ) ? explode('-', $slots) : '';
$tine_slot = $slots;
if( !empty( $slots ) ) {
$slots = date( $time_format,strtotime('2016-01-01' . $slots[0]) );
}
$user_types = mentoring_list_user_types();
$content = get_post_field('post_content',$booking_id );
$contents = !empty( $content ) ? $content : '';
$booking_slot = get_post_meta($booking_id,'_booking_slot', true);
$booking_slot = !empty( $booking_slot ) ? $booking_slot : '';
$services = get_post_meta($booking_id,'_booking_service', true);
$services = !empty( $services ) ? $services : array();
$post_auter = get_post_field( 'post_author',$booking_id );
$booking_user_type = get_post_meta( $booking_id,'_user_type',true);
$thumbnail = '';
$booking_array = get_post_meta( $booking_id, '_am_booking',true);
$total_price = !empty($booking_array['_price']) ? $booking_array['_price'] : 0;
$consultant_fee = !empty($booking_array['_consultant_fee']) ? $booking_array['_consultant_fee'] : 0;
if( empty($booking_user_type) || $booking_user_type ==='mentee' ){
$link_id = mentoring_get_linked_profile_id( $post_auter );
$thumbnail = mentoring_prepare_thumbnail($link_id, $width, $height);
$user_type = apply_filters('mentoring_get_user_type', $post_auter );
$user_type = $user_types[$user_type];
$user_type = !empty( $user_type ) ? $user_type : '';
$location = mentoring_get_location($link_id);
$country = !empty( $location['_country'] ) ? $location['_country'] : '';
} else {
$am_booking = get_post_meta( $booking_id,'_am_booking',true);
$user_type = !empty($am_booking['_user_details']['user_type']) ? $am_booking['_user_details']['user_type'] : '';
}
$name = get_post_meta($booking_id,'bk_username', true);
$email = get_post_meta($booking_id,'bk_email', true);
$phone = get_post_meta($booking_id,'bk_phone', true);
$name = !empty($name) ? $name : '';
$email = !empty($email) ? $email : '';
$phone = !empty($phone) ? $phone : '';
$post_status = get_post_status( $booking_id );
$post_status_key = $post_status;
if($post_status === 'pending'){
$post_status = esc_html__('Pending','mentoring');
} elseif($post_status === 'publish'){
$post_status = esc_html__('Confirmed','mentoring');
} elseif($post_status === 'draft'){
$post_status = esc_html__('Pending','mentoring');
} elseif($post_status === 'cancelled'){
$post_status = esc_html__('Cancelled','mentoring');
}
$relation = mentoring_mentee_relationship();
$posttype = get_post_type($institute_id);
if( !empty($posttype) && $posttype === 'institute_team' ){
$institute_id = get_post_meta($institute_id,'institute_id',true);
$location_title = esc_html( get_the_title( $institute_id ) );
} else {
$location_title = esc_html( get_the_title( $institute_id ) );
}
$am_courses = mentoring_get_post_meta( $mentor_id,'am_courses');
$am_courses = !empty( $am_courses ) ? $am_courses : array();
$google_calender = '';
$yahoo_calender = '';
$appointment_date = get_post_meta($booking_id,'_appointment_date', true);
if( !empty( $appointment_date ) && !empty( $tine_slot[0] ) && !empty( $tine_slot[1] ) ) {
$startTime = new DateTime($appointment_date.' '.$tine_slot[0]);
$startTime = $startTime->format('Y-m-d H:i');
$endTime = new DateTime($appointment_date.' '.$tine_slot[1]);
$endTime = $endTime->format('Y-m-d H:i');
$google_calender = mentoring_generate_GoogleLink($name,$startTime,$endTime,$contents,$location_title);
$yahoo_calender = mentoring_generate_YahooLink($name,$startTime,$endTime,$contents,$location_title);
}
$mentor_user_id = mentoring_get_linked_profile_id($mentor_id,'post');
if( !empty($user_type) && $user_type === 'mentees'){
$user_type_title = esc_html__('mentee','mentoring');
} else {
$user_type_title = $user_type;
}
$prescription_id = get_post_meta( $booking_id, '_prescription_id', true );
$prescription_url = !empty($booking_id) ? mentoring_Profile_Menu::mentoring_profile_menu_link('prescription', $current_user->ID,true,'view').'&booking_id='.$booking_id : '';
$user_type_access = apply_filters('mentoring_get_user_type', $current_user->ID );
?>
<div class="dc-user-header">
<?php if( !empty( $thumbnail ) ){?>
<div>
<figure class="dc-user-img">
<img src="<?php echo esc_url( $thumbnail );?>" alt="<?php echo esc_attr( $name );?>">
</figure>
</div>
<?php } ?>
<div class="dc-title userview-details">
<span class="pateint-details"><?php echo esc_html( ucfirst( $user_type_title ) );?></span>
<?php if( !empty( $name ) ){?>
<h3>
<?php
echo esc_html( $name );
if(!empty($post_auter) && $post_auter !=1 ){
mentoring_get_verification_check($post_auter);
}
?>
</h3>
<h5>
<?php if( !empty($email) ){?>
<i class="fas fa-envelope"></i> <?php echo esc_html($email);?>
<?php } ?>
</h5>
<h5>
<?php if( !empty($phone) ){?>
<i class="fas fa-phone"></i> <?php echo esc_html($phone);?>
<?php } ?>
</h5>
<?php } ?>
<h5>
<?php if(!empty($post_auter) && $post_auter !=1 ){ ?>
<i class="fas fa-map-marker-alt"></i><?php echo esc_html( $country );?>
<?php } ?>
</h5>
</div>
<?php if( !empty( $post_status ) ){ ?>
<div class="dc-status-test">
<div class="dc-rightarea dc-status">
<span><?php echo esc_html(ucwords( $post_status ) );?></span>
<em><?php esc_html_e('Status','mentoring');?></em>
<!-- status links -->
<?php if ( is_user_logged_in() && ( $user_type_access === 'mentors' || $user_type_access === 'institute' || $user_type_access === 'mentee' ) ) {?>
<div class="dc-user-steps">
<div class="dc-btnarea toolip-wrapo dc-print-options">
<?php if( !empty( $booking_id ) && !empty( $current_user_type ) && $current_user_type != 'mentee' ) {
if( $post_status_key === 'pending' ){?>
<a href="javascript:;" class="dc-btn dc-update-status btn btn-sm bg-success-light" data-status="publish" data-id="<?php echo intval($booking_id);?>"><i class="fas fa-check"></i><?php esc_html_e('Accept','mentoring');?></a>
<a href="javascript:;" class="dc-btn dc-deleteinfo dc-update-status btn btn-sm bg-danger-light" data-status="cancelled" data-id="<?php echo intval($booking_id);?>"><i class="fas fa-times"></i><?php esc_html_e('Cancel','mentoring');?></a>
<?php }
} else if( $is_dashboard === 'yes' && !empty( $current_user_type ) && $current_user_type === 'mentee' && apply_filters('mentoring_is_feature_allowed', 'dc_chat', $mentor_user_id) === true ){?>
<?php if( !empty($prescription_id) ){ ?>
<form method="post" name="download_pdf">
<input type="hidden" name="pdf_booking_id" value="<?php echo intval($booking_id);?>">
<a href="javascript:;" onclick="document.forms['download_pdf'].submit(); return false;" class="dc-btn dc-pdfbtn"><i class="ti-download"></i></a>
</form>
<?php } ?>
<?php } ?>
</div>
</div>
<?php }?>
<!-- ends status links -->
</div>
</div>
<?php } ?>
</div>
<div class="dc-user-details">
<div class="dc-user-grid">
<?php if( !empty( $booking_date['_with_mentee']['other_name'] ) ){?>
<div class="dc-user-info dc-person-mentee">
<div class="dc-title">
<h4><?php esc_html_e('Person with mentee','mentoring');?> :</h4>
<span><?php echo esc_html( $booking_date['_with_mentee']['other_name'] );?></span>
</div>
</div>
<?php } ?>
<?php if( !empty( $booking_date['_with_mentee']['relation'] ) ){?>
<div class="dc-user-info dc-person-relation">
<div class="dc-title">
<h4><?php esc_html_e('Relation with mentee','mentoring');?> :</h4>
<span><?php echo esc_html( $relation[$booking_date['_with_mentee']['relation']] );?></span>
</div>
</div>
<?php } ?>
<?php if( !empty( $location_title ) ){?>
<div class="dc-user-info dc-location-title">
<div class="dc-title">
<h4><?php esc_html_e('Appointment location','mentoring');?> :</h4>
<span><?php echo esc_html( $location_title );?></span>
</div>
</div>
<?php } ?>
<?php if( !empty( $appointment_date ) && !empty( $slots ) ){?>
<div class="dc-user-info dc-apt-detail-date">
<div class="dc-title">
<h4><?php esc_html_e('Appointment date','mentoring');?> :</h4>
<span><?php echo date_i18n( $date_format,strtotime( $appointment_date ) );?> - <?php echo esc_html($slots);?> </span>
</div>
</div>
<?php } ?>
<?php if( !empty( $services ) ) {?>
<div class="dc-user-info dc-info-required dc-services-wrap">
<div class="dc-title">
<h4><?php esc_html_e('Services required','mentoring');?>:</h4>
</div>
<?php
foreach( $services as $spe => $sers) {
if( !empty( $spe ) ){ ?>
<div class="dc-spec-wrap">
<div class="dc-title">
<span><?php echo mentoring_get_term_name( $spe ,'courses');?></span>
</div>
<?php if( !empty( $sers ) ){?>
<ul class="dc-required-details">
<?php foreach( $sers as $k => $val) {
$single_price = 0;
if( !empty($k) && $k === $val ){
$am_courses = !empty($mentor_id) ? mentoring_get_post_meta( $mentor_id,'am_courses') : array();
$am_courses = !empty( $am_courses ) ? $am_courses : array();
$single_price = !empty($am_courses[$spe][$k]['price']) ? $am_courses[$spe][$k]['price'] : 0;
} else {
$single_price = $val;
}
?>
<li>
<span>
<?php
echo mentoring_get_term_name( $k ,'services');
if( !empty($single_price)){ ?>
<em>(<?php mentoring_price_format($single_price);?>)</em>
<?php } ?>
</span>
</li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
</div>
<?php }?>
<?php if( !empty( $contents ) ){ ?>
<div class="dc-required-info dc-apt-comments">
<div class="dc-title">
<h4><?php esc_html_e('Comments','mentoring');?></h4>
</div>
<div class="dc-description"><p><?php echo esc_html( $contents );?></p></div>
</div>
<?php } ?>
<?php if(isset($consultant_fee)){?>
<div class="dc-user-info dc-apt-consult-fee">
<div class="dc-title">
<h4><?php esc_html_e('Consultant fee','mentoring');?> :</h4>
<span><?php mentoring_price_format($consultant_fee);?></span>
</div>
</div>
<?php } ?>
<?php if( !empty( $total_price ) ){?>
<div class="dc-user-info dc-total-fee">
<div class="dc-title">
<h4><?php esc_html_e('Total price','mentoring');?>:</h4>
<span>
<?php mentoring_price_format($total_price);?>
</span>
</div>
</div>
<?php } ?>
</div>
</div>
<!-- Modal -->
<div class="modal fade dc-appointmentpopup dc-feedbackpopup dc-bookappointment" role="dialog" id="send_message">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="dc-modalcontent modal-content">
<div class="dc-popuptitle">
<h3><?php esc_html_e('Send Message','mentoring');?></h3>
<a href="javascript:;" class="dc-closebtn close dc-close" data-dismiss="modal" aria-label="<?php esc_attr_e('Close','mentoring');?>"><i class="ti-close"></i></a>
</div>
<div class="dc-formtheme dc-vistingdocinfo">
<fieldset>
<div class="form-group">
<textarea id="dc-booking-msg" class="form-control" placeholder="<?php esc_attr_e('Message','mentoring');?>" name="message"></textarea>
</div>
</fieldset>
</div>
<div class="modal-footer dc-modal-footer">
<a href="javascript:;" class="btn dc-btn btn-primary dc-send_message-btn" data-id="<?php echo intval($booking_id);?>"><?php esc_html_e('Send','mentoring');?></a>
</div>
</div>
</div>
</div>
<?php
$booking = ob_get_clean();
$json['type'] = 'success';
$json['booking_data'] = $booking;
} else{
$json['type'] = 'error';
$json['message'] = esc_html__('No more review', 'mentoring');
$json['reviews'] = 'null';
}
wp_send_json($json);
}
add_action( 'wp_ajax_mentoring_get_booking_byID', 'mentoring_get_booking_byID' );
add_action( 'wp_ajax_nopriv_mentoring_get_booking_byID', 'mentoring_get_booking_byID' );
}
/**
* Add New User Roles
*
* @throws error
* @author Dreams Technologies <[email protected]>
* @return string
*/
if (!function_exists('mentoring_add_user_roles')) {
function mentoring_add_user_roles() {
global $mentoring_options;
add_role('mentors', esc_html__('Mentor', 'mentoring'));
add_role('mentee', esc_html__('Mentee', 'mentoring'));
add_role('institute', esc_html__('institute', 'mentoring'));
}
add_action('admin_init', 'mentoring_add_user_roles');
}