For the new plugin (q2a-best-users-per-month) I was not able yet to add a subnavigation (a "tab" for a plugin page) by using a layer.php.
This is what is needed:
I registered a layer.php with my plugin and tried (without success):
<?php
class qa_html_theme_layer extends qa_html_theme_base
{
function doctype() {
//if($this->template == 'users' && (qa_get_logged_in_handle() === $this->_user_handle() || qa_opt('user_act_list_show'))) {
if($this->template == 'users' || $this->template == 'bestusers' ) {
if(!isset($this->content['navigation']['sub'])) {
$this->content['navigation']['sub'] = array(
'profile' => array(
'url' => qa_path_html('user/'.$this->_user_handle(), null, qa_opt('site_url')),
'label' => $this->_user_handle(),
'selected' => !qa_get('tab')?true:false
),
'history' => array(
'url' => qa_path_html('user/'.$this->_user_handle(), array('tab'=>'history'), qa_opt('site_url')),
'label' => qa_opt('user_act_list_tab'),
'selected' => qa_get('tab')=='history'?true:false
),
);
}
else {
$this->content['navigation']['sub']['users$'] = array(
'url' => qa_path_html('users'),
'label' => qa_lang_html('main/highest_users'),
'selected' => qa_get('tab')=='users$'?true:false
);
$this->content['navigation']['sub']['bestusers'] = array(
'url' => "http://www.gute-mathe-fragen.de/bestusers",// qa_path_html('users'),
'label' => "Monatsbeste",
'selected' => qa_get('tab')=='bestusers'?true:false
);
}
}
qa_html_theme_base::doctype();
}
// grab the handle of the profile you're looking at
function _user_handle()
{
$handle = preg_replace( '#^user/([^/]+)#', "$1", $this->request );
return $handle;
}
}
This did not change anything.
For now, I hacked the qa-include/qa-app-format.php with:
around line 1055:
} else {
return array(
// show submenu best users and monthly best
'users$' => array(
'url' => qa_path_html('users'),
'label' => qa_lang_html('main/highest_users'),
),
// eetv: added link to monthly users
'users/bestusers' => array(
'label' => "Monatsbeste",
'url' => "http://www.gute-mathe-fragen.de/bestusers",
),
// end
);
}