Support

Account

Forum Replies Created

  • Okay, I see that _edit_lock value is “timestamp:1”, so managed to add required metaposts. Instead of using

    'post_id' => 'new'

    I used time() to assign the timestamp value

    'post_id' => $timestamp

    then replaced the attachment post_parent containing that timestamp value with the new Post ID later and it worked like a charm.

    Thank you once again for your great plugin and support!

  • Thank you for getting back to me. Simply put, I already have a custom form and I am calling the file upload field by calling

    acf_form(
        array(
            'post_id' => 'new',
            'form' => false,
            'field_groups' => array( 30 )
        )
    );

    As you can see, I am not calling the whole form (<form> tag and submit button), only the fields

    'form' => false,

    So I can’t use ‘acf/save_post’ because it won’t be triggered. It’s because my custom form uses AJAX to save the data calling POST via jQuery. So I use the following action to save ACF fields (I’ve simplified the field name)

    my_save_post($post_ID) {
        update_field('field_text', $_POST['field_text'], $post_ID);
        update_field('field_file', $_POST['field_file'], $post_ID);
    }
    add_action('save_post', 'my_save_post');

    In this case, the field_text is saved, but not field_file because when the file information is inserted as attachment, it doesn’t save the “parent_post” ID correctly and becomes an orphan. And these 3 postmeta rows aren’t created either

    META_KEY                     META_VALUE
    _uploaded_file               field_689b0ed7249ab
    uploaded_file                345
    _edit_lock                   1383884182:1

    which are created normally if I upload a file when editing a post from the frontend if post_id is assigned.

    Thank you!

  • Decided to use the default “file” instead, looks like the simple field still has bug. But would prefer the simpler version if stable version is released. Thank you!

  • I’ve tried acf-basic-file plugin using with acf_form. Was able to select the file and upload it (it seems), and using get_field() retrieves the file name. Using print_r(get_field_object(‘field_890afd659f789’)) displays the following:

    Array
    (
        [key] => field_890afd659f789
        [label] => the_file
        [name] => the_file
        [type] => basic_file
        [order_no] => 1
        [instructions] => 
        [required] => 0
        [id] => acf-field-the_file
        [class] => basic_file
        [conditional_logic] => Array
            (
                [status] => 0
                [rules] => Array
                    (
                        [0] => Array
                            (
                                [field] => null
                                [operator] => ==
                            )
    
                    )
    
                [allorany] => all
            )
    
        [max_file_size] => 
        [field_group] => 30
        [value] => the_file.zip
    )
    

    But the file is nowhere to be found from the server? Not in WordPress media list or using FTP client.

    Thanks!

  • Thank you so much! Will try that out.

  • For example, I am a user A. I have added a file called car.zip to a post called “Beautiful car”.

    Another user called B, also going to upload a file for post called “Wonderful car”, but from the Media Manager screen, he can see “car.zip” uploaded by user A and also select it, although it can not be deleted.

    So I was looking for a way to tie the uploaded file to that single post only, or to a particular user only (the owner that uploaded the file) so it won’t be visible from another post or by another user.

    Thanks!

  • Thank you Elliot. Assigning the Field Group ID solved the issue.

    Just a question, is there a way to assign the uploaded file to particular POST or uploaded user? So only that user have privilege to delete or select the uploaded file to the post? And to restrict that file to appear to particular e posts, when media file manager is opened?

    Initially I thought the “Library -> Uploaded to post” was for that kind of feature, but I was wrong.

    Thank you once again for your fantastic support.

  • Thank you for getting back to me Elliot. Regarding to your questions:

    Can you elaborate more on this ‘text area’ field? Is this field part of teh same field group of zip_file? If so, can you look at the source code to see if the zip_file field is created?

    No, “zip_file” is the only field created.

    If the ‘text area’ field is part of another field group, then for some reason, ACF is finding the wrong field group for this post_id parameter.

    There are no other field group. I probably have to look deeper into this.

    May I ask what the $post_id value is?

    I am having problem only with new post, to display this custom field before even able to submit the form. I used ‘new’ for $post_id, so I can handle it later like the tutor.

    If it is not a real post, you will have to specify the field group IDs manually like in the tutorial. This is missing from your code.

    Okay, I will try that. About group IDs, are you referring to this part of the code?

    $args = array(
        'post_id' => 'new',
        'field_groups' => array( 123 )
    );

    If yes, the 123 is the field group ID number from the URL when we edit the field group

    post=123

    correct? Thank you once again!

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