PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
automatorwp / integrations / bookingpress / includes / functions.php

functions.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.3, at integrations/bookingpress/includes/functions.php

63 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Functions
4 *
5 * @package AutomatorWP\Integrations\BookingPress\Functions
6 * @author AutomatorWP <[email protected]>, Ruben Garcia <[email protected]>
7 * @since 1.0.0
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Get the related WordPress user ID from a BookingPress customer ID.
14 *
15 * @since 1.0.0
16 *
17 * @param int $customer_id BookingPress customer ID.
18 *
19 * @return int WordPress user ID or 0 when there is no linked account.
20 */
21 function automatorwp_bookingpress_get_wp_user_id_from_customer_id( $customer_id ) {
22
23 global $wpdb;
24
25 $customer_id = absint( $customer_id );
26
27 if( empty( $customer_id ) ) {
28 return 0;
29 }
30
31 $customer_table = $wpdb->prefix . 'bookingpress_customers';
32 $wp_user_id = $wpdb->get_var(
33 $wpdb->prepare(
34 "SELECT bookingpress_wpuser_id FROM {$customer_table} WHERE bookingpress_customer_id = %d",
35 $customer_id
36 )
37 );
38
39 return absint( $wp_user_id );
40
41 }
42
43 /**
44 * Get BookingPress customer data
45 *
46 * @since 1.0.0
47 *
48 * @return array|false
49 */
50 function automatorwp_bookingpress_get_customer_data( $customer_id ) {
51
52 global $wpdb;
53
54 // Empty if no ID provided
55 if( absint( $customer_id ) === 0 ) {
56 return '';
57 }
58
59 $customer = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}bookingpress_customers WHERE bookingpress_customer_id = {$customer_id}" );
60
61 return $customer;
62
63 }