Author: Jay

  • StayWithJay – ACF + WPForms Integration for Guest Data and Conditional Visibility

    StayWithJay – ACF + WPForms Integration for Guest Data and Conditional Visibility

    🛠 StayWithJay – ACF + WPForms Integration for Guest Data and Conditional Visibility

    Overview

    We have successfully connected WPForms (User Registration add-on) to ACF User Fields so that when a user registers, all key reservation details and entitlements (LaundryPaid, ListingID, ReservationCode, etc.) are saved directly on their WordPress user profile.

    This setup allows us to use conditional visibility rules (Otter Blocks, GenerateBlocks, etc.) to control what each guest sees when logged in, based on their stored user meta.

    In short: Every guest is now a profile with dynamic entitlements.


    ✅ Visibility Mapping Table

    ACF/User Field Condition Show/Hide Example
    LaundryPaid = true Reveal Laundry Code tile (button with code)
    VisitorPass = true Show Visitor Access instructions
    lastreservationcode matches active reservation Show “Active Stay Dashboard”
    listingID = property ID Show property-specific rules, guides, and codes
    smartlock_code not empty Show SmartLock instructions
    guest_count > 1 Show extra guest policy or fees
    platform = airbnb / direct / booking Adjust messaging (e.g., review link for Airbnb vs. direct booking incentives)

    ✅ FAQ – Next Steps & Clarifications

    Q1. How are user fields updated?
    👉 Using the WPForms User Registration add-on, mapped fields (phone, reservation code, listing ID, etc.) are stored as user meta when a new user is created.

    Q2. What about forms that don’t register users (like laundry pass payments, upsells, or contact forms)?
    👉 By default, they don’t update user meta. To make them update ACF fields for logged-in users:

    • Use Zapier integration, or
    • Add a WPCode snippet (see below) hooked into wpforms_process_complete to update user meta directly.

    Q3. Can a button (without a form) update ACF fields?
    👉 Not directly. A button would need to fire an AJAX or PHP function that runs update_user_meta() / update_field() for the logged-in user. This is possible but requires custom code.

    Q4. How do we handle coupons or promos?
    👉 Add a field like has_coupon. When a guest clicks “Yes” to claim a coupon, update their user meta. The Promotions page can then show active coupons only to users with has_coupon = true.

    Q5. How do we handle multiple reservations per user?
    👉 Currently, we overwrite lastreservationcode. For a full reservation history, we’d add a repeater field in ACF or use a separate “Reservations” CPT linked to the user.

    Q6. Can we consolidate the multiple check-in forms?
    👉 Yes. Since all forms now map to the same user meta structure, we can migrate toward a single dynamic check-in form. It would adjust what it shows/collects based on the user’s booking details (ListingID, guest_count, etc.), reducing maintenance across multiple forms.


    ✅ Code Example – Updating ACF/User Meta From Non-Registration Forms

    Drop this into WPCode or your theme’s functions.php. It ensures that if a logged-in user submits any WPForm, their ACF fields are updated with the submitted values.

    /**
     * Update user meta (ACF fields) after WPForms submission
     */
    add_action( 'wpforms_process_complete', function( $fields, $entry, $form_data, $entry_id ) {
    
        // Only proceed if user is logged in
        $user_id = get_current_user_id();
        if ( ! $user_id ) {
            return;
        }
    
        // Example: Laundry Paid toggle
        if ( isset( $fields[7]['value'] ) && $fields[7]['value'] === 'Long Term Laundry Pass' ) {
            update_user_meta( $user_id, 'LaundryPaid', true );
        }
    
        // Example: Reservation Code (field ID 2)
        if ( isset( $fields[2]['value'] ) ) {
            update_user_meta( $user_id, 'lastreservationcode', sanitize_text_field( $fields[2]['value'] ) );
        }
    
        // Example: Listing ID (field ID 3)
        if ( isset( $fields[3]['value'] ) ) {
            update_user_meta( $user_id, 'listingID', sanitize_text_field( $fields[3]['value'] ) );
        }
    
    }, 10, 4 );
    

    🔑 Replace 2, 3, 7 with the actual field IDs from your form builder. Each submitted field can update its corresponding ACF field on the user profile.


    ✅ Roadmap – Immediate Next Steps

    1. Finalize ACF Field List → confirm all required guest entitlements (LaundryPaid, VisitorPass, SmartLock, etc.).
    2. Map Existing Forms → ensure each WPForm is updating user meta consistently.
    3. Migrate Check-In Forms → start consolidating multiple check-in forms into a single dynamic form powered by conditional visibility + ACF user meta.
    4. Front-End Pages → build branded pages (Laundry Pass, Visitor Pass, Promotions) that reveal sections based on user meta.
    5. Coupons & Promotions → add has_coupon field + build Promotions page with conditional visibility.

    📌 Key Takeaway:
    We now have a single source of truth: ACF user fields.
    Forms → update fields → conditional visibility on front end → guests only see what they need.


     

  • Laundry Pass Code

    Laundry Pass Code

    Stay the Right Way with Jay

    Laundry usage must conclude one hour before quiet hours begin. (For example, if quiet hours start at 10:00 PM, laundry must be completed by 9:00 PM.)

    We appreciate your understanding and cooperation in maintaining a pleasant environment for all guests.