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

Need some help to add dynamic plugin page to user nav sub menu

+3 votes
70 views
asked Aug 7 in Plugins by esqeudero

I am writing a plugin. I want to add page of this plugin to the user template as sub navigation. (see below)

Also, I the url of this page should look something like this.

'url' => qa_path_html('user/' . $handle . '/somepluginpage') 

I tried this coded, but it wont work.

function qa_user_sub_navigation($handle, $selected, $ismyuser = false) {

$navigation = qa_user_sub_navigation_base($handle, $selected, $ismyuser = false);

$nav_pluginpage= array('somepluginpage' => array(

'label' => 'Some Plugin Page',

'url' => qa_path_html('user/' . $handle . '/somepluginpage'),

)

);

$navigation = array_merger($navigation, $nav_pluginpage);

}

 

And I tried this one as well, it also does not work.

function doctype() {

qa_html_theme_base::doctype();

global $qa_request;

// adds subnavigation

if((bool)qa_opt('someplugin_enabled') && ($qa_request == 'somepluginpage' || $qa_request == 'user' || $qa_request == 'account' || $qa_request == 'favorites' || $qa_request == 'user-wall' || $qa_request == 'user-activity' || $qa_request == 'user-questions' || $qa_request == 'user-answers' || $qa_request == 'messages') && qa_get_logged_in_level() >= qa_opt('somepluginpage_level')) {

$this->content['navigation']['sub'] = array(

'somepluginpage' => array(

'label' => 'Some Plugin Page',

'url' => qa_path_html('somepluginpage'),

'selected' => ($qa_request == 'somepluginpage')

),

);

}

}

 

 

Q2A version: 1.8 customized

Please log in or register to answer this question.

...