Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
1.8k views
in Q2A Core by
retagged by

1. Create a custom page with option "visible to anyone" and put the link to the footer.
2. Click on the link - it works.
3. Then log out.
4. Click on the link -  "No privilege error".

Seems that despite the "anyone" option, there is still a verification for logged users.

EDIT: 
I noticed that my old custom sites work ok. And if I edit the site, then it gets the error.
So sth must be wrong with saving the site access variable.

Q2A version: 1.5
by
I can confirm this, having the same problem right now. Won't show "Anyone" custom page links to literally anyone.

1 Answer

+2 votes
by
selected by
 
Best answer

Something is causing the function qa_db_get_pending_result('navpages'); to return a value of -106 value for the "permit" field if it is 150:

  [6]=>
  array(9) {
    ["pageid"]=>
    string(1) "6"
    ["title"]=>
    string(3) "FAQ"
    ["flags"]=>
    string(1) "1"
    ["permit"]=>
    string(4) "-106"

    ["nav"]=>
    string(1) "M"
    ["tags"]=>
    string(3) "faq"
    ["position"]=>
    string(1) "1"
    ["heading"]=>
    NULL
    ["_order_"]=>
    int(2)
  }

Setting permit to NULL in the database brings the pages back:

  [5]=>
  array(9) {
    ["pageid"]=>
    string(1) "5"
    ["title"]=>
    string(4) "Wiki"
    ["flags"]=>
    string(1) "1"
    ["permit"]=>
    NULL

    ["nav"]=>
    string(1) "M"
    ["tags"]=>
    string(4) "wiki"
    ["position"]=>
    string(1) "2"
    ["heading"]=>
    NULL
    ["_order_"]=>
    int(1)
  }

UPDATE:

Still can't figure this one out, but it's something to do with the selectspec not loading.  Loading the selectspec in qa-page.php fixes the problem:

    function qa_page_queue_pending()
/*
    Queue any pending requests which are required independent of which page will be shown
*/
    {
        if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args());
        
        qa_preload_options();
        $loginuserid=qa_get_logged_in_userid();
        
        if (isset($loginuserid)) {
            if (!QA_FINAL_EXTERNAL_USERS)
                qa_db_queue_pending_select('loggedinuser', qa_db_user_account_selectspec($loginuserid, true));
                
            qa_db_queue_pending_select('notices', qa_db_user_notices_selectspec($loginuserid));
        }
    
        qa_db_queue_pending_select('widgets', qa_db_widgets_selectspec());
        qa_db_queue_pending_select('navpages', qa_db_pages_selectspec());
        qa_db_select_with_pending(
            qa_db_pages_selectspec(),
            null
        );

    }

by
edited by
That's awesome :) I was trying to think of some hexdecimal issue, since 150-256 = -106

So, in the meantime, we could set QA_OPTIMIZE_LOCAL_DB to true?

Edit: ooh... I should have read the config notes... it's supposed to be true anyway, for local db.  Can confirm that setting it to true solves the problem for me.
by
You could, but the workaround I've implemented is as follows - in qa_db_pages_selectspec(...) in qa-db-selects.php, change:

'permit'

... to ...

'permit' => 'permit+0'

Adding the zero seems to prevent the MySQL bug from occurring.
by
Yes, this must implicitly convert the permit value type into INT SIGNED. Works great, thanks. You guys rock !
by
edited by
guyz I am having the same problem with the link. I am using 1.5 beeta I am trying to add link on the navigation tab of my website page. But its only visible while I am on Admin>pages tab as soon as I move to other tab it just disappear. Can anyone tell me how to fix that. Please let me know the file name where to add/modify code. Because I am not familiar with QA codex.

Okay I have noticed its happening while integrated with Wordpress. any solution please.
...