Title: Change form field meta programmatically
Last modified: August 31, 2016

---

# Change form field meta programmatically

 *  Resolved [Philex](https://wordpress.org/support/users/philex/)
 * (@philex)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/change-form-field-meta-programmatically/)
 * 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/](https://wordpress.org/plugins/ultimate-member/)

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

 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/change-form-field-meta-programmatically/#post-7444507)
 * 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](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/change-form-field-meta-programmatically/#post-7444508)
 * You can use the following code to retrieve the current user’s role:
 *     ```
       <?php
          $role = um_user('role');
       ?>
       ```
   
 * Regards,
 *  Thread Starter [Philex](https://wordpress.org/support/users/philex/)
 * (@philex)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/change-form-field-meta-programmatically/#post-7444590)
 * 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.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Philex](https://wordpress.org/support/users/philex/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/change-form-field-meta-programmatically/#post-7444590)
 * Status: resolved