The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Been going through the new vb code. It looks like it was all switched to OOP? Is that right?
BTW, I hate OOP (never could understand it). Not really sure why after all this time vb had to switch. Was there a good reason? Anyway, I'm not going to switch to another bbs even though this is quite upsetting, but now I have to learn a whole bunch of new stuff. When replying to a post, I tried to understand what the heck is going on. Where the variables are. One include calls another calls another which defines another include file in a variable which then calls back the file that called it (!!) and when you track all that down, nothing makes sense anymore. Upshot, I figure the data is in a variable called $dataman. So I try to echo it to find out what's going on. And it says $dataman is an object. Damn. Well, how do you echo an object? Every version of vb gets more and more complicated and I'm wondering if this will eventually turn into too much bloat. I hope you guys are thinking about this. And it would be nice if you asked for some feedback before making a change like moving to OOP. You don't have to, but it would be appreciated and maybe help the product in the end? This may sound like a ranting complaint, but it's not meant that way. Just trying to give you feedback. |
#2
|
||||
|
||||
![]()
$object->var;
$object->function(); I think :P |
#3
|
||||
|
||||
![]() Quote:
$object->dataman; $object->function(); ? Or does that function() have to point to some actual function? |
#4
|
|||
|
|||
![]()
Think if objects as "containers" for functions and variables The structure for the object is defined in a class. Take a look at includes/class_dm_threadpost.php.
You'll see that each class has various functions and varables defined within it. When vBulletin creates a new obkect, it uses something like: Code:
$myObject = new vB_DataManager_Post(); Code:
// Call a function $myObject->verify_title("my post title here"); // Use a variable - prints the $post var (an array) print_r($myObject->post); Take a look at http://www.phpfreaks.com/tutorials/48/0.php for an intro to OOP ![]() |
#5
|
||||
|
||||
![]()
Thanks Alan, I'll check it out.
In the meantime, perhaps you can help me. I'm trying to figure out in class_core.php how to pull out the username or userid of the current user. In the old version it would be $bbuserinfo[userid]. Inside function save() line 2285 of a virgin copy...or inside function vB_Input_Cleaner(&$registry) around line 1402, I'd like to print out the userid for debugging purposes. Any help would be most appreciated! |
#6
|
|||
|
|||
![]()
The userinfo is stored in the (suprisingly) userinfo array
![]() Code:
echo $vbulletin->userinfo['userid']; echo $vbulletin->userinfo['username']; echo $vbulletin->userinfo['etc...etc']; |
#7
|
||||
|
||||
![]()
1) For Debug Output one should use DEVDEBUG instead of echo ... doesn't destroy the Layout
![]() 2) You can "output" an object just like an array: print_r($object) 3) OOP is a great concept, although PHP (yet?) isn't "really" object-orientated. 4) In the constructor (and all Methods of Class vB_Input_Cleaner), the Userid is available as PHP Code:
|
#8
|
|||||
|
|||||
![]() Quote:
Tried printing random stuff on same line to make sure that the echo is working. It does. Seems that userid is not populated? I am logged in when trying it. Quote:
Do you have to turn on debug mode? In config.php? $config=1;? Quote:
Quote:
Quote:
Tried: echo $this->registry->userinfo['userid']; Tried: $test= $this->registry->userinfo['userid']; echo $test; etcetera... |
#9
|
||||
|
||||
![]()
1) Yes, Debug-Mode must be enabled to get DEVDEBUG() working.
Place PHP Code:
2) Nobody who is seriously programming argues against OOP ![]() There are strong arguments for OOP, but explaining that here would be too much. 3) Where exactly (Version, Linenumber in unmodified Code) did you try the echo? |
#10
|
||||
|
||||
![]() Quote:
class_core.php version rc1 Line 2296 and line 1434 |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|