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 01-26-2007 10:00 PM

World of Warcraft Class Recruitment Status module (db backend)
 
This mod is no longer supported it has been rewritten.

The new mod is available here:
https://vborg.vbsupport.ru/showthread.php?t=150449

turnipofdoom 01-27-2007 07:04 PM

***reserved***

Ntfu2 01-28-2007 02:55 AM

awesome, would love to see more WoW hacks released for sure!

jim6763nva 01-29-2007 03:12 PM

I second that.. I'll have to install this later when I get home. Nice job!

Jim

turnipofdoom 01-30-2007 01:05 PM

Thanks! I also created one for Everquest 2 as well. Glad you like it!

kuromeru 01-30-2007 05:18 PM

Have a link to the EQ2 version?

turnipofdoom 01-30-2007 06:31 PM

I'll clean up the code and remove some of the site-specific things after work, I will try to get it posted here sometime this evening if I can. :)

Xylo 02-01-2007 10:00 PM

Haven't been able to get this to work.

Fatal error: Call to a member function query_read() on a non-object in /forums/modules/class_recruit.php on line 31

Anyone else able to get it to work?

turnipofdoom 02-01-2007 10:02 PM

Quote:

Originally Posted by Xylo (Post 1172523)
Haven't been able to get this to work.

Fatal error: Call to a member function query_read() on a non-object in /forums/modules/class_recruit.php on line 31

Anyone else able to get it to work?

What version of VB are you using ?
Did you use the included example files or write your own forms ?
What version of php ?

Did you populate the database with base data before running it ?

Xylo 02-02-2007 07:32 AM

Quote:

Originally Posted by turnipofdoom (Post 1172526)
What version of VB are you using ?
Did you use the included example files or write your own forms ?
What version of php ?

Did you populate the database with base data before running it ?

vBulletin Version 3.6.4
PHP 4.4.4

The database was pre-populated using the provided script (well cut and past the create and insert lines thus the recruitment table is in the forums database).

I dropped class_recruit.php and recruitStatus.php into the modules directory. Added a php module in CMPS, file to include: recruitStatus.php, no parent, no clean file output.

If I call the module directly I still get

Recruitment
Druid:
Fatal error: Call to a member function fetch_array() on a non-object in /<snippath>/forums/modules/class_recruit.php on line 31

Though maybe the sql was dying (and thus not returning an array). Tried it by hand

mysql> select status from recruitment where class = 'Druid';
+--------+
| status |
+--------+
| Closed |
+--------+
1 row in set (0.00 sec)

mysql> select status from recruitment;
+--------+
| status |
+--------+
| Closed |
| Closed |
| Closed |
| Closed |
| Closed |
| Closed |
| Closed |
| Closed |
| Closed |
+--------+
9 rows in set (0.01 sec)

Seems to work fine. Not sure what's going on. Perhaps I'm setting up the module wrong in CMPS?

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.

NightPhoenix 02-13-2007 04:27 AM

Fatal error: Call to a member function on a non-object

Line 31 of class_recruit.php

turnipofdoom 02-13-2007 02:55 PM

Well Line 31 is blank in my file so here.

for php5 and only 5.

Code:

<?php
/*======================================================================*\
        class_recruit.php
        ------------------------------------------------------------------
       
        * Dark Portal Syndicate http://www.darkportals.com
        * Copyright 2002-2007
        * ------------------
        * class_recruit.php
        * Began: 6/27/05
        * Last Modified 1/27/2007
        * Authors: Delinah Howard, Jessica Zakhar. <site-admins@darkportals.com>
        ------------------------------------------------------------------

\*=======================================================================*/


class recruit {
       
        private $vbObj;
       
        function __construct()
                {       
                        global $vbulletin;
                        $this->vbObj =& $vbulletin;
                       
                }
               
        function getStatus( $query )
        {
               
                $result = $this->vbObj->db->fetch_array(
                                  $this->vbObj->db->query_read( "SELECT status FROM recruitment WHERE class='$query'" ) );
               
                return strip_tags( $result['status'] );
        }

       
        function setStatus( $druid,
                                                $hunter,
                                                $mage,
                                                $paladin,
                                                $priest,
                                                $rogue,
                                                $shaman,
                                                $warlock,
                                                $warrior )
        {
       
        $classes = array(
                                        'Druid' => $this->vbObj->db->escape_string( strip_tags( $druid, '<b>' ) ),
                                        'Hunter' => $this->vbObj->db->escape_string( strip_tags( $hunter, '<b>' ) ),
                                        'Mage' => $this->vbObj->db->escape_string( strip_tags( $mage, '<b>' ) ),
                                        'Paladin' => $this->vbObj->db->escape_string( strip_tags( $paladin, '<b>' ) ),
                                        'Priest' => $this->vbObj->db->escape_string( strip_tags( $priest, '<b>' ) ),
                                        'Rogue' => $this->vbObj->db->escape_string( strip_tags( $rogue, '<b>') ),
                                        'Shaman' => $this->vbObj->db->escape_string( strip_tags( $shaman, '<b>' ) ),
                                        'Warlock' => $this->vbObj->db->escape_string( strip_tags( $warlock, '<b>' ) ),
                                        'Warrior' => $this->vbObj->db->escape_string( strip_tags( $warrior, '<b>' ) )
                                        );

        foreach( $classes AS $key => $value )
                {
                        $query = ( "UPDATE recruitment SET status='$value' WHERE class='$key'" );
                        $this->vbObj->db->query( $query );
                }
        }
}
?>

and php4

Code:

<?php
/*======================================================================*\
        class_recruit.php
        ------------------------------------------------------------------
       
        * Dark Portal Syndicate http://www.darkportals.com
        * Copyright 2002-2007
        * ------------------
        * class_recruit.php
        * Began: 6/27/05
        * Last Modified 1/27/2007
        * Authors: Delinah Howard, Jessica Zakhar. <site-admins@darkportals.com>
        ------------------------------------------------------------------

\*=======================================================================*/


class recruit {
       
        var $vbObj;
       
        function recruit()
                {       
                        global $vbulletin;
                        $this->vbObj =& $vbulletin;
                       
                }
               
        function getStatus( $query )
        {
               
                $result = $this->vbObj->db->fetch_array(
                                  $this->vbObj->db->query_read( "SELECT status FROM recruitment WHERE class='$query'" ) );
               
                return strip_tags( $result['status'] );
        }

       
        function setStatus( $druid,
                                                $hunter,
                                                $mage,
                                                $paladin,
                                                $priest,
                                                $rogue,
                                                $shaman,
                                                $warlock,
                                                $warrior )
        {
       
        $classes = array(
                                        'Druid' => $this->vbObj->db->escape_string( strip_tags( $druid, '<b>' ) ),
                                        'Hunter' => $this->vbObj->db->escape_string( strip_tags( $hunter, '<b>' ) ),
                                        'Mage' => $this->vbObj->db->escape_string( strip_tags( $mage, '<b>' ) ),
                                        'Paladin' => $this->vbObj->db->escape_string( strip_tags( $paladin, '<b>' ) ),
                                        'Priest' => $this->vbObj->db->escape_string( strip_tags( $priest, '<b>' ) ),
                                        'Rogue' => $this->vbObj->db->escape_string( strip_tags( $rogue, '<b>') ),
                                        'Shaman' => $this->vbObj->db->escape_string( strip_tags( $shaman, '<b>' ) ),
                                        'Warlock' => $this->vbObj->db->escape_string( strip_tags( $warlock, '<b>' ) ),
                                        'Warrior' => $this->vbObj->db->escape_string( strip_tags( $warrior, '<b>' ) )
                                        );

        foreach( $classes AS $key => $value )
                {
                        $query = ( "UPDATE recruitment SET status='$value' WHERE class='$key'" );
                        $this->vbObj->db->query( $query );
                }
        }
}
?>


hannie 02-20-2007 01:17 PM

i can get this to come up but it doesn't appear in a module - it appears on the top of the page - any idea whats going on?

aitonk 02-20-2007 02:40 PM

I get this error when trying to add the SQL Database

Code:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1;

--
-- Dumping data for table `recr


turnipofdoom 02-20-2007 06:54 PM

Quote:

Originally Posted by hannie (Post 1186701)
i can get this to come up but it doesn't appear in a module - it appears on the top of the page - any idea whats going on?

Yeah enable clean file output in the module you created in vbadvanced.

turnipofdoom 02-20-2007 06:56 PM

Quote:

Originally Posted by aitonk (Post 1186751)
I get this error when trying to add the SQL Database

Code:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1;

--
-- Dumping data for table `recr


Code:

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

just remove 'DEFAULT CHARSET=latin1

SReid 03-10-2007 04:51 PM

Thanks for making this! Installed at www.malevolenceguild.org

Feanor 03-11-2007 07:33 PM

I can't get it to work - I've tried all the ideas in this thread, and the best I can come up with is a homepage consisting of just this:

turnipofdoom 03-12-2007 05:24 PM

Quote:

Originally Posted by Feanor (Post 1201046)
I can't get it to work - I've tried all the ideas in this thread, and the best I can come up with is a homepage consisting of just this:

Are you trying to display the recruitment status page and the update page on the same VB page? Even that should not kick that kind of error... You trying to include class_recruit more than once?

darkie79 03-13-2007 05:28 PM

I would love to install this, but it would be more beneficial to our community as a recruitment tool for specific roles within the community (ie, tournament admin/cs:s team, etc)..how hard would it be to change this to accomodate our needs?

Thanks ;)

turnipofdoom 03-13-2007 08:11 PM

Quote:

Originally Posted by darkie79 (Post 1202669)
I would love to install this, but it would be more beneficial to our community as a recruitment tool for specific roles within the community (ie, tournament admin/cs:s team, etc)..how hard would it be to change this to accomodate our needs?

Thanks ;)


Pretty easy, can you give me an specific outline of what you need ?

darkie79 03-14-2007 11:16 AM

Sure, I can give you a general idea of what we need..

Right now we are looking for:

3 Radio dj's
2 journalists
4 game server admins
2 graphic artists
2 counterstrike source (CS:S) team members
1 xbox 360 division admin

These will change as time goes on, of course

Thanks for looking into it :D

Synth 03-15-2007 02:29 PM

I've got everything going fine. The only problem is the module doesn't show when I include class_recruit.php. I don't get any errors and the module is set to active. If i switch it to include EXAMPLE.recruitStatus.php it shows at the top of the page even when i set clean file output to yes.

Could someone please tell me what I'm doing wrong :)

Thanks!

turnipofdoom 03-16-2007 05:31 PM

Quote:

Originally Posted by Synth (Post 1204172)
I've got everything going fine. The only problem is the module doesn't show when I include class_recruit.php. I don't get any errors and the module is set to active. If i switch it to include EXAMPLE.recruitStatus.php it shows at the top of the page even when i set clean file output to yes.

Could someone please tell me what I'm doing wrong :)

Thanks!

Just include EXAMPLE.recruitStatus.php as a php module in VBCMPS and see where that gets you.

mdroschak 03-17-2007 05:42 PM

You are my hero, i was the guy who orginally created that static one..

This is great, thanks.. I finally decided to come back and check to see if someone had created this and sure enough, there it was :)

I'm confused about a couple of things. Do i need to create 3 seperate PHP modules for each of the includes?

When reading your instructions you say to include class.recruit and example.recruit into a new PHP Module. How do i add both when you can only select one?

Does one need to be a parent of the other? I've tried that and recieve some strange error.

EDIT: I was able to get the modules to show up, but like the guy above they stay at the top of the page. WHen i turn clean file output on they throw off the rest of my forums.

turnipofdoom 03-17-2007 09:44 PM

That is my mistake in the instructions, I need to fix them. You should only have to include one of the example files in a module, they each include the class on their own. They are really just examples on how to display some of the data. By throw off what do you mean ? You can probably check off use module shell template so it does not display in a template block.

I have a slightly updated version that uses vb templates to display in a block that ill update this thread with by tomorrow.

turnipofdoom 03-17-2007 09:48 PM

Quote:

Originally Posted by darkie79 (Post 1203229)
Sure, I can give you a general idea of what we need..

Right now we are looking for:

3 Radio dj's
2 journalists
4 game server admins
2 graphic artists
2 counterstrike source (CS:S) team members
1 xbox 360 division admin

These will change as time goes on, of course

Thanks for looking into it :D

I will try to get to this soon for you, this is just a few text changes in a few spots.

mdroschak 03-18-2007 02:33 AM

Quote:

Originally Posted by turnipofdoom (Post 1205870)
That is my mistake in the instructions, I need to fix them. You should only have to include one of the example files in a module, they each include the class on their own. They are really just examples on how to display some of the data. By throw off what do you mean ? You can probably check off use module shell template so it does not display in a template block.

I have a slightly updated version that uses vb templates to display in a block that ill update this thread with by tomorrow.



By throw off I mean it will take my news module that is displayed in the center of the forums along with the right side modules and move them down to the bottom and cause them to span accross the entire screen as if they were removed from the tables, it's pretty bizare.

I will wait for your updated one along with some better instructions and give this a go again. My database and everything is setup perfect, it's just a matter of getting the modules to work correctly.

By turning off the use module shell it seems to fit perfectly but looks really ugly =(

Here is a screenshot

Also, one more thing. When i try to create a new "page" "template" for the edit_status.php file I get some php errors. From your example it appears that is what you did for your edit.php file. Is there anything special i need to do to open that up in an iframe/new template? Right now i have it on the same page and it seems to work fine but just adds an uneccssary window..

turnipofdoom 03-18-2007 02:36 PM

Quote:

Originally Posted by mdroschak (Post 1206030)
By throw off I mean it will take my news module that is displayed in the center of the forums along with the right side modules and move them down to the bottom and cause them to span accross the entire screen as if they were removed from the tables, it's pretty bizare.

I will wait for your updated one along with some better instructions and give this a go again. My database and everything is setup perfect, it's just a matter of getting the modules to work correctly.

By turning off the use module shell it seems to fit perfectly but looks really ugly =(

Here is a screenshot

Also, one more thing. When i try to create a new "page" "template" for the edit_status.php file I get some php errors. From your example it appears that is what you did for your edit.php file. Is there anything special i need to do to open that up in an iframe/new template? Right now i have it on the same page and it seems to work fine but just adds an uneccssary window..

Yeah at the very least the new version uses the board style to display in, so it will look much better for you. Let me know how it works out.

mdroschak 03-18-2007 04:11 PM

Thanks my friend, I see you have updated it. I will give it a try in a few minutes.


All times are GMT. The time now is 03:28 AM.

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.01403 seconds
  • Memory Usage 1,891KB
  • 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
  • (19)bbcode_code_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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