• Resolved Philex

    (@philex)


    Hi,

    I have an edit-profile-form, where users can fill out a textarea.
    The maximum amount of characters must be limited, according to the user’s role (basic: 200 chars, normal: 400 chars, premium: 800 chars).
    Now I don’t want to create a new form for each role, because the forms are all the same, except for the amount of chars in the textarea. Therefore I’m trying to do it via hooks or similar, but not really successful…

    Any idea on how I can achieve this?

    Thanks!

    https://wordpress.org/plugins/ultimate-member/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi,

    You can use this action hook ‘um_user_pre_updating_profile’ which passes an array of field data.

    add_action('um_user_pre_updating_profile','um_custom_user_pre_updating_profile');
    function um_custom_user_pre_updating_profile( $fields ){
    
            // var_dump( $fields ); die( 1 );
    
    }

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    You can use the following code to retrieve the current user’s role:

    <?php
       $role = um_user('role');
    ?>

    Regards,

    Thread Starter Philex

    (@philex)

    Thank you, that helped me a lot! 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Change form field meta programmatically’ is closed to new replies.