Current time: 01-09-2009, 02:29 AM Hello There, Guest! (LoginRegister)


Post Reply 
how to add a menu to the user cp
08-21-2008, 09:27 AM
Post: #1
how to add a menu to the user cp
ok i a new to make plugins to mybb but i am tring to work out to add a new text like to the user cp eg on Miscellaneous Dodgy as i need a link to show for the rest of my plug-ins as it need to got to a new page for my plugin to work i not even do this part yet as there is not point in doing so unless the basics have been done

cheers

thank you for your help

Hosting Reviews
bored ?Free online games
Find all posts by this user
Quote this message in a reply
08-21-2008, 06:14 PM
Post: #2
RE: how to add a menu to the user cp
Just edit the template "usercp_nav_misc." Just copy/paste a line, then edit it to your likings.

-Renegade SQA Team Member
XHTML/CSS Designer, PHP & MySQL Developer | My Twitter
I will burn any support PMs sent to me.
[Image: affbanner.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
08-21-2008, 09:35 PM
Post: #3
RE: how to add a menu to the user cp
ok thank you i only want the link to show when my plugin is active so do i use usercp_nav_misc as a hook? and just added the html code link i want to show.

Hosting Reviews
bored ?Free online games
Find all posts by this user
Quote this message in a reply
08-21-2008, 09:55 PM
Post: #4
RE: how to add a menu to the user cp
You insert your HTML modifications when in your plugin's activate function. When you deactivate the plugin, you remove the HTML modifications to the template. See the find_replace_templatesets function in inc/adminfunctions_templates.php

[Image: sig.php?mybb]
Visit this user's website Find all posts by this user
Quote this message in a reply
08-25-2008, 11:43 AM (This post was last modified: 08-25-2008 11:56 AM by Tazfan.)
Post: #5
RE: how to add a menu to the user cp
is this right cos i dont seem to be working
PHP Code:
<?php

function MemberRefer_info()

{

    return array(

        
'name'            => 'plugin infor',

        
'description'    => 'what it dose',

        
'website'        => 'site.com',

        
'author'        => 'tazfan',

        
'authorsite'    => 'site.com',

        
'version'        => '1.0'

        "guid"            
=> "Okcjhfieloksie8kd",

        
"compatibility" => "14*",

    );

}

function 
MemberRefer_activate()

{

    
// start of the mod when it is active
$addlink->add_hook("usercp_nav_misc ""<tr><td class="trow1 smalltext"><a href="page.php" class="usercp_nav_item usercp_nav_usergroups">The link</a></td></tr>");
    

}

function 
MemberRefer_deactivate()

{

    
// end of script
    

}


?>

cos for some reason i get


Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/user/public_html/site/forums/inc/plugins/MemberRefer.php on line 11

Hosting Reviews
bored ?Free online games
Find all posts by this user
Quote this message in a reply
08-25-2008, 12:32 PM
Post: #6
RE: how to add a menu to the user cp
That is not correct. "add_hook" always goes before any of the functions in your plugin. Plus, you must use the find_replace_templatesets function to add things into templates.

Also, are you using MemberRefer_activate as your run function? If so, that doesn't work. The _activate and _deactivate are for when you activate and deactivate the plugin in your ACP.

I suggest browsing through some plugins (perhaps Ryan's, since he explains most of what goes on in his plugins).

-Renegade SQA Team Member
XHTML/CSS Designer, PHP & MySQL Developer | My Twitter
I will burn any support PMs sent to me.
[Image: affbanner.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
08-25-2008, 12:55 PM (This post was last modified: 08-25-2008 04:49 PM by Tazfan.)
Post: #7
RE: how to add a menu to the user cp
a i i see what i have been doing wrong and yes Ryans plugins are great to learn from i miss this when i program with people do not comment Big Grin

thank you Ryan for making your plugins easy to fellow and RenegadeFan cheers for the heads up Big Grin
ok sorry guys i need more help

would this be right to get the link added to the menu when the user has the plugin activate

PHP Code:
function memberrefer_activate()
{
include 
MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("usercp_nav_misc"#{\<tr><td class="trow1 smalltext"><a href="page.php" class="usercp_nav_item usercp_nav_usergroups">The link</a></td></tr>");



if not what would i do Confused

Hosting Reviews
bored ?Free online games
Find all posts by this user
Quote this message in a reply
08-25-2008, 08:56 PM
Post: #8
RE: how to add a menu to the user cp
It needs to be like this:
PHP Code:
function memberrefer_activate()
{
include 
MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("usercp_nav_misc"'#'.preg_quote('{$lang->ucp_nav_view_profile}</a></td></tr>').'#''{$lang->ucp_nav_view_profile}</a></td></tr><tr><td class="trow1 smalltext"><a href="page.php" class="usercp_nav_item usercp_nav_usergroups">The link</a></td></tr>';


That will find the last link under the "Miscellaneous" category (View Profile by default) and add your link under it.

-Renegade SQA Team Member
XHTML/CSS Designer, PHP & MySQL Developer | My Twitter
I will burn any support PMs sent to me.
[Image: affbanner.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: