PDA

View Full Version : Plugin Used By Multiple Skins - Minor Issue


Amross
11-08-2007, 01:55 AM
I apologize for my beginner knowledge, however I am new to vBulletin and as such, also new to coding for vBulletin.

I have a plugin with the following code:


if (!$this->post['avatarurl'])
{
$this->post['avatarurl'] = "themes/icy/images/noavatar.gif";
}
if ($this->registry->userinfo['showavatars'])
{
$show['avatar'] = true;
}


It works great and all, however I have multiple skins installed that utilize this plugin. The issue comes in where the url 'themes/icy/images/noavatar.gif' is hard coded in the plugin and thus no matter which one of my installed skins are being used by the user, it always uses the no avatar image associated with the 'icy' skin. Is there a predefined vb variable that I can use to replace the skin name (in this case, 'icy') or at the very least a variable to replace the entire path (in this case 'themes/icy/images/') so that no matter which skin is loaded, it will always reference the correct noavatar.gif image for that particular skin?

Thanks in advance.

sunilvarma
11-08-2007, 02:40 PM
you can access the misc directory of any skin using the $stylevar[imgdir_misc]. so put three the noavatar gifs in the three misc folders and change the url in the plugin to:

$this->post['avatarurl'] = "$stylevar[imgdir_misc]/noavatar.gif";

let me know if it works. :)

Amross
11-08-2007, 11:59 PM
Thanks for your help, sunilvarma. I took what you said and even pushed the plugin one step further.

After your response, I read through the stylevars vBulletin documentation and it provided a lot of insight. I guess it's definitely a worth while read for those new to the world of vBulletin coding.