Wordpress订户角色用户无法从前端上传图像(Wordpress subscriber role user cannot upload images from frontend)

编程入门 行业动态 更新时间:2024-10-25 05:18:57
Wordpress订户角色用户无法从前端上传图像(Wordpress subscriber role user cannot upload images from frontend)

我对于具有role = subscriber用户有wordpress网站的权限问题。

具有role = administrator用户可以通过wp media uploader从前端上传图像,只需从同一表单中上传即可。 但是每当用户从同一表单上传图像然后在firebug控制台中我看到/wp-admin/admin-ajax.php ajax返回0状态为200

在那个ajax之后,另一个ajax被称为/wp-admin/async-upload.php ,其中302尝试使用ajax重定向到/wp-login.php?redirect_to=/wp-admin/async-upload.php&reauth=1

我尝试在我的主题function.php中添加各种权限级别,但仍然是同样的错误:

###ROLE FIX FOR UPLOAD FILES if ( current_user_can('subscriber') && !current_user_can('upload_files') ) add_action('init', 'allow_subscriber_uploads'); function allow_subscriber_uploads() { $new_role = get_role('subscriber'); $new_role->add_cap('upload_files'); }

我在媒体上传屏幕上看到的只有这个错误: An error occurred in the upload. Please try again later. An error occurred in the upload. Please try again later.

任何帮助或提示将不胜感激。

WordPress版本的网站是:4.5.3

I am having permissions issue with wordpress website for users with role=subscriber.

A user with role=administrator can upload images via wp media uploader from frontend just fine from the same form. But whenever a user uploads image from that same form then in firebug console I see /wp-admin/admin-ajax.php ajax which returns 0 with status 200

And just after that ajax, another ajax is called /wp-admin/async-upload.php with a 302 which tries to redirect using ajax to /wp-login.php?redirect_to=/wp-admin/async-upload.php&reauth=1

I have tried adding various permission levels in my themes function.php but still the same error :

###ROLE FIX FOR UPLOAD FILES if ( current_user_can('subscriber') && !current_user_can('upload_files') ) add_action('init', 'allow_subscriber_uploads'); function allow_subscriber_uploads() { $new_role = get_role('subscriber'); $new_role->add_cap('upload_files'); }

All I see on media upload screen is this error: An error occurred in the upload. Please try again later.

Any help or hint would be much appreciated.

Wordpress Version of website is: 4.5.3

最满意答案

这是由于一些插件冲突而不是由于role = subscriber权限问题。

我还添加了members插件,之后问题自动修复。

我仍然不清楚问题是如何解决的,但添加成员插件似乎有所帮助。

It was due to some plugin conflict and not due to permission issues for role=subscriber.

I also added members plugin after which the issue was fixed automatically.

I am still not clear how the issue was fixed but adding the members plugin seemed to help.

更多推荐

本文发布于:2023-08-02 11:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1375449.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:订户   图像   角色   上传   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!