• Resolved rapidcoder

    (@rapidcoder)


    Is there a way for vendors to upload product images without using the media library? The product images will never be reused so the library is not going to be used at all on the frontend. I need the function to upload images be like just like uploading image files using HTML’s input tag.

    I’ve tried using code snippets to hide the library tab, only as far as removing the title text but the tab itself was still there. In this case, I can still click on the blank tab to go to the media library and when I upload files, I’ll still get redirected to the library too. I don’t want any of these to happen.

Viewing 8 replies - 1 through 8 (of 8 total)
  • you can use a plugin called Featured Image from URL Premium . this plugin will allow the vendor to upload product images using url you will need to make a custom form using WP user frontend

    by using custom fields use those 2 meta_keys to be stored

    main Image | fifu_image_url
    Image gallery | fifu_image_alt

    use user frontend to make custom forms

    • This reply was modified 4 years, 4 months ago by nouradawy.
    Thread Starter rapidcoder

    (@rapidcoder)

    I like the idea, though I don’t think the vendors would like it if they have to go to another site, upload their image, and copy the URL just to upload a single image. It’s going to be even more troublesome if the vendor has a few images to show. I don’t think I can use it in my current project, especially if I need extra spending money, but I can probably save your suggestion for future projects. Thanks for the answer though.

    Thread Starter rapidcoder

    (@rapidcoder)

    If it’s not possible to remove the gallery/library completely, is there a hook or something I can use to force the upload tab to be the default one on the front end?

    Hello @rapidcoder ,

    It will be difficult to create a separate gallery/library for the vendors in the current setup. You can use this code to hide the media library from all users except admin account –

    function remove_medialibrary_tab($strings) {
            if ( !current_user_can( 'administrator' ) ) {
                unset($strings["mediaLibraryTitle"]);
            return $strings;
            }
            else {
                return $strings;
            }
    }
    
    add_filter('media_view_strings','remove_medialibrary_tab');

    I hope this helps.

    Thank you ??

    Thread Starter rapidcoder

    (@rapidcoder)

    It’s still not working. The upload image button still directs to the gallery/library tab when open and I need to force the direct to the upload tab instead of the last opened tab. Also, I’ve already tried the code before and all it did was remove the string label of the tab.

    Hello @rapidcoder ,

    Well, that should not be the case.

    I tried the same code I shared with your & for me, the media library tab is gone. So, by default, I have the upload option on vendor profile only – https://prnt.sc/vpoja7

    If you have other media library plugins try after disabling them. Unfortunately, at the moment this is the solution I have for you in this case.

    Thank you ??

    Thread Starter rapidcoder

    (@rapidcoder)

    The tab isn’t visible anymore, yes, but in my case I can still click it. Users won’t know that there’s a button there when invisible, so this could be the best solution so far. The problem would be how the media popup somehow opens up in the last opened tab, which would be the gallery/library after uploading last. The steps for this would be: add product, upload a new image, save, add another product immediately, and upload another image. On my side, this causes the popup to open in the gallery/library tab.

    But if there aren’t anything else to be done, I guess I’ll just leave it at this point. I don’t have any media-related plugins installed, so that’s definitely not the issue.

    Hello @rapidcoder ,

    I understand. Basically, this is the code that should have remove the media library tab from the media upload pop-up but this is not working at the moment. It looks like the hook has been deprecated.

    function remove_media_library_tab($tabs) {
         unset($tabs['library']);
         return $tabs;
    }
    add_filter('media_upload_tabs', 'remove_media_library_tab');

    Right now, I can suggest you to hide the tab and its content with CSS –

    #menu-item-browse, .attachments-browser {
        display: none;
    }

    However, the upload button opening the previous tab can be a reason for your browser cache/cookies.

    Thank you ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Upload product image without media gallery’ is closed to new replies.