Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site - Released
SaintPeter
Champion

Introducing Roster Master
I had seen the excellent work the Verite had done on her "Roll your own Roster", but I had some quibbles with her implementation and wanted a larger featureset for my own personal guild site. 
 
General Features
Single and Double Column display sorting
- Sort by clicking on a column header, or select two columns from a drop-down (IE: Class, then Level)
- Reversable Sorting for both sort modes

SQL or Flatfile (.csv) backend cache
- Fast display since you don't have to hit Sony's site every time.
- User Configurable cache refresh time
 
Update Logging for all fields
- Have a record of changes in all fields, every user add, and every user deletion.
 
Error Messages
- Explanatory error messages for common failures.
- Clean exits
 
Easy to Setup and Install
- FTP, Set Permissions and go!

PHP based SQL install
- No .sql file to import, just run the installer.
 
Fully Documented, Clean Code
- All functions completely commented
- Detailed install and modification documents

Forum/phpNuke/CPG Nuke/Postnuke Required Features:
Support for popular Forums for login/admin authentication
- phpBB 2.x.x
- Invision Power Board 2.x.x

SQL Table Prefix Configuration
- Run multiple instances of Roster Master out of one database
 
Username to Character Name Mapping
- Allow your users to "Claim" their characters. - Manage and assign your user's character claims
 
Character "Type"
- Users may specify if their character is Primary, Secondary, or Utility

Statistic Block (Dragonfly/CPG Nuke Only)
- # of Characters
- Average Art/Adv Levels
- Guild Status Points
- Leaders in KVD/Quests
- Character Type Breakouts
 
Stand Alone
Roster Master v1.0.4 (9/12/05)

phpNuke
 
CPG Nuke/Dragonfly (Port maintained by DarkGrue)
Roster Master for Dragonfly 2.0.0 (9/17/05)
 
PostNuke (Port maintained by Topiatic)
 
Notes
This the Release version of Roster Master.  It has been fairly extensivly tested. Please post any errors here, or e-mail me at rostermaster@bellumaeternus.com
 
Future Features
In the other thread there were some requests for additional features.  I am planning on adding the following features -
Username Mapping (IE: Website username next to owned characters)  Done!
- Class/Level Breakout Graph (similar to this)
- Possibly phpNuke integration Done!
- Dynamic Signature Generation
- Features that you reasonably request
 
Demo Sites
Stand Alone Demo Site
phpNuke Demo Module
 
Getting Assistance
I am happy to offer you any assistance I can in getting my code to work right.  I prefer that you post your questions here so my answers will help everyone.  There are some 'Best Practices' you can follow that will help me help you best.
 
Before you ask:
Read this Article - How to ask questions "The Smart Way"
Did you read the included documentation?
Have you read through this thread to see if your problem is mentioned?
 
When Asking:
Make sure to include (at very least)
- The Version and version number of Roster Master you are using (Stand Alone v0.8.1/phpNuke 1.0.0)
- What configuration options you are using.  IE: $use_database
  (For your security, don't post the complete rm_config.php file, since it might contain your SQL connection information)
- What exact error message(s) you are getting?  Copy and paste 'em into the message
- What you've already tried.
 
Fair Warning:
Failure to follow these Best Practices may result in snarky, rude, or no response.  I have spent a lot of my personal time creating an application that I don't use.  I expect you to respect my contribution by taking a moment of your time to write a clear and complete problem description. 

Update 11/16/06
While I am no longer playing the game, I will continue to keep the software up to date so long as my guild is playing.  My support e-mail address is still rostermaster@bellumaeternus.com.

Message Edited by SaintPeter on 11-16-2006 09:54 AM

03-20-2005 03:34 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Sorvani
Guardian

Suggestion: add a table prefix option in the config. It's a personal thing. i like all my tables prefixed in case i want to use the program more than once. Otherwise flawless and simple install


http://www.veneficusnex.com/roster/

03-20-2005 06:11 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Manitos
Defender

Ambitious, intelligent gamers, like Peter, are what make gaming fun. Thank you Peter.

I hope you complete the next revision because, on the front end (i.e., user GUI), the roster is no different than the Guild Roster provided by EQ2Players, except for designating a second sort column. I will continue to use the Guild Roster on EQ2Players until the next revision is made available.




In addition, a "notes" field would be an interesting implementation when you implement the phpNuke integration. What am I thinking? Place an icon next to each "username" field in the roster. When the user clicks on the icon, an independent thread will be shown with the corresponding username in the thread's title.  Why? If you want to add comments about another player, then submit in this thread. Our guild enjoys informing each other about player's behavior, attitude, activity (or inactivity), in-game and what they can do for the guild. If there is a new message, the icon will change colors.

Message Edited by Manitos on 03-21-2005 08:21 AM

03-21-2005 10:21 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Vertie_EQ2
Master

Great job, Peter!

03-21-2005 04:02 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Sorvani
Guardian

of course it isn't real different from the EQ2Players thing. it's generic. but it is 100% customizable which eq2 players is NOT. these kind of tools are for those of us with our own domain names who don't want to be restricted to Sony's design criteria.

03-21-2005 10:09 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
thedump
Guardian

This is great! I just saw they added completed quests to the list on SOE as well. I was wondering in anyone knew how properly convert it to be a module in PhpNuke?

03-22-2005 10:58 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Homeslice
Dunce Cap



thedump wrote:
This is great! I just saw they added completed quests to the list on SOE as well. I was wondering in anyone knew how properly convert it to be a module in PhpNuke?





Just curious where did you see this?

03-22-2005 11:09 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion


thedump wrote: This is great! I just saw they added completed quests to the list on SOE as well. I was wondering in anyone knew how properly convert it to be a module in PhpNuke?
I know how to properly convert it into a phpNuke Module, since I orginally wrote it for phpNuke (My Personal Implementation).  I am going to be wrapping up the code in a phpNuke Module in my next release, which should be in the next few days, my schedule permitting.
 
At the same time, I will also be adding a $config['prefix'] variable, as requested, so you may have multiple versions of the roster in a single SQL database.
 
I hope to add the capability to map usernames to character names soon as well.  This will be no problem for the 'nuke implementation, but more complex for non-nuke/non-database implementations.
 
I'm interested to know what CMS or website backend folks are running.  So long as there is a user table and some method of session tracking, I should be able to write an interface for the username->character name mapping.
 
Watch this space for updates

03-22-2005 11:24 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion

New Version - v0.8.0
- Added $config['prefix'] option to allow multiple instances in a single database
- Added upgrade feature to installer to rename existing tables to add a prefix.
 
File
 
Modified files:
 - rm_config.php
 - rm_db_install.php
 - rostermaster.php
 - rostermaster_docs.html

03-22-2005 12:54 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
thedump
Guardian



Homeslice wrote:


thedump wrote:
This is great! I just saw they added completed quests to the list on SOE as well. I was wondering in anyone knew how properly convert it to be a module in PhpNuke?





Just curious where did you see this?


Homeslice, if you go the guild roster page now on the SOE page, it has column added for number of quests completed.

03-22-2005 02:26 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
thedump
Guardian



SaintPeter wrote:

thedump wrote: This is great! I just saw they added completed quests to the list on SOE as well. I was wondering in anyone knew how properly convert it to be a module in PhpNuke?
I know how to properly convert it into a phpNuke Module, since I orginally wrote it for phpNuke (My Personal Implementation).  I am going to be wrapping up the code in a phpNuke Module in my next release, which should be in the next few days, my schedule permitting.
 
At the same time, I will also be adding a $config['prefix'] variable, as requested, so you may have multiple versions of the roster in a single SQL database.
 
I hope to add the capability to map usernames to character names soon as well.  This will be no problem for the 'nuke implementation, but more complex for non-nuke/non-database implementations.
 
I'm interested to know what CMS or website backend folks are running.  So long as there is a user table and some method of session tracking, I should be able to write an interface for the username->character name mapping.
 
Watch this space for updates




Sweeet!!! Can't wait. I wanted to use Verite's code, but I saw the constant back and forth between my server and SoE, and that was just to prohibitive; but was very nice start.

Currently using:

Php Nuke Platinum 7.6.0
Redhat FC1 (hope to convert to FC3 soon)
MySql 4.x
Php 4.x
Apache 2.x
Phpbb 2.11


03-22-2005 02:31 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Sorvani
Guardian

www.veneficusnex.com/roster is hosted at www.lunarpages.com

I run an Invision Power Board v2 message board

General server information:
Operating system: Linux
Kernel version: 2.4.21-15.0.4.ELsmp
Machine Type: i686
Apache version: 1.3.33 (Unix)
PERL version: 5.8.4
PHP version: 4.3.10
MySQL version: 4.0.22-standard

03-22-2005 04:54 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
aiyl
Journeyman

I'd like to see sorting by archetype (i.e. Priest, Mage, etc) which also automatically sorts by the class field too (i.e. Priests all together and within that, Defiler all together preceeding Templar, etc.).  Lower levels just sort by Priest, Cleric, etc.

03-23-2005 01:00 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Linkagge
Journeyman

How about a way to list alts, and who their main charachters are ?
 
 

03-23-2005 01:02 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion


aiyl wrote:
I'd like to see sorting by archetype (i.e. Priest, Mage, etc) which also automatically sorts by the class field too (i.e. Priests all together and within that, Defiler all together preceeding Templar, etc.).  Lower levels just sort by Priest, Cleric, etc.

That's a very interesting idea.  It would be fairly simple to implement. Not sure how useful it'd be, though. What I find is much more handy is this interactive class graph code that I wrote.  You can see the distribution of characters and classes, and when you click on a bar, it brings up a list of the characters.  It is my plan to include this code in a future version of Roster Master.


Linkagge wrote:
How about a way to list alts, and who their main charachters are ?
This is planned and should be in the next release. There will be column for username and a column for "Character Type" which would be "Primary", "Secondary" and "Utility".
 
This feature will (currently) only be in the phpNuke module version and in an "Invision Powerboard" version.  However, I believe that I should be able to add support for most of the major Forum Software and CMS's out there.  So long as the CMS/Forum uses a cookie to store login state and an SQL capable database, it's trivial for me to add support.
 
My next release will be the phpNuke Module and will include the Username/Character Type code.  This will be followed by an update to the orginial which will support Invision and any other forum that is free/open source and is requested.

03-23-2005 02:21 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
aiyl
Journeyman

True, your graph does answer a lot of the questions I'm interested in.  Can you add a total though?  i.e. another bar for Levels 0..50?

03-23-2005 03:49 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion



aiyl wrote:
True, your graph does answer a lot of the questions I'm interested in.  Can you add a total though?  i.e. another bar for Levels 0..50?

A Pie Chart for all levels would probably make more sense and is certainly possible.

What would be helpful to me would be for you to explain what you hope to understand or accomplish.  Maybe there is some third way that would give you EXACTLY the information you're looking for, rather than having to work up to it.  My chart is part of a "stats page" which I anticipate adding useful queries to.  There is no practical reason why your specific query couldn't be added to a similar stats page.

However, at this time I'm hesitant to talk about additional features for a portion of code that has not been written yet.  Let me see if I can't get the "Easy" stuff written first, then we can talk about adding other features.

03-23-2005 04:05 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion

New Version - v0.8.1
- Fixed Error "Warning: file_get_contents(guild_info_new.html)" - Was a result of Debug code being released.
 
File
 
Modified files:
 - rostermaster.php

03-23-2005 08:44 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Original Cinadien
Master

I just want to say thank you Peter, your work is appreciated sir. I have been following this since Vertile posted his original code. Can view example integration to postnuke with postwrap mod here www.eq2five-rings.com

03-24-2005 06:25 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Homeslice
Dunce Cap



thedump wrote:


Homeslice wrote:


thedump wrote:
This is great! I just saw they added completed quests to the list on SOE as well. I was wondering in anyone knew how properly convert it to be a module in PhpNuke?





Just curious where did you see this?


Homeslice, if you go the guild roster page now on the SOE page, it has column added for number of quests completed.





Ahhh thanks, I was thinking that you had meant you could see the names of your completed quests

03-24-2005 07:09 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Linkagge
Journeyman

Would it be possible to include support for Phpbb ? It's used just as much, maybe more than invision board is ?
 
BTW Great work, I have done a little coding / tweaking to get the roster to work on my guild's website, if you would like I could Email you the alt/main code that i have already done.
 
http://www.eq2awakening.com/roster
 
 

03-24-2005 08:21 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion


Original Cinadien wrote: I just want to say thank you Peter, your work is appreciated sir. I have been following this since Vertile posted his original code. Can view example integration to postnuke with postwrap mod here www.eq2five-rings.com

You're welcome.  I've never seen postwrap, that's pretty amazing!  What a trip, to see my code already in a CMS. I expect that my phpNuke version (coming soon) will be easily adaptable to postNuke - I'll look into what changes need to be made to make it so.


Linkagge wrote:
Would it be possible to include support for Phpbb ? It's used just as much, maybe more than invision board is ?
 
BTW Great work, I have done a little coding / tweaking to get the roster to work on my guild's website, if you would like I could Email you the alt/main code that i have already done.

phpBB would be no problem at all.  You're right, it's probably more popular than invision.  I'm just responding to the requests I get here.  I spent a bit of time investigating both Invision and phpBB and they both use similar login mechanisims.  Once I get my phpNuke version done I'll work on the CMS-less version.

I would be VERY interested in seeing your code.  I can be reached at rostermaster@bellumaeternus.com. I have a slightly different take on character types, as I don't break them out into a seperate list.

BTW, your integration of the roster looks simply amazing.  Gorgeous, really!  I love the wood panel effect.  I wish I were as good at graphic design/CSS.  I'll be the first to admit I'm a programmer at heart.

03-24-2005 09:42 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Belin
Master

Any way to add the ability to sort by ascensding/descending?  Maybe if you click a Header like level, and then click it again it switched from low-to-high, to high-to-low..

Looking forward to using this on our own guild site!

03-24-2005 10:02 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Faeandil
Apprentice

SaintPeter..  Just wanted to stop by here and Say excellent work...   this is Laethorn by the way.  Thanks for getting back to me so promptly on my issue.

03-24-2005 11:47 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Kevlin
Guardian

S.P.

Hopefully I can add my great work comment to this thread soon... I installed and chmod'd the files ran the install and even added a prefix and ran it again.

When I type the rostermaster.php I get the following

Warning: Invalid argument supplied for foreach() in /home/risingd/public_html/roster_master/rostermaster.php on line 165

Error

 

Any ideas?

03-24-2005 12:19 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion



Kevlin wrote:
Warning: Invalid argument supplied for foreach() in /home/risingd/public_html/roster_master/rostermaster.php on line 165
Error

There are two possibilies for this error:
1)  Most likely, your configuration variable in rm_config.php, $config['guild_name'] is not set to EXACTLY your guild name, as it appears on the roster site.
For example, if my Guild name is "Bellum Aeternus" and I typed "bellum Aeternus", I would get this error.

2)  It's possible that your $config['guild_id'] is not set correctly. 
You can find your guild_id at the end of the URL which links to your eq2players.com site.
http://eq2players.station.sony.com/en/guild.vm?guildId=15101

I will ensure that there is a better error message in future versions Stand Alone parser.

Message Edited by SaintPeter on 03-24-2005 12:02 PM

03-24-2005 01:58 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion

New Version Avalible:
phpNuke
 
New Features:
Username to Character Name Mapping (phpNuke Only)
- Allow your users to "Claim" their characters.
 
Character "Type" (phpNuke Only)
- Users may specify if their character is Primary, Secondary, or Utility
 
Modified files:
 - They're all new
 

03-24-2005 02:01 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
aiyl
Journeyman



SaintPeter wrote:

...

What would be helpful to me would be for you to explain what you hope to understand or accomplish.

...

Let me see if I can't get the "Easy" stuff written first, then we can talk about adding other features.



Sure. Just looking for an easy way to see the overall picture - it's nice to know you have 5 brigands in the level 20-25 range and 2 in the 40-45 range, etc, but how many altogether? Not a high priority and easily determined. I'm just lazy and want it even easier!

03-24-2005 04:20 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Sorvani
Guardian

phpNuke a message board or something?

03-24-2005 05:44 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion



Sorvani wrote:
phpNuke a message board or something?

phpNuke is a "Content Management System" or CMS.  It is a php based web script that allows you to easily add content, such as news posts, HTML type content, and other features without having to compose them manually.  Most notably, CMSes typically have the capability to quickly add prewritten modules to expand their capabilities.  In this way, you can increase the functionality of your website without having to write any code.  Another handy feature of CMSes is "Themeability" - phpNuke has many hundreds of themes avalible that allow you to put a uniform look and feel across the entire site. 

phpNuke in particular integrates the phpBB message board system into its suite.  It's essentially a "Website in a box".  The downside, of course, is that your site can LOOK like it was a "Website in a box" - too many people roll out a CMS with the default options and don't customize it at all.  This can give a site a fairly generic/cookie-cutter look.

'Nuke has been criticised for being incredibly sloppily written and full of security holes.  I can attest to the slopiness of it, but the security situation has been improving.  The most recent versions are reasonably secure.  There are a large number of 'nuke derivitives, with varying amounts of rewritten and "cleaned up" code.  A notable example is postNuke, although I found little substantial difference between it and phpNuke.

The greatest advantage to phpNuke, for me, is the ease of development.  Say what you will about the carptacular internal code of phpNuke, it's a breeze to develop new modules for.  It uses the phpBB SQL Abstraction Layer (which I leveraged for my Stand Alone version) to expidite portable database operations.  It has some standard theming options which can give you a complete website shell in only a few lines of code.  I have heavily modified my version of 'nuke and written 3-4 complete modules for it.  You can see it here:  www.bellumaeternus.com.  While I was initially hesitant to use nuke because of its bad reputation, I was won over by the AMAZING number of modules for it.  Because it is so ubiqutious, it's easy to find modules and themes for.

No worries, though - I will be rolling out a version of the Stand Alone roster that will use the login information for phpBB and Invision PowerBoard shortly.  Your site looks well put together.

Resources:
http://www.cmsreview.com/ - This site has a HUGE number of demo CMS systems set up for you to play with.  I used this site extensivly when I was first trying to figure out what CMS was right for me.
http://www.phpnuke.org/ - The phpNuke Homepage.  Advanced warning: MANY popups.  Also, don't go to the .com site, it's a "warez" site.

03-24-2005 06:36 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
thedump
Guardian

SP, fantastic job. Here is the link to my guild's page
http://eq2.clanbmf.net/modules.php?name=Roster_Master


I discovered a problem today though. When picking to sort by any two variables, it comes back as saying it is an invalid module. I believe this is the problem:

The URL becomes "module.php?s1=CT&s2=N"

it should be: "modules.php?name=Roster_Master&s1=CT&s2=N"

I can't wait for the other featuers. Hope your announcing it on PhpNuke.org's site as well.


Message Edited by thedump on 03-24-2005 07:05 PM

03-24-2005 09:02 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion

New Version -
phpNuke
Roster Master For phpNuke v1.0.1 (3/25/05)
 
Changes
- Multi-variable sort should now go to the correct URL (and work).  Thanks to thedump for the catch!
 
Modified Files
- index.php

03-25-2005 11:34 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Linkagge
Journeyman

I emailed you the roster files for my guild's website, and the php / tpl files for what we use to manage forum users and in Game charachters and the alts.

I hope it helps you with the project.

Link =)

03-25-2005 03:20 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Sorvani
Guardian

thanks for the response SP if you need to know anything baout the IPB setup jsut ask. I really like the IPB myself and will likely be purchasing it. It does have a what they call a portal mode where the board can function as a main site as well. the basic layout can be seen here, the basic layout is horrible but some of the mods i've seen make it very versatile. There are a couple of good mods for the IPB portal that i'm currently toying with. as i know jack about PHP it's a slow process. I do really like your tool and figure i'll reinstall the lastest version sometime this weekend to see what you've added. Keep up the great work.

03-25-2005 04:52 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Sorvani
Guardian

with much trial and error i've started to modify the layout to fit my own needs. mostly it's been not TOO hard actually. i've spent more time f'in up my .css file than anything else. but i have one question. in the log file, what are you looking for when you insert new data? i basically want to kow so i know how far i can go with adding in stuff to the log file without it busting. granted i'm not adding much. just style, my header images and a return link.

suggstion on RM itself: Z-A sort check box or something along that line. basic SQL i know so if i poke around in your stuff long enough i'm sure i can break something.

Message Edited by Sorvani on 03-27-2005 09:45 PM

03-27-2005 11:44 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion


Sorvani wrote: but i have one question. in the log file, what are you looking for when you insert new data? i basically want to kow so i know how far i can go with adding in stuff to the log file without it busting. granted i'm not adding much. just style, my header images and a return link.

So long as the HTML comment "<!-- Insert Log Here -->" is in the logfile.html at the point where the log information should be inserted, you can change any other aspect of the code you'd like.  That comment is replaced by the new text, with the comment prepended (so the next insert will always happen at top).

Note that this only applies to the Stand Alone version of the code.  In the phpNuke version, JUST the update text is stored and is just displayed in a standard 'nuke template.

Message Edited by SaintPeter on 03-27-2005 11:44 PM

03-28-2005 01:41 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Sorvani
Guardian

as i don't use phpNuke that's not a problem. thanks for the info.

03-28-2005 04:49 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Faeandil
Apprentice

SaintPeter.. Thanks for helping me out with my page.. its working great now..

 

03-28-2005 08:24 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion



Faeandil wrote:
SaintPeter.. Thanks for helping me out with my page.. its working great now..

No problem.  Glad to help.

Just a quick overview in case other folks run into the problem -
The symptoms were that the phpNuke version of the Roster was not updating, but it wasn't failing.  The problem turned out to be that when he filled out the configuration file, he had a trailing space at the end of his guild name.  That caused the wrong portion of the guild website to be chopped off, resulting in an apperent no members listed.

I will be putting in code to detect similar errors in the future.

03-28-2005 09:30 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion

New Version
- Fixed problem with the installer.  There was a syntax error that would cause an install to fail if you used a prefix.

Stand Alone
Modified files:
 - rm_db_install.php

03-28-2005 09:35 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Kanoldari
Journeyman

For anyone interested, I created a PHP-Nuke block that pulls member info from roster masters's database (nuke_roster_master) and shows you total members, officers, regular members, trial members, how many fighters, priests, mages and scouts you have, average level of the guild, and average status.

 

If you want to see it in use, its here, on the bottom left: http://creign.heartofsword.us and you can download it from here: http://creign.heartofsword.us/modules.php?name=Downloads&d_op=getit&lid=1

Btw, excuse the site linked above - its still 'under construction' as I learn more about customizing Nuke.

You'll need to edit the funcs.php file with your DB info, and upload both files into your blocks folder.

Message Edited by Kanoldari on 03-30-2005 07:49 AM

03-30-2005 06:48 AM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Kelia
Elder

First off I must say bravo and thank you! SaintPeter, you rock!  

He graciously helped me offline to get the roster up-and-running on my site. I was receiving a "failed to open data stream: Permission denied" error when accessing the main page. Come to find out it was an issue with my web host. When accessing an external site in this manner it apparently requires them to add it to a list of "approved" sites. So if any of y'all are getting a similar error, you might want to check to make sure that isn't the problem.

That being said, I have a suggestion and a question. The suggestion is just to second what Belin already mentioned. It would be cool if when you click on the header title it sorts from low to high, and if you click it again that flip-flops and sorts from high to low.

My question falls into the category of "I wish I knew more than I do". I'm interested in having the default page sort in a particular way, and I'm having trouble making it happen. For example:

SELECT * from roster_master order by rank='Guild Leader' DESC, rank='Officer' DESC,  rank='Member' DESC, rank='Initiate' DESC, Adv_Level DESC, Name

How might I translate that query into your lovely code? I presume it has to do with the "Sort Code" section, but I don't seem to know enough about multi-sorting in arrays to make it happen by troubleshooting. Might any of you folks who are more familiar with PHP and MySQL have a suggestion?

If you're interested, the URL of my roster is http://phantomknights.com/roster/.

03-30-2005 12:10 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion

Well, you certainly ask the hard questions . . .

Let me give you a little primer on sort code, followed by some speculation on how what you describe could be achived.

PHP Provides a number of functions for sorting an array.  In general, they only work on a single dimension array.  There is a function that will do a multi-sort, but it requires that the data be in columns, rather than rows.  Databases are typically row based, since each "row" of data has a set of values for each "column".  In order for PHP's function to work, it has to have all of the data for a given field, such as "name" in each row. 
Row Based:
    Name | Rank | Level
[0] bob  |  1   |   12
[1] joe  |  2   |   33
[2] Zoe  |  4   |   4
 
Column Based:
[Name] - bob, joe, Zoe
[Rank] - 1, 2, 4
[Level] - 12, 33, 4
That means that, in order to use the built in sort, you'd basically have to "turn your table sideways".  It can be done, but unneeded, since PHP provides us with another feature, a user defineable sort called USORT().
USORT takes 2 parameters - the array to sort, and a "Callback" function, which is user defined.
The Callback function has to parameters, $a and $b.  It returns a value based on those such that:
$a < $b -->  Return less than 0
$a = $b -->  Return 0
$a > $b -->  Return greater than 0
 
So . . . All that having been said, we can examine what MY sort function does, and how we could do something different with it.

function cmpi($a, $b)  {
    global
$sort_field1,$sort_field2
;
    
    
// Do the initial compare of the primary fields
    
$sort_1 = strnatcmp($a[$sort_field1], $b[$sort_field1
]);
    
    
// If sort_field1 is the same (strnarcmp = 0), we have to compare sort_field2,
    // providing sort_field2 is set.  Otherwise, just return the orginal result.
    
if($sort_1 == 0 AND $sort_field2
) {
        return
strnatcmp($a[$sort_field2], $b[$sort_field2
]);
    } else {
        return
$sort_1
;
    }
}

// Set the global sort fields
$sort_field1 = decode_sort($s1); // The "Letters" are translated into a field name
$sort_field2 = decode_sort($s2); //        "             "             "

// Do the array sorting
usort($data_array, 'cmpi');


My function, 'cmpi', is pretty basic, once you know how a user defined sort function works.
Consider the simplest possible sort function:
function simple_compare($a, $b)  {
       if($a == $b) { return 0; }
       if($a < $b) { return -1; }
       if($a > $b) { return 1; }
}
Or, if you wanted to sort strings:
function string_compare($a, $b)  {
     return strcmp($a, $b);  // Because strcmp already returns -1/0/1
}
There are always only 3 possible outcomes.  However, if you want to increase the number of fields by 1, there are 5 possibilities.
F1 | F2 | Result
<  | x  | -1
>  | x  |  1
=  | <  | -1
=  | >  |  1
=  | =  |  0

Remember what is being passed to the comparison function - two diffrent indexes of the array being sorted.  Looking at my "Row" example above, here are some possible examples of ONE compare (The compare function is called for ALL of the compares that the sort function does.) -
$a = Array("name" => "bob", "Rank" => 1, "Level" => 12); 
$b = Array("name" => "joe", "Rank" => 2, "Level" => 33);
 
So, we can compare individual FIELDS of $a and $b with standard notation:
strcmp($a[name], $b[name]);

If you look at my code, it's pretty easy to see what happens - We compare field 1(the name of which is defined in the global varibale "sort_field1") first.  The only time we need to compare field 2 is if Field1.a and Field1.b are EQUAL (IE, the result of the first compare is 0).  In both other cases, it doesn't matter, field 1 is the controlling field and their compare result is returned.  When they are equal, however, and we are sure that the second search field is SET at all, then we can compare Field 2.

I'm going to stop this post here and continue in the next post with how to do something different.

03-30-2005 02:15 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion

Reversing Sort
 
For any given single sort, the answer is easy:
function cmpi($a, $b)  {
    global do_reverse;
    $result = strcmp($a, $b);
    if(do_reverse)  {     // Set do_reverse to 0 for forward, 1 for reverse
        return $result * -1;
    } else {
        return $result;
    }
}
We're being a little tricky here, mathwise.  We know that 1 * -1 = -1,  -1 * -1 = 1, and 0 * -1 = 0.
We can just reverse the sort by just multiplying by negative one.  So it might just be easier to do this:
 
function cmpi($a, $b)  {
    global $reverser;
    return strcmp($a, $b) * $reverer;  // Set reverser = 1 for forward, -1 for reverse
}
Now it's just a matter of setting your reverser global for the way you want to go.  Applying this to a muli-field sort means that you would just need to have 2 reverser variables.
 
function cmpi($a, $b)  {
     global
$sort_field1,$sort_field2
;
     
     
// Do the initial compare of the primary fields
     
$sort_1 = strnatcmp($a[$sort_field1], $b[$sort_field1
]) * $reverser1;
     
     
// If sort_field1 is the same (strnarcmp = 0), we have to compare sort_field2,
     // providing sort_field2 is set.  Otherwise, just return the orginal result.
     
if($sort_1 == 0 AND $sort_field2) {
         return
strnatcmp($a[$sort_field2], $b[$sort_field2]) * $reverser2;
     } else {
         return
$sort_1
; // Note that no reverser is used here - it's already set 
                        // when the initial comparison is done.

     }
 }
 

Now it's just a matter of passing an up/down sense in the URL and reversing it for the second sort.
I will probably write code for it in my next release.

Sorting by Rank, in Rank order
Sorting by "rank" is a little bit trickier.  The problem is, the words that make up the rank aren't alphbetically ordered.  That means that we can't use a built in function to sort, we've got to come up with a translation first.  It also means that we'd need to have a SPECIAL sort that was only for Rank . . or do something different.

Translation Table:
Any way we work this, we're probably going to need a translation table.  We need to turn the "words" of rank into something that we CAN use standard comparisons on.  The quickest way is with a Translation or Lookup table:
$lookup_rank = Array ("Guild Leader" => 1,
                     "Officer" => 2,
                     "Member" => 3,
                     "Initiate" => 4);
To use this, we can say:
$my_row[x]['rank_value'] = $lookup_rank[$my_row[x]['rank']];
We're being sneaky here, using the value of $my_row['rank'] as the INDEX in our lookup table, which returns us the value we've assigned to that rank.

Using it:
There are two ways we can use our lookup - either ALWAYS do the lookup and have it stored as part of the data we display, or make a special sort function that does the lookup "on the fly", but only when we're sorting a rank.
The first idea, always translating, is probably easiest. 
First, you have to change the read_db() function to do the lookup (lookup table not included)
// Read the data into an array 
while($line = $db->sql_fetchrow($result2))  { 
    
$data_array[$line[Name]] = $line
;
   $data_array['rank_value'] = $lookup_rank[$line['rank']]; // Create a rank_value based on the lookup
}

Then there would need to be a change to the decode_sort() function to sort by the non-visable field
case "R":  return "rank_value" // Change from "Rank", which is actually displayed. 

This is probably MUCH easier than the alternative, creating a specialized sort function, so I won't write code for it.  There are may be good reasons for solving it in that manner, though - This takes up more memory, particularly on long lists.  However, it may never be an issue until you have a 300+ member guild, which is probably a problem in and of itself.

You could also turn the problem on it's head - do the translation when the values are stored and only convert them back when you display.  That has the advantage of taking less database space and memory, but more computational time when you display.

Maybe I've given you WAY more information than you needed to know.  It's been fun for me, and I'll probably include these changes in the next versions of Roster Master, now that I've written them . . .

03-30-2005 03:04 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Kevlin
Guardian

Again AWESOME program, now is there a way to pull in data like quests completed, max melee and max magic along with other things from the achievements page?

Of course I like the majority have expressed have zero or little experience with PHP so I have no idea how hard it is.

 

We are using CPG-Nuke Dragonfly and you can see the roster on the left hand side click on Guild Roster.

http://risingdawn.net

 

03-30-2005 03:33 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
SaintPeter
Champion



Kevlin wrote:
Again AWESOME program, now is there a way to pull in data like quests completed, max melee and max magic along with other things from the achievements page.

Possible, yes.  By me?  Not something that I'm interested in doing.

I wrote this module with the idea of allowing the average guild to be able to "host" their own guild roster and integrate it into the look and feel of their own website.  I also created it with an eye to expansion by the many talented coders our there who are in charge of their own websites.  It's handy, from a guild management perspective, to have a quick view of your roster.  To that end, I've imported what I consider to be the "essentials" to guild management.  Everything else is gravy.

03-30-2005 04:43 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Aelona
Master

SaintPeter,

Thank you for this wonderful program and the helpful information!  My guild absolutely loves it on our site.  Now if they would just stop asking me to figure out coding to add stuff to it.

Fey

Message Edited by Aelona on 03-30-2005 06:03 PM

03-30-2005 08:02 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Nomandis
Journeyman

What can I say been looking for something like this for a while

Check it out on our website

Cohort Chalybeius

03-30-2005 10:42 PM



  Re: Roster Master: Cached/Sortable Guild Roster for your Personal Guild Site (Beta)
Vindicare
Loremaster

Awesome script, really appreciate Peter's work (I'm using respective looking forward to use the standalone MySQL version).

However, I wonder how to get the KvD and Quest numbers into my roster (or fetch-array) aswell.
These numbers are collumns in the default roster, so pulling them should be rather trivial.
But as I obviously lack some basic PHP-knowledge, I just can't figure out how to do it....


I think it's in rm_data_parse.php and should have something to do with the following code:
--------------------------------------------------------------------------------------------------
// Now, parse through the data
        foreach($my_array as $index => $line)  {
                // Massive Regular Expression to fetch all the data and "validate" it at the same time.
                // Each ([^~]+)~ captures everything between the seach index until it hits a ~
                // Each ([0-9]+)~ captures only numbers between the search index and the next ~
                // ([0-9,]+) is a special case to capture the status points, since they sometimes have a comma
                if(ereg("([^~]+)~([0-9]+)~([^~]+)~([^~]+)~([0-9]+)~([^~]+)~([0-9]+)~[0-9]+~[0-9]+~([0-9,]+)~([^~]+)", $line, $match))  {
                       // Once we know we have a match, assign the results of the $match varable to the array
                       $new_line[Name] = $match[3];
                       $new_line[Rank] = $match[1];
                    $new_line[Adv_Level] = $match[5];
                    $new_line[Art_Level] = $match[7];
                    $new_line[Adv_Class] = $match[4];
                    $new_line[Art_Class] = $match[6];
                    $new_line[Joined] = strtotime($match[9]);
                    $new_line[Points] = str_replace(",","",$match[8]);
                    $new_line[Char_id] = $match[2];
                   
                    $parsed_data_array["$new_line[Name]"] = $new_line;
                } else {// End Ereg Check If
                    // Keep track of how many times we can't read a line right.
                    $badlines++;   
                }
               
        }  // End foreach - We're done reading the data into an array.

-----------------------------------------------------------------------------------------

I just don't know how to alter it, so KvD and Quest values are put into the array aswell...

Any help appreciated.

[EDIT]
Nevermind, just figured it out.

Had to replace
if(ereg("([^~]+)~([0-9]+)~([^~]+)~([^~]+)~([0-9]+)~([^~]+)~([0-9]+)~[0-9]+~[0-9]+~([0-9,]+)~([^~]+)", $line, $match))
with
if(ereg("([^~]+)~([0-9]+)~([^~]+)~([^~]+)~([0-9]+)~([^~]+)~([0-9]+)~([0-9,]+)~([0-9,]+)~([0-9,]+)~([^~]+)", $line, $match))

After that adding 2 new fields in my database and alter the sql-insert a bit.


Again: Great piece of work and coding

Message Edited by Vindicare on 03-30-2005 11:30 PM

03-31-2005 12:51 AM