Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
921 views
in Plugins by

When I make a custom page and add a navigation link in admin/pages then the link is always http://mydomain.com/custompage, even when the URL structure in admin/general is set to /?qa=123/why-do-birds-sing

Is this supposed to be the case? It seems rather odd to me, I'd assume it would have to be http://mydomain.com/?qa=custompage

Q2A version: 1.6.3

1 Answer

+3 votes
by

I had to dive into this for a while to understand why this is happening. I THINK this is a bug. I'm not 100% sure because there is an explicit check that handles this kind of situations. However, that could have been from older versions of Q2A and Gideon forgot to update it too. So not sure.

The issue comes from this function: https://github.com/q2a/question2answer/blob/v1.6.3/qa-include/qa-app-format.php#L1310 . For some reason, the URL is built from "scratch" by using the qa_path_to_root() function.

This is how I think that function should have been written, if I'm not missing anything:

    function qa_custom_page_url($page)
/*
    Return the url for $page retrieved from the database
*/
    {
        return ($page['flags'] & QA_PAGE_FLAGS_EXTERNAL) && (strpos($page['tags'], '://') !== false)
            ? $page['tags']
            : qa_path($page['tags']);
    }
 
Give it a try.
by
yus that works, thanks!
by
Welcome. I've created a pull request to analyze and fix this issue: https://github.com/q2a/question2answer/pull/149 . Now, whether this will get to the core or not it depends on Scott :)
...