• Jumping to my real life scenario.

    In ‘My Account’ page I want to choose which fields would show up and can user edit them.

    In registration form I have ‘gender’ field.
    I want that info be editable in my account page. I made it ‘Can user edit this field’ to true.
    But it does not appear in ‘My Account’ page.

    What to do?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi joydipkar73,

    Unfortunately, this is not possible in the latest version. If you need to add custom page to the account page, you will need to hire a freelance developer to write this custom code to extend the functionality of the plugin.

    Thanks.

    Thread Starter joydipkar73

    (@joydipkar73)

    Well, I understand.
    But pls dont take it otherwise if I wonder why ‘Ultimate Member’ development team does not make it more flexible by adding more customizable options!
    Coz see 5 ‘No’ from your side is opening the opportunity for another plugin who will say ‘use our plugin’ … simply they are parallel to yours and ahead of that 5 ‘Yes’…

    Thnks anyway for your kind response.

    When someone gives you as a gift a horse, do you first check its teeth?

    So are you wanting the options you have in your registration page to show up on the “general” account page? If so, I too have been trying to find a way to do this. I have been going thought the code to see if there is a quick fix and I think I have found one.
    In the ultimate-member\core\um-account.php file. Find case ‘general’:
    under
    $fields = $ultimatemember->builtin->get_specific_fields( $args );

    add
    $um_fields = get_option(‘um_fields’);
    $fields = array_merge ( $fields, $um_fields);

    Now I have not fully tested this yet but for now it seems to work.

    There are a few issues so far. For one the fields do have the order that that is set in the registration form so for me the extra spaces and titles I added last are list at the bottom. I have not found how they store the ordering yet. I guess I could clear the form and re-enter the fields in the proper order.

    The other issue is the required fields are not being checked. I have found a way to have it check but you have to edit the um-actions-account.php code.

    find:
    /***
    *** @validate for errors in account page
    ***/
    add_action(‘um_submit_account_errors_hook’,’um_submit_account_errors_hook’);
    function um_submit_account_errors_hook( $args ) {
    global $ultimatemember;

    and under

    if ( email_exists( $_POST[‘user_email’] ) && email_exists( $_POST[‘user_email’] ) != get_current_user_id() ) {
    $ultimatemember->form->add_error(‘user_email’, __(‘Email already linked to another account’,’ultimatemember’) );
    }

    add your fields you want required; i.e.
    if ( isset($_POST[‘City’]) && ( strlen(trim( $_POST[‘City’] ) ) == 0 ) ) {
    $ultimatemember->form->add_error(‘City’, __(‘You must provide your City’,’ultimatemember’) );
    }

    It would be nice if they would just fix the thing. For now I’ll be looking at other plugins that may work more to my needs.

    Update/edit to my last post;

    You can add this code instead. It looks for all fields that are set required and sets the validation note. This way you don’t have to hand code each.

    $um_fields = get_option(‘um_fields’);
    foreach ($_POST as $key => $value){
    if (array_key_exists($key, $um_fields)) {
    if ($um_fields[$key][‘required’] == 1 && ( strlen(trim( $value ) ) == 0 ) ) {
    $ultimatemember->form->add_error($um_fields[$key][‘title’], __(‘This field is required.’,’ultimatemember’) );

    }
    }
    }

    revised the code just given. I had a few issues where add_error($um_fields[$key][‘title’], was not matching up correctly. I changed it to add_error($key . I also edited the error note to match how it looks on the registration page.

    $um_fields = get_option(‘um_fields’);
    foreach ($_POST as $key => $value){
    if (array_key_exists($key, $um_fields)) {
    if ($um_fields[$key][‘required’] == 1 && ( strlen(trim( $value ) ) == 0 ) ) {
    $ultimatemember->form->add_error($key, __($um_fields[$key][‘title’].’ is required’,’ultimatemember’) );
    }
    }
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Edit Profile Fields’ is closed to new replies.