Jump to content

"Roster" Script


Recommended Posts

Hello everyone!


I am here to ask for some help with a certain script I have concocted. I run a moderately sized gaming community (using vBulletin 4.2.2) that supports multiple games, and as such we needed an automated roster to keep track of who plays what games. The code displays a list of games on the left, and the actual roster to the right. The default page is a "leadership roster" listing all the leaders.


Game Roster pages include several things. Username, User Rank, IGN/Game Account Name, Join Date, and Last Active Date. You can sort by Join and Last Active Dates.


There are also two types of members on the roster. Those who play the game as their "main game" and those who play it occasionally as an "other game". It is easy to get the main game members, since you can only have one, vBulletin saves it as text, so you can match it. The other games selector is saved bitwise, so we have to run a check for the game's location in the list against the user's saved bitwise in their profile to see if they play it. To do this, instead of manually coding the bit number, since everything is alphabetical, we simply assign each game a number, and do a a bitshift (1<<x) to get the proper bit (I've been told bitshift is much faster than using pow(2,x)). However, because it's specific too us, I have hard coded a lot of stuff, including mixing presentation code with functional code. The code works just fine for us, but I want to make it much easier so that other staff members besides me can update it easily and so the code is easier to manage. I hope I have given a good explanation of what the code does!


To see the code in action, click http://www.zealotgaming.com/forum/pages.php?pageid=15


To see the code with syntax highlighted, here is the pastebin: http://pastebin.com/Nuanj4Ci


I thank you all in advance for any help and advice you can give me. I am a novice and have been learning as I go to do this for my community.

Edited by DrMath
Link to comment
Share on other sites

The thing is, I'm not quite looking to pay anyone to redo this because that's costly and the code we have already works. Why pay a lot of money to redo a working script? I'm just looking for advice on how to improve.

Link to comment
Share on other sites

You might have more luck pinpointing specific classes/functions etc. that you think might have an issue or could be improved.

Speaking generally, it would be easier to maintain if you put the presentation code into "template" files that you include, or use a template engine for.

I'm not going to suggest any of the sophisticated compilation template engines like smarty or twig, due to the fact that you are integrating with bulletin, but take a look at these:

Blog post that shows a simple effective way could pull this off: http://chadminick.com/articles/simple-php-template-engine.html

Some simple template classes that can be used with a simple include of their template class:


You might also look at breaking up a lot of the logic sections into functions, named appropriately to represent the specific purpose they fulfill.  That way if you decide to move things around or add or remove sections, it will be much easier for someone to understand the code and make changes.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.