Support » Plugin: Frontier Post » Error Uploading Image

  • Resolved wickedmint

    (@wickedmint)


    Hi, I am testing your newest version of FP (3.3.2), but I had this same problem when I was using 3.0.7.

    I think I have it set correctly in my options that Authors can add images. (In Frontier Post – Capabilities & Role based settings I have Media Upload checked off for Author).

    However when I log in as an Author and try to upload an image I receive this error: An error occurred in the upload. Please try again later.

    The strange thing is that if I log in as Admin I can see that upload in the main library so it is technically being uploaded on the back end.

    If I log in as Admin and use Frontier Post I do not have a problem uploading images so it must be something with that particular role. I tried switching the user to Frontend Author and I am having the same problem.

    https://wordpress.org/plugins/frontier-post/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter wickedmint

    (@wickedmint)

    Update: Editor role also works. So it’s just Author and Frontend Author.

    Thread Starter wickedmint

    (@wickedmint)

    I looked through the forum and noticed someone else had this problem and it had something to do with FP interacting with other plugins.

    The culprit was the plugin A5 Custom Login because within this plugin I was able to “Hide backend” for the role Author. This is necessary since I didn’t want the Authors to see the backend – including the full media library.

    Do you have any recommendations for other pluging that will let me hide the backend, but allow Authors to upload and insert media into posts using Frontier Post?

    Thanks!

    Thread Starter wickedmint

    (@wickedmint)

    Sorry for my constant updating! So, I found a piece of code that is supposed to hide the Media Library tab if you put it in the theme’s function.php file or within the plugin. It didn’t work when I put it in the function.php file, but I’m hoping maybe you could figure out where I could use this within the Frontier Post

    Hiding the tab would solve all the problems and might be the simplest solution if it works.

    They say you need to know the exact name of the tab and I’m guessing maybe Frontier Post uses a particular name? Thanks again!

    Here is a link to the site where I got that code. http://www.superann.com/2010/10/08/how-to-remove-the-media-library-tab-in-the-wordpress-media-uploader/

    Plugin Author finnj

    (@finnj)

    Hi,

    The problem with restricticting access to the backend is that it also block the access to the Ajax code that insert the image into the post – I had the exact same problem with Theme my Login plugin, and I have found no way around it.

    As for hiding the media library tab, I dont know if this is possible – the code you link to is from 2008, and there has been significant changes to the media upload since then – I have not changed anything in the media upload, I use it as standard, so no change to tabs.

    You might try and search for: wordpress add_filter media_upload_tabs

    function remove_medialibrary_tab($tabs) {
      unset($tabs['library']);
      return $tabs;
    }
    if(!current_user_can('edit_others_posts'))
      add_filter('media_upload_tabs','remove_medialibrary_tab');
    Plugin Author finnj

    (@finnj)

    Did a search, and this one looks better:
    https://thomasgriffin.io/remove-tabs-media-uploader-wordpress/

    I havent tested it, but it looks more current

    Plugin Author finnj

    (@finnj)

    Sorry, looks like the same code…

    Plugin Author finnj

    (@finnj)

    Here is another take on it – Different method.

    The below will restrict users without the capability edit_others_posts only to see their own content – In other words, if the author uploads an image, he will be able to re-use it, but not view images uploaded by other users.

    CAUTION: this is not only media, but everything from the admin panel, so it could have some side effects – Test it well.

    put this into your functions.php

    function fp_my_authored_content($query)
    	{
    	//get current user info to see if they are allowed to access ANY posts and pages
    	$current_user = wp_get_current_user();
    	// set current user to $is_user
    	$is_user = $current_user->user_login;
    
    	//if is admin or 'is_user' does not equal #username
    	if (!current_user_can( 'edit_others_posts' ) )
    		{
    		//if in the admin panel
    		if($query->is_admin)
    			{
    			global $user_ID;
    			$query->set('author', $user_ID);
    			}
    		return $query;
    		}
    	return $query;
    	}
    add_filter('pre_get_posts', 'fp_my_authored_content');
    Thread Starter wickedmint

    (@wickedmint)

    Thank for all the info! I found code similar to the last you posted. This hides all media content not owned by the user so it solved my problem.

    Your plugin is really awesome, thanks for sharing it! And thanks for the fast replies.

    add_filter( 'posts_where', 'hide_attachments_wpquery_where' );
    function hide_attachments_wpquery_where( $where ){
    	global $current_user;
    	if( !current_user_can( 'manage_options' ) ) {
    		if( is_user_logged_in() ){
    			if( isset( $_POST['action'] ) ){
    				// library query
    				if( $_POST['action'] == 'query-attachments' ){
    					$where .= ' AND post_author='.$current_user->data->ID;
    				}
    			}
    		}
    	}
    
    	return $where;
    }
    Plugin Author finnj

    (@finnj)

    Thanks,

    I posted my code on wpfrontier.com including code that will restrict access to backend, but allow media upload:

    http://wpfrontier.com/restrict-backend-access-and-access-to-others-media/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Error Uploading Image’ is closed to new replies.