PDA

View Full Version : [ASK] vBulletin PHP Code


sakuduku
07-31-2012, 07:11 PM
hi all,

i have a few questions about vbulletin php code,,

what is the php code for :

total post
total thread
total users
users online
latest threads
hot threads


thank :)

--------------- Added 1343768558 at 1343768558 ---------------

somebody please help me :(

Simon Lloyd
07-31-2012, 08:58 PM
In vbulletin options (settings for vb4) set the SHOW HTML COMMENTS to yes (this will show you which templates are called and closed, then put your forum in to debug mode https://www.vbulletin.com/docs/html/config.php and check what templates are called and look at the code in them!

fxdigi-cash
05-25-2013, 02:12 PM
I also wanted to know the answers to the original question since vbulletin doesn't provide any support for coding ...

Simon Lloyd
05-25-2013, 05:06 PM
The answer remains the same, this is how we all learnt, look at where you want to change something and check the templates called for that area, then investigate the code that looks like it does what you want in that area, when you get stuck post your particular question in these forums and someone who has experience with that will answer :)

fxdigi-cash
05-25-2013, 05:24 PM
ok, well said.

The problem is that we have no idea what variables to start with. for example, what variable is use for latest threads, hottest threads, latest replies...

It is easy to modify a custom page, but not really when it comes to variables ...

is there a list of variables that we can play with to get to the start ...?

Thanks

Simon Lloyd
05-25-2013, 05:41 PM
Unfortunately theres nio list of variables although this will help http://www.vbulletin.com/docs/html?manualversion=30807603 and maybe more so this one https://members.vbulletin.com/api/index.html it contains all the api's...etc thats in the vbulletin product.

As i said though, turn on debugging and look at the templates and hooks called, thjat will give you a much better idea.

nerbert
05-25-2013, 08:58 PM
Make a plugin with this code:


if($vbulletin->userinfo['username'] == 'Dr. Ben Dover')
{
echo '<pre>';
print_r($show);
echo '<br><br><br>';
print_r($vbulletin->options);
echo '</pre>';
}


Put in your real name in the first line, of course.

This will show a lot of settings. Look through the various php files and find other arrays too and print_r them

Simon Lloyd
05-25-2013, 10:24 PM
Make a plugin with this code:


if($vbulletin->userinfo['username'] == 'Dr. Ben Dover')
{
echo '<pre>';
print_r($show);
echo '<br><br><br>';
print_r($vbulletin->options);
echo '</pre>';
}


Put in your real name in the first line, of course.

This will show a lot of settings. Look through the various php files and find other arrays too and print_r them

Whilst that will show some things it wont be of any use as all it will show is the settings in vbulletin options and their variable name, it wont show any template variables, conditionals or logic, this can only be done by studying the documentation, looking at which templates are called and which php files they belong to then searching those for your particular variables that you think you might use.

Sorry it seems so hard but that really is the only way :(

fxdigi-cash
05-26-2013, 02:17 AM
ok, sounds like things are clear. I believe the shortest way is to go through some plugin such as vsa advanced state to break it into pieces and see how to use such codes in a custom page though trial and error tests...

Thanks, I guess that will do.

Simon Lloyd
05-26-2013, 02:26 AM
Yep, study their plugins, it will call a php file, look at that file for the particular section that contains the variable you're looking at. Unfortunately trial and error is the only way to go unless you're a php guru :)

fxdigi-cash
05-26-2013, 02:34 AM
ok, somehow this is what I was expecting since I have been looking for a similar issue for days...

Great, Thanks a lot. will start digging with php coding then

Simon Lloyd
05-26-2013, 03:20 AM
It looks like you are trying to get stats for something, dont reinvent the wheel :) https://vborg.vbsupport.ru/showthread.php?t=235841

fxdigi-cash
05-26-2013, 03:38 AM
you are right. This is where I started, but here is a quick question though. If I installed this plugin to my vb, and disable it... then would I be able to use its codes on a custom page even though it was originally made to forumhome??

I'm not aware if codes of plugins can be used when disabled...

correct me if I'm wrong...

Simon Lloyd
05-26-2013, 03:43 AM
if you disable it then the plugins will be disabled, however there's nothing to stop you using the contents of the plugins in your own plugins. One thing you will need to look at is how the stats are displayed, they are obviously using hooks and variables that are only available on forumhome so they wont automatically work elsewhere unless that varible is available there :)

fxdigi-cash
05-26-2013, 04:11 AM
good to know this info. in this case I have to re-generate separated or individual plugins based on this mod mentioned above....

I will start testing that soon...

Thanks for the valuable info

Simon Lloyd
05-26-2013, 04:20 AM
You're welcome, good luck!

fxdigi-cash
05-26-2013, 05:08 AM
Thanks @ Simon Lloyd's (https://vborg.vbsupport.ru/member.php?u=267852)

initial tests show that it works; individual codes, but the only issue is that I want to show the stats on a custom page... I think it is not that hard to go with ...

any idea how to let this mod work on a custom page only no Forumhome...!!

I think that I will try to play a little with the plugin query a little to see how to place the code on some pages not all of them...

any feedback is appreciated

Thanks

Simon Lloyd
05-26-2013, 04:53 PM
You need to turn debugging on as i mentioned and check what hooks....etc are called for particular pages, that way you'll have a really good base to start from.