Custom Fields
Re-Envisioned
Support MB Frontend Submission Subscriber can not upload files

This topic contains 2 replies, has 1 voice, and was last updated by  baraanajjar@gmail.com 3 days, 1 hour ago.

  • Creator
    Topic
  • #16869
    Resolved
    baraanajjar@gmail.com
    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #16870

    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

    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 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.