PDA

View Full Version : How to add a block on member's profile?


Lautaro
12-18-2010, 09:33 PM
Hello,

I need to add a new block on member's profiles, which template should I edit if I want my block to be above the friends block?

thanks !

Lynne
12-18-2010, 10:32 PM
To find the template to modify, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. (Sometimes the template is the one mentioned at the very top of the page source.)

I think it's the MEMBERINFO template, but try the tip above and you should see.

Lautaro
12-19-2010, 12:41 AM
yes, it's the MEMBERINFO template, and inside that there's this:


<vb:comment>sidebar</vb:comment>
{vb:raw template_hook.profile_sidebar_first}
{vb:raw blocks.stats_mini}
{vb:raw template_hook.profile_sidebar_stats}
{vb:raw blocks.friends_mini}
{vb:raw template_hook.profile_sidebar_friends}
{vb:raw blocks.albums}
{vb:raw template_hook.profile_sidebar_albums}
{vb:raw blocks.groups}
{vb:raw template_hook.profile_sidebar_groups}
{vb:raw blocks.visitors}
{vb:raw template_hook.profile_sidebar_last}
<vb:comment>sidebar</vb:comment>


How can I add another block there?

I remember when I used vB3.8.x I simply had to create a new template, I named it template_block_name and include in that list and done, but now It's different, it wont work if I do that.

btw thanks for your help.

Lynne
12-19-2010, 02:37 AM
Use one of the template_hooks - that is what they are there for. You write a plugin, render your sidebar template and then assign the results to the $template_hook.

Lautaro
12-19-2010, 05:48 PM
That's exactly what I don't know how to do, would you mind explaining to me how to do this?

thanks !

Lynne
12-19-2010, 05:57 PM
You need to render your template first and then assign it to the template_hook. Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)

Example from his tutorial:

All your code up here, and then....
/* render template and register variables */
$templater = vB_Template::create('mytemplate');
$templater->register('my_var', $my_var);
$templater->register('my_array', $my_array);
$template_hook['profile_sidebar_stats'] .= $templater->render();