The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
Writing my first plug-in/product, several newbie questions.
Disclaimer: I've been reading the API and will continue to do so, just trying to get a feel for this and hopefully some folks will be patient enough to do a little hand-holding.
I'm trying to write my first plugin, something extremely basic, just to get the feel for how it works. I'm decent with template edits and variables, but I've never attempted writing a plugin before, and would really like to. That said, I'm looking to write a simple plugin to drop a variable into a template. In FORUMHOME, here's the default Who's Online: Code:
<a href="online.php$session[sessionurl_q]" rel="nofollow">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>) Code:
Invisible: $numberinvisible Code:
<a href="online.php$session[sessionurl_q]" rel="nofollow">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>) Invisible: $numberinvisible Code:
($hook = vBulletinHook::fetch_hook('forumhome_loggedinuser')) ? eval($hook) : false; So in using the basic code from the howto post, I come up with something like: Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <plugins> <plugin active="1"> <title>Chris's Newbie Plugin</title> <hookname>forumhome_loggedinuser</hookname> <phpcode> <![CDATA[ ]]> </phpcode> </plugin> </plugins> A: Where the actual code goes. B: How I tell vB where to actually put it, (Eg: "directly following $vbphrase[x_members_and_y_guests]</phrase>) ". I'm guessing that the code that I want to inject goes inside the CDATA brackets, like this: Code:
<![CDATA[Invisible: $numberinvisible]]> If anyone could shed some light on where I should go from here, I'd really appreciate the help. In the meantime I'll keep scouring the docs. :bunny: Update #1 Here's what I have so far, but I don't think I'm going about it correctly: Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <product productid="chris777_showinvisible" active="1"> <title>Show Invisible Users</title> <description>Will add a count of invisible users in WGO.</description> <version>1.0.0</version> <codes> </codes> <templates> </templates> <plugins> <plugin active="1"> <title>Show Invisible Users</title> <hookname>forumhome_loggedinuser</hookname> <phpcode><![CDATA[ if ($totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)) { Invisible: $numberinvisible; } ]]> </phpcode> </plugin> </plugins> <phrases> </phrases> <options> </options> </product> [high]* Guest210212002 scratches his head and continues to dig.[/high] |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|