edit link works now, but new bug is presented in q&a edit answer

@Sajid solved the edit link problem, but now I"m having a new problem.

I'm noticing the following bug now (Can you confirm you see this as well?)

When the author of an answer clicks 'edit' on their answer, they are redirected to a page that says:
---------------------------------------
Answer for: XXXXXX
A text area filled with the answer the author wishes to edit.
A submit button
------------------------------------
The bug I'm seeing is XXXXX is a link to the parent question for that answer, but the text of that link is not the title of the parent question, but the content of the author's answer.

Thanks,
Curtis

  • Adam Czajczyk

    Hey Curtis,

    I hope you're well today and thank you for your question!

    I'm not quite sure what exactly should I check as on my setup it all seems to be working just fine. That being said, it's possible that I'd need to replicate your configuration and/or changes made by my colleague to your site.

    Could you please grant me an access so I could take a look around your dashboard? To do this please follow this guide:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Let me also include @Sajid into this thread as he may have some ideas on the issue.

    Kind regards,
    Adam

  • Curtis

    Hi Adam,

    Thanks for the reply.

    I have a subtle impression I might not have communicated my question very clearly, before we go further, can you confirm by reading below we're on the same page?

    The current version of q&a has a bug:
    On the page devoted to a single quesiton, the author of that question (or author of an answer to that question) has an "edit" link below the question (or answer) that author wrote. If the author clicks that link, it gives a page not found error.

    @Sajid has found the source of this error and has explained it starting on the 8th post of this thread:
    https://premium.wpmudev.org/forums/topic/user-profile-data-missing-and-edit-link-not-working

    I'm now experiencing the new bug which I described in the question to this thread.

    If everything " seems to be working just fine " as you said in your reply, this implies
    a) You have a new version of this plugin with this "edit -bug" fixed.
    b) You have the current version and followed the steps Sajid outlined to fix this edit problem or
    c) You are using the current version and had the "edit-bug" fixed by someone else.

    If you are in b) or c) you can definitely help me: Can you confirm you are in b) or c) and do not see the error I described in this threads original question?

    Thanks a lot!
    Curtis

  • Adam Czajczyk

    Hello Curtis!

    Thanks for this in-depth explanation, now we're definitely on the same side :slight_smile:

    If you are in b) or c) you can definitely help me: Can you confirm you are in b) or c) and do not see the error I described in this threads original question?

    I can confirm that I'm on the "b)". Now that I'm following you correctly, I can also confirm the issue. That being said I've reviewed the plugins code again and I suggest a little addition to Sajid's "hack".

    Inside the " /wp-content/plugins/qa/core/template-tags.php" file you'll find this code around line #361:

    function get_question_link( $question_id = 0 ) {
    	global $post;
    	if ( !$question_id )
    	$question_id = $post->ID;
    	if ( !$question_id )
    	$question_id = get_the_ID();
    
    		return apply_filters( 'qa_get_question_link', _qa_html( 'a', array( 'class' => 'question-link', 'href' => qa_get_url( 'single', $question_id ) ), $post->post_title ) );
    }

    Replace it please with this:

    function get_question_link( $question_id = 0 ) {
    	global $post;
    	if ( !$question_id )
    	$question_id = $post->ID;
    	if ( !$question_id )
    	$question_id = get_the_ID();
    
    	$question_title_id = wp_get_post_parent_id($post->ID);
    	if (!$question_title_id) $question_title_id = $post->ID;
    	$question_title = get_the_title($question_title_id);
    
    	return apply_filters( 'qa_get_question_link', _qa_html( 'a', array( 'class' => 'question-link', 'href' => qa_get_url( 'single', $question_id ) ), $question_title ) );
    }

    I've tested this on my sandbox and it does display the original ("parent") question as expected.

    Let me know please if it helped!

    Cheers,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.