The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi,
I'm trying to develop a class to write new threads on vbulletin. This is my code PHP Code:
http://www.cyberludus.com/forum/codeigniter_bridge.php Where I do wrong? Thank you! |
|
#2
|
|||
|
|||
|
You need to pass a valid vBulletin registry object to the datamanager; in your script, $vbulletin doesn't have the proper scope in your method.
Pass $vbulletin through the constructor: PHP Code:
|
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
|||
|
|||
|
Well I saw he had PHP 4 specific syntax (such as the constructor), so I provided my code with the same OO flavor. If you are running < PHP 5, you have to explicitly pass by reference or else you'll get some funky results.
|
|
#5
|
|||
|
|||
|
Ok, now it works!
Thank you. Code:
<?php
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
class codeigniter_bridge{
function codeigniter_bridge(&$registry){
echo "Create Registry <br/>";
$this->Registry =& $registry;
echo "Is registry an object? ".is_object($this->Registry)."<br/>";
echo "Create Object <br/>";
$this->threaddm =& datamanager_init('Thread', $this->Registry, ERRTYPE_ARRAY, 'threadpost');
echo "Object Created<br/>";
}
function postThread(){
echo "Call Prova<br/>";
$class_methods = get_class_methods($this->threaddm);
foreach ($class_methods as $method_name) {
echo "$method_name<br/>\n";
}
}
}
$vb =& new codeigniter_bridge($vbulletin);
$vb->postThread();
?>
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|