Log in

View Full Version : conditional in member profile plugin


squishi
07-19-2008, 05:28 PM
I created a custom profile field with the ID 44 and entered a string in that field for my account.
Then I wrote a simple "hello world" plugin that looks like this:

echo "OUTPUT: ";
echo $bbuserinfo['field44'];

It is run with the member_start hook.

The first echo is executed on the member profile, the other echo is not executed.
How can I fix this?
Or do I have to write a query to get the profile field in the plugin?

$post['field44'] does not work and neither does $userinfo['field44'] on that plugin.
Later, I want to write a conditional and display some variables in the templates. But I first need to know how to access the custom profile field from the member profile plugin.

Opserty
07-19-2008, 05:51 PM
You shouldn't echo directly to the browser. Place the variable in a template.

For the browsing user $bbuserinfo[field44] should work. For the member who's profile you are browsing you may need to use $prepared[field44] or $userinfo[field44]

squishi
07-19-2008, 06:07 PM
Doesn't matter if I echo it directly or use it in a template. It's for testing purposes only.
As I said, once I see that the variable is not empty, I will use it for a condition in the plugin.

$bbuserinfo[field44] does not work in the plugin. :(

--------------- Added 1216494701 at 1216494701 ---------------

Take for example this plugin code:

if ($bbuserinfo['field44']){

echo "OUTPUT: ";
echo $bbuserinfo['field44'];

}

The if condition is not executed, because something's not right with the bbuserinfo variable.

Opserty
07-19-2008, 07:13 PM
Oh wait, plugin...

My bad I forgot. Try $vbulletin->userinfo instead of $bbuserinfo.

Use var_dump() instead of echo() it provides more info.

squishi
07-19-2008, 08:00 PM
Thanks, man. That worked. :)