vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Miscellaneous Hacks - World of Warcraft Class Recruitment Status module (db backend) (https://vborg.vbsupport.ru/showthread.php?t=137670)

turnipofdoom 02-02-2007 11:18 AM

Ahh right on, I will update the package tonight but to fix it change

Code:

private $vbObj;
to

Code:

var $vbObj;
private is not supported until php5..

Xylo 02-02-2007 04:17 PM

Quote:

Originally Posted by turnipofdoom (Post 1172884)
Ahh right on, I will update the package tonight but to fix it change

Code:

private $vbObj;
to

Code:

var $vbObj;
private is not supported until php5..

Upgraded to PHP 5.1.2. Tried it both ways and still get the same error.

Xylo 02-02-2007 04:44 PM

Some follow up troubleshooting:

Broke down the query line into two parts to find out which was failing:

31: $temp = $this->vbObj->db->query_read( "SELECT status FROM recruitment WHERE class='$query'" );
32: $result = $this->vbObj->db->fetch_array( $temp );

Failed at line 31 still (Fatal error: Call to a member function query_read() on a non-object)

So thinking vbObj is borked I put in

if ($this->vbObj == null) print ( "vbObj = null");

.. and got:

Recruitment
Druid: vbObj = null
Fatal error: Call to a member function query_read() on a non-object

So yeah I'm guessing the constructor didn't get called (?) or didn't return a valid object. So checking that I put in:
if ($this->vbObj == null) print ( "vbObj = null");
global $vbulletin;
$vbObj = $vbulletin;
if ($vbObj == null) print ( "vbObj2 = null");
if ($vbulletin == null) print ( "vbulletin = null");

.. which gives me
vbObj = null
vbObj2 = null
vbulletin = null

So the problem is with the constructor not returning a valid object. Trying to figure that one out now.

turnipofdoom 02-02-2007 05:57 PM

right, ima dumbass __construct is only valid in php5...

change

Code:

function __construct()......

to

function recruit()

and that "should" solve the lack of compatability i coded into it ;p

turnipofdoom 02-02-2007 06:18 PM

Please click installed. <3

Xylo 02-02-2007 08:54 PM

Quote:

Originally Posted by turnipofdoom (Post 1173123)
right, ima dumbass __construct is only valid in php5...

change

Code:

function __construct()......

to

function recruit()

and that "should" solve the lack of compatability i coded into it ;p

BTW, see above. I upgraded to PHP 5.1.2. I confirmed the constructor is being called now by doing the following:

Code:

class recruit {

        private $vbObj;
        private $init=0;

        public function __construct()
        {
                        global $vbulletin;
                        $this->vbObj = $vbulletin;
                        $this->init = 1;
                        return $this->vbObj;
        }

        function getStatus( $query )
        {
                print ( "Init = $this->init" );
                $result = $this->vbObj->db->fetch_array( $this->vbObj->db->quer$

                return strip_tags( $result['status'] );
        }

After recruitStatus.php does $class = new recruit() and then calls $class->getStatus(), Init prints out that it is indeed a 1. Changed the code again to
Code:

class recruit {

        private $vbObj;
        private $init=0;
        private $vbOnullcheck=0;

        public function __construct()
        {
                        global $vbulletin;
                        $this->vbObj = $vbulletin;
                        $this->init = 1;
                        if ($this->vbObj == null) $this->vbOnullcheck=1;
                        return $this->vbObj;
        }

        function getStatus( $query )
        {
                print ( "<br>Init = $this->init<br>vbOnull = $this->vbOnullchec$
                $result = $this->vbObj->db->fetch_array( $this->vbObj->db->quer$

                return strip_tags( $result['status'] );
        }

which confirms that vbObj is still null, even though the constructor is called.

So why does this
Code:

                        global $vbulletin;
                        $this->vbObj = $vbulletin;

give a null object? I'm not a vbcode expert so I'm really not sure.

turnipofdoom 02-02-2007 10:54 PM

Ok... I missed that you updated to php5. There are a couple options ill leave you with.

I can rewrite a portion of it, and discard the built in vbulletin queries (the global object).
I cannot reproduce the error, I would need some form of shell access to your site (i dont expect this, but i admit im curious on the error, would need vi class_recruit.php edit access lol). and a test page to work with.

In order to get a $vbulletin object to instance, you need to include EXAMPLE.recruitStatus.php in the CMPS as a module.

On the page (VBCMPS page) you are displaying this on you can set Portal Output Global Variables : vbulletin (with out the $).

oh now that i think about you could try.

Code:


$this->vbObj = clone $vbulletin;

or

$this->vbObj =& $vbulletin;

in __construct()

but I have a feeling its not a constructor issue but just global $vbulletin is not instantiating the object. And that, sadly I don't think I can troubleshoot with out being able to reproduce it. (I am by no means a vb expert)

Be happy to fix it and just use the mysql_xxx stuff if you like..

I'd be interested to know if the 3 ppl that clicked install had this issue and never bothered to come back or if it worked.

NightPhoenix 02-11-2007 06:19 AM

I'm having similar issues.

I have PHP5

Line 19 of class_recruit.php (didn't save the error)

Line 19 of EXAMPLE.edit_recruit.php (Fatal error: Call to a member function on a non-object modules/EXAMPLE.edit_recruit.php

turnipofdoom 02-12-2007 02:21 PM

typo on line 19 of EXAMPLE.edit_recruit.php

the offending line is
Code:

$class->getStatus('Druid');
change it to

Code:

$data->getStatus( 'Druid' );
line 19 of class_recruit.php is
Code:

private $vbObj;
private is a php5 keyword, try changing it to
Code:

var $vbObj;
and see if that fixes it.

NightPhoenix 02-13-2007 04:10 AM

Also, this part of the SQL is giving me errors (the red part):

CREATE TABLE `recruitment` (
`Class` varchar(15) NOT NULL default '',
`Status` varchar(15) NOT NULL default '',
PRIMARY KEY (`Class`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

I removed it and it went in fine.

I am reinstalling the rest right now to see how it works.


All times are GMT. The time now is 12:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01193 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (14)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete