vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Hook for custom block in UserCP (https://vborg.vbsupport.ru/showthread.php?t=267239)

Christos Teriakis 07-22-2011 03:59 PM

Hook for custom block in UserCP
 
1 Attachment(s)
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 04:23 PM

Try this and place it accordingly in your USERCP_SHELL template.

HTML Code:

<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 05:08 PM

Quote:

Originally Posted by EquinoxWorld (Post 2223612)
Try this and place it accordingly in your USERCP_SHELL template.

HTML Code:

<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 05:30 PM

Quote:

Originally Posted by Mr.Classifieds (Post 2223625)
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 06:41 PM

1. Open Template USERCP_SHELL and choose any hook which u want.

for ex:

Code:

usercp_navbar_myaccount

2. Create New Plugin

Plugin Hook: usercp_nav_complete
Title: Ur wish

Code

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 03:25 AM

Quote:

Originally Posted by Sherif (Post 2223645)
1. Open Template USERCP_SHELL and choose any hook which u want.

for ex:

Code:

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:
Code:

<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 04:16 AM

Quote:

Originally Posted by Mr.Classifieds (Post 2223788)
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:
Code:

<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

Code:

<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

Code:

  </ul></div>
               
        </div>


After This U can create ur block and note at last don't add

Code:

  </ul></div>
               
        </div>

as it is already there in USERCP_SHELL :D

Christos Teriakis 07-23-2011 06:05 AM

Quote:

Originally Posted by Sherif (Post 2223793)
ya thats simple.


Have this plugin which u created

Code:

<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

Code:

  </ul></div>
               
        </div>


After This U can create ur block and note at last don't add

Code:

  </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


All times are GMT. The time now is 02:27 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02107 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_code_printable
  • (2)bbcode_html_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete