PDA

View Full Version : Using memberaction_dropdown in a custom template?


Cryo
03-26-2010, 12:18 AM
Hello,

I have a plugin that is acting as a postbit replacement. Basically, the plugin calls my custom template then registers post variables and makes it accessible to the postbit_legacy template. I have this working fine, and everything displays as it should. However, when I attempt to use...

{vb:raw memberaction_dropdown}

... it does not work, nothing displays at all. How can I make this accessible to my template?

Thanks in advance.

ForumsMods
03-26-2010, 03:24 AM
$memberaction_dropdown = construct_memberaction_dropdown($post, $template_hook);

Cryo
03-26-2010, 06:13 AM
Thanks very much for the reply. I added in the manner I thought it should be, but the only thing I get is a bracket. If you wouldn't mind, could you point me in the right direction to make this work?

// Assemble Dropdown
$memberaction_dropdown = construct_memberaction_dropdown($post, $template_hook);

// Load Avatar Template
$dotemplate = vB_Template::create('avatarpanel');

$dotemplate->register('poster', $this->post);
$dotemplate->register('dd', $memberaction_dropdown);
$values['avatarpanel'] = $dotemplate->render();

vB_Template::preRegister('postbit_legacy', $values);

My template is calling...

{vb:raw dd.memberaction_dropdown}

King Kovifor
03-27-2010, 03:26 AM
If it is within your template, you would want to call just:

{vb:raw dd}

As

{vb:raw dd.memberaction_dropdown}

Implies code such as this:

$dd = array('memberaction_dropdown' => $memberaction_dropdown);

The registering of a variable is strictly that. You create a variable and assign it a value. In your case dd is defined as $memberaction_dropdown. So where ever you use {vb:raw dd} the contents of $memberaction_dropdown will be displayed.

Cryo
03-27-2010, 05:37 PM
Ah, seems so simple now! Thank you both, it worked. :)

wolfe
05-25-2014, 09:52 PM
sorry to bump and old thread but i have used this code all is working perfectly except it is showing everyone as offline ?

--------------- Added 1401058589 at 1401058589 ---------------

sorted it forgot to call user.lastactivity, user.lastvisit :)