View Full Version : Hook for custom block in UserCP
Christos Teriakis
07-22-2011, 04:59 PM
Hello,
I'm trying to add a custom block with menu options in usercp, but I can't find the right hook name to show it as seperate block (if possible first, or under PMs). The only that I succeeded to do, as you can see in the attached screenshot, is to add it at the bottom of the block My Setting.
Thank you
C.T
EquinoxWorld
07-22-2011, 05:23 PM
Try this and place it accordingly in your USERCP_SHELL template.
<div class="block">
<h2 class="blockhead">Your Custom Block title</h2>
<div class="blockbody">
{vb:raw template_hook.usercp_navbar_miscellaneous}</div>
</div>
You can also replace the variable hook with your own code. Just remember to add the appropriate class to the <ul> and <li>.
Christos Teriakis
07-22-2011, 06:08 PM
Try this and place it accordingly in your USERCP_SHELL template.
<div class="block">
<h2 class="blockhead">Your Custom Block title</h2>
<div class="blockbody">
{vb:raw template_hook.usercp_navbar_miscellaneous}</div>
</div>
You can also replace the variable hook with your own code. Just remember to add the appropriate class to the <ul> and <li>.
Thank you for your time to reply, but this is something that I already did as you can see in the screenshot. The problem is that as this is part of custom mod, I want to place it automatically without asking the enduser to edit any template.
EquinoxWorld
07-22-2011, 06:30 PM
Thank you for your time to reply, but this is something that I already did as you can see in the screenshot. The problem is that as this is part of custom mod, I want to place it automatically without asking the enduser to edit any template.
Ahh I get cha. Well you can always register your menu content as a variable then parse it in that hook I mentioned, but that would not solve where it is actually placed. To move the hook you need something else, or create your own hook. Sorry I couldn't be much help. :erm:
P.S.: If you find documentation on how to create your own hook please share :)
Badshah93
07-22-2011, 07:41 PM
1. Open Template USERCP_SHELL and choose any hook which u want.
for ex:
usercp_navbar_myaccount
2. Create New Plugin
Plugin Hook: usercp_nav_complete
Title: Ur wish
Code
$template_hook['usercp_navbar_myaccount'] .= vB_Template::create('mytemplate')->render();
where mytemplate is name of ur template.
and save the plugin. (don't forget to select yes)
Christos Teriakis
07-23-2011, 04:25 AM
1. Open Template USERCP_SHELL and choose any hook which u want.
for ex:
usercp_navbar_myaccount
Thank you for answering but this is something that I already did, but is not what I want. All the hooks in the template USERCP_SHELL are reffering to add data within the "My Settings" block, while I want a seperate block. My current plugin is:
<plugin active="1" executionorder="40">
<title>Classifieds: User CP Navbar Link</title>
<hookname>usercp_nav_complete</hookname>
<phpcode><![CDATA[
$template_hook['usercp_navbar_bottom'] .= vB_Template::create('microclassifieds_usercp_links ')->render();
]]></phpcode>
</plugin>
This add my block at the end of My Settings. I know that by changing the hook name I can move it up, but still will be inside My Settings block.
C.T.
Badshah93
07-23-2011, 05:16 AM
Thank you for answering but this is something that I already did, but is not what I want. All the hooks in the template USERCP_SHELL are reffering to add data within the "My Settings" block, while I want a seperate block. My current plugin is:
<plugin active="1" executionorder="40">
<title>Classifieds: User CP Navbar Link</title>
<hookname>usercp_nav_complete</hookname>
<phpcode><![CDATA[
$template_hook['usercp_navbar_bottom'] .= vB_Template::create('microclassifieds_usercp_links ')->render();
]]></phpcode>
</plugin>
This add my block at the end of My Settings. I know that by changing the hook name I can move it up, but still will be inside My Settings block.
C.T.
ya thats simple.
Have this plugin which u created
<plugin active="1" executionorder="40">
<title>Classifieds: User CP Navbar Link</title>
<hookname>usercp_nav_complete</hookname>
<phpcode><![CDATA[
$template_hook['usercp_navbar_bottom'] .= vB_Template::create('microclassifieds_usercp_links ')->render();
]]></phpcode>
</plugin>
Now Open Template microclassifieds_usercp_links
At Top add this
</ul></div>
</div>
After This U can create ur block and note at last don't add
</ul></div>
</div>
as it is already there in USERCP_SHELL :D
Christos Teriakis
07-23-2011, 07:05 AM
ya thats simple.
Have this plugin which u created
<plugin active="1" executionorder="40">
<title>Classifieds: User CP Navbar Link</title>
<hookname>usercp_nav_complete</hookname>
<phpcode><![CDATA[
$template_hook['usercp_navbar_bottom'] .= vB_Template::create('microclassifieds_usercp_links ')->render();
]]></phpcode>
</plugin>
Now Open Template microclassifieds_usercp_links
At Top add this
</ul></div>
</div>
After This U can create ur block and note at last don't add
</ul></div>
</div>
as it is already there in USERCP_SHELL :D
System Teaser :D. I'll try it right now. Sorry for my delay on replying, but I've stucked building the page.
Thank you
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.