HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/dreamsrent-wp-demo/wp-content/themes/dreamsrent/inc/vendor-profile-fields.php
<?php

// Add PayPal email field to vendor profile
add_action('show_user_profile', 'vendor_paypal_field');
add_action('edit_user_profile', 'vendor_paypal_field');
function vendor_paypal_field($user) {
    if (!in_array('dreamsrent_vendor', (array) $user->roles)) return;
    ?>
    <h3>Vendor PayPal Settings</h3>
    <table class="form-table">
        <tr>
            <th><label for="vendor_paypal_email">PayPal Email</label></th>
            <td>
                <input type="email" name="vendor_paypal_email" value="<?php echo esc_attr(get_user_meta($user->ID, 'vendor_paypal_email', true)); ?>" class="regular-text" />
            </td>
        </tr>
    </table>
    <?php
}

// Save PayPal email
add_action('personal_options_update', 'save_vendor_paypal_email');
add_action('edit_user_profile_update', 'save_vendor_paypal_email');
function save_vendor_paypal_email($user_id) {
    if (current_user_can('edit_user', $user_id)) {
        update_user_meta($user_id, 'vendor_paypal_email', sanitize_email($_POST['vendor_paypal_email']));
    }
}

// // Basic test hook to verify the file is loading properly
// add_action('wp_footer', function() {
//     echo '<div style="text-align:center; padding:20px; background:#f0f0f0;">✅ PayPal Vendor Payment file is successfully loaded.</div>';
// });