Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Problem with uploading media as editor

UserPost

4:11 am
November 30, 2010


Geert Melotte

Member

posts 2

1

I have a custom post type created with "Custom post type UI".

In this post type I have created an additional rich text field using "Custom Field Template".

As Administrator everything works just fine. 

The problem arises with other roles. In my case the editor role.

If I try to upload images in the original post content box, everything works just fine. But when I try to upload an image in this custom rich field created by "Custom Field Template", I get the alert that I don't have sufficient rights.

If I assign "Activate plugins" capability to this role, I can upload images and a galley in this field, but can't publish the post because of internal errors.


4:39 am
November 30, 2010


Geert Melotte

Member

posts 2

2

This also occures in  posts that  have been  'extended' with a custom metabox using "Custom Field Template".

3:13 pm
November 30, 2010


Kevin

Admin

posts 2503

3

This is actually due to a bug in the Custom Field Template plugin code. After you click on a media upload button, see how there is no ampersand between the post_id and type arguments? That throws Role Scoper off.

You can correct the conflict by modifying plugins/custom-field-template/custom-field-template.php as follows:

change:

if ( !$mediaOffImage ) :
	$image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src?type=image");
	$image_title = __('Add an Image');
	$media .= "<a href=\"{$image_upload_iframe_src}&TB_iframe=true\" id=\"add_image{$rand}\" title='$image_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?','?post_id='+jQuery('#post_ID').val())); return thickbox(this);\"><img src='images/media-button-image.gif' alt='$image_title' /></a> ";
endif;
if ( !$mediaOffVideo ) :
	$video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src?type=video");
	$video_title = __('Add Video');
	$media .= "<a href=\"{$video_upload_iframe_src}&TB_iframe=true\" id=\"add_video{$rand}\" title='$video_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?','?post_id='+jQuery('#post_ID').val())); return thickbox(this);\"><img src='images/media-button-video.gif' alt='$video_title' /></a> ";
endif;
if ( !$mediaOffAudio ) :
	$audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src?type=audio");
	$audio_title = __('Add Audio');
	$media .= "<a href=\"{$audio_upload_iframe_src}&TB_iframe=true\" id=\"add_audio{$rand}\" title='$audio_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?','?post_id='+jQuery('#post_ID').val())); return thickbox(this);\"><img src='images/media-button-music.gif' alt='$audio_title' /></a> ";
endif;
if ( !$mediaOffMedia ) :
	$media_title = __('Add Media');
	$media .= "<a href=\"{$media_upload_iframe_src}?TB_iframe=true\" id=\"add_media{$rand}\" title='$media_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?','?post_id='+jQuery('#post_ID').val())); return thickbox(this);\"><img src='images/media-button-other.gif' alt='$media_title' /></a>";
endif;

to:

if ( !$mediaOffImage ) :
	$image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src?type=image");
	$image_title = __('Add an Image');
	$media .= "<a href=\"{$image_upload_iframe_src}&TB_iframe=true\" id=\"add_image{$rand}\" title='$image_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?', '?post_id='+jQuery('#post_ID').val()+'\&')); return thickbox(this);\"><img src='images/media-button-image.gif' alt='$image_title' /></a> ";
endif;
if ( !$mediaOffVideo ) :
	$video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src?type=video");
	$video_title = __('Add Video');
	$media .= "<a href=\"{$video_upload_iframe_src}&TB_iframe=true\" id=\"add_video{$rand}\" title='$video_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?','?post_id='+jQuery('#post_ID').val()+'\&')); return thickbox(this);\"><img src='images/media-button-video.gif' alt='$video_title' /></a> ";
endif;
if ( !$mediaOffAudio ) :
	$audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src?type=audio");
	$audio_title = __('Add Audio');
	$media .= "<a href=\"{$audio_upload_iframe_src}&TB_iframe=true\" id=\"add_audio{$rand}\" title='$audio_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?','?post_id='+jQuery('#post_ID').val()+'\&')); return thickbox(this);\"><img src='images/media-button-music.gif' alt='$audio_title' /></a> ";
endif;
if ( !$mediaOffMedia ) :
	$media_title = __('Add Media');
	$media .= "<a href=\"{$media_upload_iframe_src}?TB_iframe=true\" id=\"add_media{$rand}\" title='$media_title' onclick=\"focusTextArea('{$name}{$rand}'); jQuery(this).attr('href',jQuery(this).attr('href').replace('\?','?post_id='+jQuery('#post_ID').val()+'\&')); return thickbox(this);\"><img src='images/media-button-other.gif' alt='$media_title' /></a>";
endif;

About the Agapetry forum

Currently Online:

17 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1248

Posts: 5657

Members:

There are 1260 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin