Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to hide some navigation menus for non registered users?

+1 vote
87 views
asked Sep 7 in Themes by link2admission
edited Sep 8 by Scott
Please Admin and others please help me, i want to hide some navigation menus for non registered users until they register and confirm their mail before they can be allow to see them.

Please how can i do it because i have been going all through my admin dashboard in search of it, but unfortunately that i didn't find where to do that.

Please help on that?

thanks
Q2A version: Latest version

1 Answer

+1 vote
answered Sep 8 by Scott

There's no built in way to do that (for most pages anyway - v1.8 has a couple of options for the users list pages).

But you can make an override plugin that overrides the qa_content_prepare function. It would be something along the lines of:

function qa_content_prepare($voting = false, $categoryids = null)
{
    $qa_content = qa_content_prepare_base($voting, $categoryids);
    $confirmed = qa_get_logged_in_flags() & QA_USER_FLAGS_EMAIL_CONFIRMED;

    // hide 'unanswered' page for unconfirmed users
    if (!$confirmed) {
        unset($qa_content['navigation']['main']['unanswered']);
    }
    // repeat for any other menu items

    return $qa_content;
}

commented Sep 8 by link2admission
Not clear on where to add the code. Please i need more explanation. Please i am new to Q2A

Thanks
commented Sep 8 by esqeudero
you can add it on your advanced theme.php file
commented Sep 11 by Scott
@link2admission Start with the plugin documentation here: http://docs.question2answer.org/plugins/
That page gives you the basics on what you need to do for any plugin. Then look at the Overrides link I provided for how to do overrides specifically.
...