MyBB Community Forums

Full Version: Custom UCP Page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Custom UCP Page

Description
This plugin adds a new UCP page which can be edited through the ACP. You can enable/disable the plugin and change the page text. HTML is supported in the page, so you can basically use it for anything.

Download: http://community.mybb.com/mods.php?action=view&pid=602

Screenshots are provided on the download page. As always, if you require any support, please reply to this thread and I will do my best to help you out.

This has been tested on MyBB 1.8.* and I have not tested this on any other versions. There shouldn't be any problems on 1.6 however.

How to install:

1. Unzip the cpage.zip
2. Upload /inc/plugins/cpage.php to your boards /inc/plugins folder
3. Upload /inc/languages/english/cpage.lang.php and /inc/languages/english/admin/cpage.lang.php to your boards /inc/languages folder
4. Install and Activate the plugins in your Admin Control Panel > Plugins page
5. Edit your settings under Configuration. You can also edit the template it uses in the Templates & Styles > Templates > Global Templates > cpage
Should help a lot of people out, thanks for the contribution.
What if they need to add two different custom pages?
They would need to rename the files, plus the name of the plugin/language packs within /ic/plugins/cpage.php

Future version will include how many pages to add.
I have little sugestion

IMHO best way to add new bit to menu is

Hook

$plugins->add_hook("usercp_menu_built", "cpage_usercp_menu");

func

function cpage_usercp_menu()
{
	global $lang, $mybb, $templates, $usercpnav, $cpage;
	$lang->load('cpage');
	
	if($mybb->usergroup['cpage'] != '1')
	{
		$cpage = "";
	}
	else
	{
		eval("\$cpage= \"".$templates->get("cpage_usercp_menu")."\";");
	}

	$usercpnav = str_replace("{cpage}", $cpage, $usercpnav);
}

activate/deactivate

activate
find_replace_templatesets('usercp_nav_misc', '#'.preg_quote('<tbody style="{$collapsed[\'usercpmisc_e\']}" id="usercpmisc_e">').'#', '<tbody style="{$collapsed[\'usercpmisc_e\']}" id="usercpmisc_e">'."\n\t".'{cpage}');
deactivate
find_replace_templatesets('usercp_nav_misc', '#' . preg_quote("\n\t".'{cpage}') . '#', '', 0);

and now link is in the template and yo can easy use lang variables
there is no need to load lang in activate func
Thanks for the suggestions.

It is my first plugin obviously so my next release on this will have cleaner/easier to use code with extra features.

Regards.
Could there be an Update for this?
Yes, updates are planned.