MyBB Community Forums

Full Version: Adding template to ModCP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm currently trying to add another table row to the the ModCP user nav template.

This is my modcp_nav_users template currently.

	<tr>
		<td class="tcat tcat_menu tcat_collapse{$collapsedimg['modcpusers']}">
			<div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['modcpusers']}.png" id="modcpusers_img" class="expander" alt="[-]" title="[-]" /></div>
			<div><span class="smalltext"><strong>{$lang->mcp_nav_users}</strong></span></div>
		</td>
	</tr>
	<tbody style="{$collapsed['modcpusers_e']}" id="modcpusers_e">
		{$nav_editprofile}
		{$nav_banning}
		{$nav_warninglogs}
		{$nav_ipsearch}
	</tbody>

I created another template named modcp_nav_unread with the contents

<tr><td class="trow1 smalltext"><a href="modcp.php?action=request" class="modcp_nav_item modcp_nav_ipsearch">Unread</a></td></tr>




I then edited to my modcp_nav_users template to include the modcp_nav_unread template by doing the below however it doesn't add the new template to modcp

	<tr>
		<td class="tcat tcat_menu tcat_collapse{$collapsedimg['modcpusers']}">
			<div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['modcpusers']}.png" id="modcpusers_img" class="expander" alt="[-]" title="[-]" /></div>
			<div><span class="smalltext"><strong>{$lang->mcp_nav_users}</strong></span></div>
		</td>
	</tr>
	<tbody style="{$collapsed['modcpusers_e']}" id="modcpusers_e">
		{$nav_editprofile}
		{$nav_banning}
		{$nav_warninglogs}
		{$nav_ipsearch}
                {$nav_unread}

	</tbody>
you can use template conditionals plugin to add new templates within existing templates
<template new_template_name>

eg. <template modcp_nav_unread>
(2016-01-05, 04:48 PM).m. Wrote: [ -> ]you can use template conditionals plugin to add new templates within existing templates
<template new_template_name>

eg. <template modcp_nav_unread>

Is this the only way to do it? I can see other templates being linked in the modcp_nav_users already which work fine.
^ well, they are evaluated through modcp.php file
eg. --> https://github.com/mybb/mybb/blob/featur...p.php#L258
eval("\$nav_ipsearch = \"".$templates->get("modcp_nav_ipsearch")."\";");
(2016-01-05, 05:02 PM).m. Wrote: [ -> ]^ well, they are evaluated through modcp.php file
eg. --> https://github.com/mybb/mybb/blob/featur...p.php#L258

eval("\$nav_ipsearch = \"".$templates->get("modcp_nav_ipsearch")."\";");

So from a plugin stance there is no easy way to do this except from modifying modcp.php?
for coding the plugin, please see creating & modifying templates