Support » Plugin: Instant Images - One Click Unsplash Uploads » Users with author roles cannot add images?

  • Resolved danielbilletto

    (@danielbilletto)


    Hi,

    I am the administrator of the blog and have no issues adding new Unsplash images into posts.

    However, when users with the “Author” WordPress role attempt to save images via the plugin, then get the following error:

    “Unable to download image to server, please check your server permissions.”

    The same “Author” roles are able to add all other form of media, such as uploading an image directly from their computer. Is there a solution to this?

    Thanks in advance,
    Daniel

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author dcooney

    (@dcooney)

    Hi @danielbilletto,
    Instant Images is set for edit_theme_options role by default.
    You can adjust this by using the following filter:
    https://connekthq.com/plugins/instant-images/#6

    // functions.php
    function my_instant_images_user_role(){
       // https://codex.wordpress.org/Roles_and_Capabilities
       return 'upload_files';
    }
    add_filter('instant_images_user_role', 'my_instant_images_user_role');

    Hope that helps.

    Thanks a lot for a quick response here! I should have found this on my own.

    My experience with editing theme/plugin files is a bit limited. How exactly do I use the filter?

    Shall I just insert the above line exactly as it is somewhere in the functions.php part of the theme via the “Editor”? Or is there more to it?

    Plugin Author dcooney

    (@dcooney)

    Yea, add it to your functions.php but make sure to check the minimum user role you need.
    https://codex.wordpress.org/Roles_and_Capabilities

    Looks like authors need edit_posts or upload_files permissions.

    Thanks so much for your quick help.

    I just added the code as is at the bottom of the current theme’s functions.php – it worked!

    And you’re right, “upload_files” was sufficient, because Author role has that permission.

    Plugin Author dcooney

    (@dcooney)

    Perfect – no problem. 🙂

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