MyBB Community Forums

Full Version: User Panel
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I use the User Panel as template for my plugin?

Much alike when you read a private message, I did like to have my code display on the same place the private messages are shown and in the future have a link option to my plugin on the menu on the left.

Initially I just wanted to know how to add my own page on the right side without having to bloat all the code of the menu and alike if at all possible. But if u can also show to add the Link that is a plus. ;P

Some sample code or guidance on how to achieve that is greatly appreciated...

Thanks in advance...

PS: If you are a bit confused about what I am talking about, see below my uber drawing skills for an example:

[Image: EiO2XWa.png]
1. You need hooks (usercp_start)
2. Include $usercpnav in the global list
3. the action
if($mybb->input['action'] == 'mycustomcp')
{
   // code goes here
}

And then to access it, you of course need a template which can be done using eval() & output_page() function, and the url would be: usercp.php?action=mycustomcp

Just let me know if you need help. I hope you understand what I wrote above, sorry for my grammar.
Hi Sazze,

Yes, perfectly understandable Wink, thanks for such detailed answer. I will try to write some scrap code to see how it goes and report back once I can.

It worked like a charm, but I have a few questions left.

Is it possible to override some menu options that already exist in there?

Like I want remove the Private Messages stuff from the menu on the left and put my own links or add my own links on top of the Private Messages ones...
(2016-03-16, 09:58 PM)sleeping Wrote: [ -> ]Hi Sazze,

Yes, perfectly understandable Wink, thanks for such detailed answer. I will try to write some scrap code to see how it goes and report back once I can.

It worked like a charm, but I have a few questions left.

Is it possible to override some menu options that already exist in there?

Like I want remove the Private Messages stuff from the menu on the left and put my own links or add my own links on top of the Private Messages ones...

On the install/activate function, try this:
require_once MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets( 'THE_TEMPLATE', '#'.preg_quote( '{$THE_VARIABLE}' ).'#i', '{$REPLACE_WITH_THIS_VARIABLE}' );
rebuild_settings();

This will replace {$THE_VARIABLE} with {$REPLACE_WITH_THIS_VARIABLE}, I hope you get the idea. And oh, don't forget to change the THE_TEMPLATE to the right template.