Log in

View Full Version : Help with a plugin?


MThornback
05-14-2006, 05:46 AM
I'm trying my hand at a simple plugin to allow a quick switch between visible and invisible from under the username in the navbar....but for the life of me I can't get it to work (not so simple eh?) can anyone point me in the right direction?

Its much appreciated!

Alan @ CIT
05-14-2006, 08:16 AM
You haven't got any code in your plugin to set the visible status at the moment. Take a look at profile.php, line 1142 (in an un-modified file). The invisible option is stored in a bitfield for the users options, so once set, you'll need to update them for the users account.

Completely un-tested, but something like the following should work:


$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($vbulletin->userinfo);

$userdata->set_bitfield('options', 'invisible', 'set_options[invisible]');

$userdata->save


You'll need to play about with it a bit to get it working, but that should get you started.

Thanks,
Alan.

MThornback
05-14-2006, 07:43 PM
Thanks Alan!

One more question now...kinda the obvious one for a newbie...

How do I take a+b to make c?

I have the code for the variable and you just provided me with some basics to update the profile...but how do I take what you did and apply it to what I started with....

I looked at the code on that line (its unedited) and the $key variable is messing me up...its the only one I don't see what it does....but options[invisible] or anything close to it is nowhere to be seen....

I know i'm being a pest :p but asking questions and seeing how it all comes together will help me break it down myself next time...I appreciate your patience :)

MThornback
05-16-2006, 04:04 PM
*bump* apologies....but i'm still stuck...