File/image input field does not work when in group

Support General File/image input field does not work when in group

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #6604
    ludovic.meyerludovic.meyer
    Participant

    Hello,

    I took your image field demo and put it in a group. The image upload does not work anymore.

    Can you fix this ?

    Regards,

        $meta_boxes[] = array(
            'post_types' => array( 'post' ),
            'title'  => esc_html__( 'Image Upload Demo', 'your-prefix' ),
            'fields' => array(
                array(
                    'name'    => '',
                    'id'      => 'test_group',
                    'type'    => 'group',
                    'fields' => array(
                        array(
                            'id'               => 'image',
                            'name'             => esc_html__( 'Image', 'your-prefix' ),
                            'type'             => 'image',
                            'force_delete'     => false,
                            'max_file_uploads' => 2,
                        ),
                    ),
                ),
            ),
        );
    
    #6605
    ludovic.meyerludovic.meyer
    Participant

    This fix is pretty important for me. If you can fix it quickly you would be awesome.

    #6631
    Truong GiangTruong Giang
    Participant

    Hi there,

    Can you use the image_advanced field before we can solve this problem?

    Update: Oh. Sorry. I have just read your topic about uploading image in frontend. We are checking this problem. Please wait.

    #6632
    ludovic.meyerludovic.meyer
    Participant

    Hello,

    I have a problem with both configuration (image or image_upload), but you saw that 🙂

    https://support.metabox.io/topic/image-upload-does-not-work-with-mb-frontend-submission/

    Thank you for your support,

    #6639
    Truong GiangTruong Giang
    Participant

    Hi,

    Can you give me your email? I'll send you the fixed code. We still have some works with MB Group so we will update it later.
    Please make sure that you are using MB Group 1.2.10 before use fixed code.

    UPDATE: We have just released MB Group 1.2.11. Please update it.

    Thanks.

    #6657
    ludovic.meyerludovic.meyer
    Participant

    Hi,

    Will try MB Group 1.2.11.

    Thank you,

    #6680
    ludovic.meyerludovic.meyer
    Participant

    Hello,

    I tested MB Group 1.2.11 today.

    That does not work, and the problems are multiples.

    1. If I select an image, then save the post. If i save the post again (even without touching anything), the image is no more linked to the field (and stays in the media library as an orphan)
    See https://screencast-o-matic.com/watch/cbjbbpl77B
    Behaviour is the same in front or back

    2. If the group is clonable (and only 1 file allowed per field), the behaviour is weird. All medias seems to go in the first group instead of one per group after save.
    See https://screencast-o-matic.com/watch/cbjbbGl77W
    After a second save, all images are gone (see 1)

    Regards,

    #6700
    Truong GiangTruong Giang
    Participant

    Hi,

    I got the problem. We are fixing it ASAP.

    Thank you.

    #6707
    ludovic.meyerludovic.meyer
    Participant

    Ok,

    Keep me up to date, please

    Thank you

    #6735
    ludovic.meyerludovic.meyer
    Participant

    Hello,

    Do you have any news ? I'm taking a quick fix if you have one.
    My client is supposed to begin to use the forms today.

    Regards,

    #6750
    Truong GiangTruong Giang
    Participant

    Hi there,

    Can you give me your email address? I will give you a quick fix version. This version works if the image field is in level 1 of group (like your case).

    Thank you.

    #6752
    ludovic.meyerludovic.meyer
    Participant

    Hello,

    My email is : [email protected]

    Thank you,

    #6753
    Truong GiangTruong Giang
    Participant

    Hi there,

    Sorry about this. There are some problems so we can't send you the hotfix. You can use image_advanced field and add upload_files capability for users. The code below add that cap for subscriber:

    
    /**
     * Allow the media uploader work on specific pages
     */
    function mb_allow_contributor_uploads() {
    	if ( is_admin() ) {
    		return;
    	}
    	$path = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '';
    	if ( ! $path || '/page-slug' != $path ) {
    		return;
    	}
    	/**
    	 * Replace 'subscriber' with the required role to update, can also be contributor
    	 */
    	$subscriber = get_role( 'subscriber' );
    	// This is the only cap needed to upload files.
    	$subscriber->add_cap( 'upload_files' );
    }
    add_action( 'init', 'mb_allow_contributor_uploads' );
    
    #6754
    ludovic.meyerludovic.meyer
    Participant

    Hello,

    As i told you in the other thread, my subscribers already have the upload_files capability but they can't upload.
    See https://support.metabox.io/topic/image-upload-does-not-work-with-mb-frontend-submission/#post-6600

    I prefer wait for a fix (or a quick fix). I just hope it will be released soon 🙂

    Please tell me when it's ok,

    #6758
    Truong GiangTruong Giang
    Participant

    Have you tried with the code above? I tested and it works, with some CSS fix. I removed page checking. Please try again:

    
    /**
     * Allow the media uploader work on specific pages
     */
    function mb_allow_subscriber_uploads() {
    	if ( is_admin() ) {
    		return;
    	}
    
    	/**
    	 * Replace 'subscriber' with the required role to update, can also be contributor
    	 */
    	$subscriber = get_role( 'subscriber' );
    	// This is the only cap needed to upload files.
    	$subscriber->add_cap( 'upload_files' );
    }
    add_action( 'init', 'mb_allow_subscriber_uploads' );
    
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.