Log in

View Full Version : Plugin Help


Ipuck
04-07-2009, 04:35 PM
I'm trying to create a plugin to add a link to the users photo album on the users pop menu.

I did this:

$template_hook [postbit_user_popup] = '<tr><td class="vbmenu_option"><a href="album.php?u=$post[userid]">Visit $post[username]'s photo album</a></td></tr>';

The links is inserted, but the link doesn't work. It shows the variable name and not the value.

BTW I have vBSEO

Any help will be appreciated.

Lynne
04-07-2009, 05:03 PM
You might need to go ' . $post[userid] . ' with the variables. And you may have to put a single quote around it $post['userid'] . I can never remember when you need to or don't need to.

ragtek
04-07-2009, 05:11 PM
1. you have to espace the '
2. your missing a . before the =
3. lynne posted it. you cant do it that way, if you want, you'll have to create a template for it and to attach it this way:


eval('$template_hook [\'postbit_user_popup\'] .= "' . fetch_template('yourtemplate') . '";');

Lynne
04-07-2009, 05:19 PM
I just looked through my plugins, and while most of them do the eval statement for the template_hook, I do have a couple that do it directly like he is. However, I did escape the quotes and also put single quotes around the variables in mine.

Ipuck
04-07-2009, 05:33 PM
Thanks guys!!

By just changing this: ' . $post[userid] . ' fixed the problem.

ragtek
04-07-2009, 05:34 PM
I just looked through my plugins, and while most of them do the eval statement for the template_hook, I do have a couple that do it directly like he is. However, I did escape the quotes and also put single quotes around the variables in mine.


I'm meaning this:


= '<tr><td c...Visit $post[username]'s photo

Normaly that should throw an error