Hello @ihor, Following your reply, I am making my request on the forum :
I had ordered this custom plugin for sending sms notifications and I never managed to get it to work. I bought a new number today to reinstall it…Finally, I think I know why sms notifications weren’t working, probably because when a user registers they don’t fill in their phone number, it’s only compulsory when a host (vendor) adds their ad (there’s a compulsory tel attribute) and for the traveller user : he fills in his phone number when he makes a booking request: can you adapt the lines so that it retrieves the phone numbers of vendors and users: knowing that in my case this code retrieves this information (here’s the error I got with twilio (attached)
) and (I had customised my booking dashboard with this code):
// Ajouter des colonnes à la page des réservations
function custom_booking_columns($columns) {
$new_columns = array();
foreach ($columns as $key => $value) {
$new_columns[$key] = $value;
if ('title' === $key) {
$new_columns['hp_vendor'] = __('Hôte', 'text-domain');
$new_columns['hp_vendor_email'] = __('Email', 'text-domain');
$new_columns['hp_vendor_phone'] = __('Téléphone', 'text-domain');
$new_columns['booking_date'] = __('Date', 'text-domain');
}
}
$new_columns['user_email'] = __('Email du compte', 'text-domain');
$new_columns['user_phone'] = __('Téléphone utilisateur', 'text-domain');
return $new_columns;
}
add_filter('manage_edit-hp_booking_columns', 'custom_booking_columns');
// Afficher le contenu des colonnes correspondantes
function custom_booking_column_content($column, $post_id) {
if ('hp_vendor' === $column) {
$annonce_id = wp_get_post_parent_id($post_id);
$hote_id = get_post_field('post_author', $annonce_id);
$hote_name = get_the_author_meta('display_name', $hote_id);
echo esc_html($hote_name);
}
if ('hp_vendor_email' === $column) {
$annonce_id = wp_get_post_parent_id($post_id);
$hote_id = get_post_field('post_author', $annonce_id);
$hote_email = get_the_author_meta('user_email', $hote_id);
echo '<a href="mailto:' . esc_attr($hote_email) . '">' . esc_html($hote_email) . '</a>';
}
if ('hp_vendor_phone' === $column) {
$annonce_id = wp_get_post_parent_id($post_id);
$phone = get_post_meta($annonce_id, 'hp_tel', true);
if (!empty($phone)) {
echo '<a href="tel:' . esc_attr($phone) . '">' . esc_html($phone) . '</a>';
} else {
echo '-';
}
}
if ('user_email' === $column) {
$user_id = get_post_field('post_author', $post_id);
$user_email = get_the_author_meta('user_email', $user_id);
echo '<a href="mailto:' . esc_attr($user_email) . '">' . esc_html($user_email) . '</a>';
}
if ('user_phone' === $column) {
$user_phone = get_post_meta($post_id, 'hp_tel_user', true);
if (!empty($user_phone)) {
echo '<a href="tel:' . esc_attr($user_phone) . '">' . esc_html($user_phone) . '</a>';
} else {
echo '-';
}
}
if ('booking_date' === $column) {
$booking_date = get_the_date('d/m/Y', $post_id);
echo esc_html($booking_date);
}
}
add_action('manage_hp_booking_posts_custom_column', 'custom_booking_column_content', 10, 2);