Jesus Iniesta
asked 4 years ago

Seems like in Template.php, when evaluating if a user can edit a specific question/answer, the post_id is not being passed, returning always false.

3 Answers
DominicStaff
answered 4 years ago

Please let me know detail about this question, you can send me username & password of your site for further checking.

Jesus Iniesta
replied 4 years ago

Why would you need my username & password?

THE BUG:

When deciding if showing edit & delete buttons, you’re not checking if the user has permissions to edit or delete that specific question/answer, instead, you’re only checking if the user has general edit/delete permissions.

WHERE:

Template.php > dwqa_question_button_action()

HOW IS RIGHT NOW:

“`php
if ( dwqa_current_user_can( ‘edit_question’ ) ) {

if ( dwqa_current_user_can( ‘delete_question’ ) ) {

“`

HOW IT SHOULD BE:

“`php
if ( dwqa_current_user_can( ‘edit_question’, get_the_ID() ) ) {

if ( dwqa_current_user_can( ‘delete_question’, get_the_ID() ) ) {

“`

Jesus Iniesta
replied 4 years ago

Happening also in: Template.php > dwqa_answer_button_action()

pjeaje
replied 4 years ago

Why would you need my username & password?… Exactly!

Jesus Iniesta
answered 4 years ago

Any news?
 
Thanks

DominicStaff
answered 4 years ago

I have checked the Free version and see that this is a bug, we will check and update it in the next version. In this case, you can try with the following code:
http://snippi.com/s/7m6dl6y
http://snippi.com/s/f81fdd6

Powered by DW Question & Answer Pro