Block Anspress upload file
-
Hello
I am using Anspress
https://ww.wp.xz.cn/plugins/anspress-question-answer/
Once IP-geo-block activated, the user will can not upload an image at frontend, I tried to change the setting of IP-Geo-block at backend, but I still can not resolve, please check the screenshot: http://prntscr.com/gjhlgr
you might like let me know which setting is related, thanks.
Alex
-
Hi Alex,
I think this issue may be related Roles and Capabilities.
It seems that AnsPress defines ‘participant’ and ‘moderator’ for role, and each role has capabilities such as ‘ap_read_question’ for ‘participant’ or ‘ap_view_private’ for ‘moderator’.
I could not find an official documentation about AnsPress’s roles and capabilities, but found this in their FAQ.
As far as I read their codes, AnsPress needs
ap_edit_questionorap_edit_answerfor ‘participant’,ap_edit_others_questionorap_edit_others_answerfor ‘moderator’ to upload something.As IPGB, you can find “Capabilities to be verified” at “Prevent malicious file uploading” in “Validation rule settings” section. The default value is
upload_fileswhich is a capability for WordPress to upload files.So I think you should put all the above capabilities (e.g.
ap_edit_question,ap_edit_answer,ap_edit_others_question,ap_edit_others_answer) into “Capabilities to be verified“.I also have not finished to describe the documentation about this functionality, but please refer to “Capabilities to be verified“.
I hope this may solve your issue.
c.f. https://anspress.io/resources/functions/ap_role_caps/
-
This reply was modified 8 years, 9 months ago by
tokkonopapa. Reason: Add ap_role_caps()
Here is the help text at “Capabilities to be verified“.
Specify the capabilities to be verified. Depending on the particular type of uploader, certain capability may be required. Default is “upload_files” for Administrator, Editor and Author. This verification will be skipped if empty.
SORRY for later feedback since I am really business these days.
I tested but failed.
1#I found it is “disable” at the setting of “Capabilities to be verified” in our sites. whatever Anspress is used or not, what is the recommend setting here please ?
2# Actually, I tried “upload files(default)” and copy those roles capabilities, but all does not work.
Alex
Hi Alex,
Nice to see you again!
Please try to put the followings into “Capabilities to be verified“:
upload_files,ap_edit_question,ap_edit_answer,ap_edit_others_question,ap_edit_others_answerThanks.
Thanks, I tried the above, but still not work.
And actually, I tried the very low capability: upload_files,ap_read_question, but still not work.
I am still confused π
Alex
Hello @tokkonopapa,
There is a role capabilities tool at anspress backend, and there are Anspress administrator, anspress contributors and anspress banned, please check the screenshot at http://prntscr.com/gwuqaq
and I guess the lowest capability of anspress contributor is AP_read_quetion.
actually, I allow the user with AP_read_quetion to upload images, so I add all of capabilities below into IP-Geo-Block:
Upload_files,ap_read_question,ap_read_answer,ap_new_question,ap_new_answer,ap_new_comment,ap_edit_question,ap_edit_answer,ap_edit_comment,ap_delete_question,ap_delete_answer,ap_delete_comment,ap_vote_up,ap_vote_down,ap_vote_flag,ap_vote_close,ap_upload_cover,ap_change_statusBut it does not work yet, thanks.
Alex
Hello Alex,
Sorry for my sluggish support.
There is a role capabilities tool at anspress backend, …
Based on this information, I confirmed the solution.
1. Add
ap_upload_coverinto “Capabilities to be verified” at “Prevent malicious file uploading“.
2. Add
ap_image_submissioninto “Exceptions” at “Admin ajax/post“.
I hope this may solve the issue.

Thanks!
Hello @tokkonopapa,
Never mind, your support is really great, and it works well π
I mark this topic as resolved, Really appreciated, thanks so much,
Alex
Hi Alex,
Thank you for your confirmation.
I’d like to add some information for all the users:
AnsPress – Question and answer uses Plupload to upload files. And “Prevent Zero-day Exploit” at “Admin ajax/post” can not handle ajax requests well for uploading by Plupload.
That’s why
ap_image_submissionmust be put into “Exceptions“.Thanks.
-
This reply was modified 8 years, 9 months ago by
The topic ‘Block Anspress upload file’ is closed to new replies.