Home Forums ACF PRO Admin Aproval


Admin Aproval

  • Hello,
    i want to approve all acf_forms with the rule
    User form >> is equal to >> add / edit

    My question is. What do I do best?

    My idea is
    1) create new table wp_usermeta_wating_approval
    2) save new update first into the wp_usermeta_wating_approval
    3) Create GUI for the Admin

    -> move all (from user XXX)
    from wp_usermeta_wating_approval into wp_usermeta

    Is this possible? Do you know a better way?
    I appreciate any help.

  • Hi @manu

    I believe it will be simpler if you use the True/False field type.

    With that field type, you can create a field type that will tell you that an account is approved or not. It will be easier to update too. Don’t forget to check this field when you need to query the accounts.

    I hope this makes sense 🙂

  • Hi James,
    Thanks for the fast reply but your solution does not work.
    I think you don’t get it (i know, bad english, sry :/ ).

    # An user update fields (for example: City, Name, Age, About me Text)

    # Only the User see the changes, all other user (including the admin) see the “old” values.

    # The admin must confirm (on a custom Page in the ACP) the changes
    Age -> ok -> Update user Profile
    Name -> ok -> Update user Profile
    About me Text -> not ok -> sent email and delete entry

    I know that is a lot of work, but i need this feature.
    Thanks in advance!

  • Hi @manu

    In my opinion, creating a custom table for this case would be too complicated and it’s not related to ACF anymore. Instead, I think you can create a group field where users can save the temporary data and you can create a front end from for that field group.

    You can also create a true/false field for each field for the admin to approve the data. Then you can use the acf/save_post hook to check if the admin approved the data or not. If he did, then the code will automatically update the real data by using the update_user_meta() function.

    I hope this makes sense 🙂

  • Sorry i dont get it 🙁

    I add (for example) the true/false field to the user “about me” field.
    On the frontend i check if the field “about me” is true (approved) or false (disapproved)

    If true, i show the normal “about me” field.
    If false, … where do i get the old value?

  • Hi @manu

    I’ve attached an image of a field group as an example. With that field group, I created a front end form like this:

        'post_id' => 'user_99',
        'fields' => array('field_574d2ee6b5a16'),

    Where “99” is the ID of a user you want to update (you can dynamically generate it, of course). After that, I use this function in my functions.php to check if an admin approved the submitted data or not:

    add_action('acf/save_post', 'example_save_temporary_user_data', 20);
    function example_save_temporary_user_data( $post_id )
        // The approval should be on the back end only;
        if( !is_admin() )
        // Check if an admin approve it or not
        if( get_field('approve_example_text', $post_id) ){
            //get the temporary data
            $temporary_data = get_field('example_text', $post_id);
            // $post_id contains "user_99" so $user_id should "99"
            $user_id = str_replace('user_', '', $post_id);
            // update the user data (in this case the first name)
            update_user_meta( $user_id, 'first_name', $temporary_data );

    You can also use the acf/load_value field to always make the true/false field unchecked.

    I hope this makes sense 🙂

  • 21 days later and i think the solution with the true/false field will not work for me. I have over 200 fields and i don’t want to add for every field an extra true/false field.

    What i have:


    // ##### TEXT #####
    $("input[type='text'],textarea").change(function ()
        // mark input field with red Border
        // STOP FLOODING
        if(typeof editNow_select_TM != 'undefined') { clearTimeout(editNow_select_TM) }
        editNow_select_TM = setTimeout(function() 
            var newDataObj = [];  
            // get all changed input fields            
            $('#setCardManager_allForms :input.editNow').each(function(e)
                newDataObj.push({   setCardId: $('#setCardManager').data('setcardid'), 
                                    type : 'input',
                                    fieldId :, 
                                    fieldValue : $(this).val() });                                
            // save to DB
            // clear Timeout
            delete editNow_select_TM;     
    // ##### DROPDOWN #####
    $('#setCardManager_allForms select').change(function ()
        // save to DB
        updateSetCard('select',({   setCardId: $('#setCardManager').data('setcardid'), 
                                    type : 'select',
                                    fieldId :, 
                                    fieldValue : $(this).val() }));
    // ##### CheckBox #####
        // save to DB
        updateSetCard('select',({   setCardId: $('#setCardManager').data('setcardid'), 
                                    type : 'checkbox',
                                    fieldId :, 
                                    fieldValue :this.checked }));
    // ##### REPEATER FIELDS #####
       // hmmm, not so easy

    I created a copy from wp_postmeta with the name wp_postmeta_draft.

    The function updateSetCard() store the new values in this table.
    update_post_meta_draft(setCardOpt['setCardId'], setCardOpt['fieldId'], setCardOpt['fieldValue']);

    If the admin confirm

    update_field($selector, $value, $post_id);
    delete row from wp_postmeta_draft

    ACF is new for me so i’m not sure:
    – will this solution work with any problems?
    – did i forget something?

    Thanks in advance and sorry for the late reply.

  • Hi @manu

    In that case, I think your solution would be the best for you. I’m not sure if the new table will create an issue in the future or not. For further support regarding the new table, I suggest you consult to WordPress Support forum instead.

    Thanks 🙂

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Admin Aproval’ is closed to new replies.