Subscriber can not upload files

Support MB Frontend Submission Subscriber can not upload filesResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16869
    baraanajjar@gmail.com[email protected]
    Participant

    Hi support i have added the subscriber capability to upload files
    it works when i create new user after when i change password from admin the same user can not upload file even he has cpapbility upload file assigned following my code

    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' );
        $subscriber->add_cap( 'upload_files' );
        
        
        
        
    }
    add_action( 'init', 'mb_allow_subscriber_uploads' );

    this code i added in functions.php
    waiting for your reply.

    #16870
    baraanajjar@gmail.com[email protected]
    Participant

    Also the gallery upload field code is

     array(
                    'id'               => 'gallery_upload',
                    'name'             => esc_html__( 'IMAGE UPLOAD', 'your-prefix' ),
                    'type'             => 'image_upload',
                    'admin_columns' => 'before title',
                    //'required'   => true,
                    // Delete image from Media Library when remove it from post meta?
                    // Note: it might affect other posts if you use same image for multiple posts
                    'force_delete'     => true,
                    // Maximum image uploads
                    'max_file_uploads' => 5,
                    // Display the "Uploaded 1/2 files" status
                    'max_status'       => true,
                ),
    #16897
    baraanajjar@gmail.com[email protected]
    Participant

    Thanks I have fixed it the problem with signin cookie value i have updated my code as
    $user = wp_signon( $creds, true );
    now it can upload images.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.