Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gets user ID from contact ID
- *
- * @access public
- * @return int User ID
- */
- public function get_user_id( $contact_id ) {
- do_action( 'wpf_get_user_id_start', $contact_id );
- $user_id = apply_filters( 'wpf_user_id', false, $contact_id );
- if ( false !== $user_id ) {
- return $user_id; // Allow bypassing the database query
- }
- $users = get_users(
- array(
- 'meta_key' => wp_fusion()->crm->slug . '_contact_id',
- 'meta_value' => $contact_id,
- 'fields' => array( 'ID' ),
- )
- );
- if ( ! empty( $users ) ) {
- return apply_filters( 'wpf_user_id', $users[0]->ID, $contact_id );
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement