phpBBSync addon for Roster 2.0

Synchronizes various aspects of your Roster with your phpBB forum

Moderator: jaffa

Re: phpBBSync addon for Roster 2.0

Postby wacoede » Tue Apr 15, 2008 4:34 pm

http://www.cpgnuke.com/Downloads/details/id=393/

thats the multirank mod/hack for DF (but you can pretty much port it to any CMS using phpBB(as long as you know what your doing))

The only extra items in the tables is 4 extra fields (user_rank2 - user_rank5) within the $prefix_users table
User avatar
wacoede
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Sat Sep 02, 2006 2:07 am

Re: phpBBSync addon for Roster 2.0

Postby jaffa » Tue Apr 15, 2008 5:52 pm

wacoede wrote:http://www.cpgnuke.com/Downloads/details/id=393/

thats the multirank mod/hack for DF (but you can pretty much port it to any CMS using phpBB(as long as you know what your doing))

The only extra items in the tables is 4 extra fields (user_rank2 - user_rank5) within the $prefix_users table


That sounds much simpler than I was imagining. The only difficult bit will be error checking I would imagine (if the user sets the option but doesn't have the hack installed). I will definitely have a look at this.
User avatar
jaffa
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 49
Joined: Thu Jan 10, 2008 11:35 pm

Re: phpBBSync addon for Roster 2.0

Postby wacoede » Wed Apr 16, 2008 11:08 pm

jaffa wrote:That sounds much simpler than I was imagining. The only difficult bit will be error checking I would imagine (if the user sets the option but doesn't have the hack installed). I will definitely have a look at this.


I'm a bit of a PHP noob so excuse me if this isn't possible
but instead of it being active all the time why not have the script check for those 4 fields and if they exist then to active the multi rank capabilities

then all I'll need is for RosterDF 2.0 to be released and my life becomes so much easier
User avatar
wacoede
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Sat Sep 02, 2006 2:07 am

Re: phpBBSync addon for Roster 2.0

Postby jaffa » Thu Apr 17, 2008 1:11 am

wacoede wrote:I'm a bit of a PHP noob so excuse me if this isn't possible
but instead of it being active all the time why not have the script check for those 4 fields and if they exist then to active the multi rank capabilities


It's definitely possible - I'm a PHP n00b too, so it may take me a little while to work out - something to do with SHOW COLUMNS I guess.
User avatar
jaffa
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 49
Joined: Thu Jan 10, 2008 11:35 pm

phpBBSync addon for Roster 2.0

Postby wacoede » Sat Apr 19, 2008 11:03 pm

ok Jaffa got a few bits for you :D

lets start simple

the img folder needs to be renamed to images (to conform to the SDK) this will fix the no icon displaying in the Addon Management Menu

a piece of code I'm fairly sure you'll of fixed by now if you've spotted it

in update_hook.php find (lines 261 - 266)
Code: Select all
if ($this->data['config']['forum_type'] == 0) /*DF*/{
   $query="update {$this->data['config']['forum_prefix']}users u inner join {$roster->db->prefix}members m
   set u.user_sig = concat(\"[img]\", '$sig[0]', m.name, '$sig[1]', \"[/img]\")
   where ucase(u.name) = ucase(m.name)
and user_sig is null"; /*only updates people with blank signatures*/
}

and change to
Code: Select all
if ($this->data['config']['forum_type'] == 0) /*DF*/{
   $query="update {$this->data['config']['forum_prefix']}users u inner join {$roster->db->prefix}members m  inner join {$roster->db->prefix}players p
   set u.user_sig = concat(\"[img]\", '$sig[0]', m.name, '$sig[1]', \"[/img]\")
   where ucase(u.name) = ucase(m.name)
   and p.name=m.name
   and user_sig is null"; /*only updates people with blank signatures*/
}


that will stop the script trying to update peoples sigs who have not uploaded any roster data same as the avatar code

well that's it for bugs I've found while testing this

now on to a idea I had but I'm unsure on if it can be done

do you think it would be possible to move all the CMS/Forum specific stuff (like which tables/fields to grab info from and send to) off to seperate files and then use them like include files

so you'd have something like

inc/phpbb3.php
inc/dragonfly.php

it will probably require a massive rewrite of the update hook but it would then allow others to write files with the info need to do this sort of thing to their own CMS or Forums

and maybe I'm just thinking to far fetched

if you decide to try it though let me know I have a bit of space and access to a few databases (read 600gb of space and unlimited databases) :D and I'd be willing to help out on this.

oh and also a thought i had about the real name/which field to use

I've noticed both systems (dragonfly & phpBB3) both have an option to create custom fields you could just let the users decide where to pull the data from with just a text input field
Last edited by wacoede on Sat Apr 19, 2008 11:13 pm, edited 1 time in total.
Image
User avatar
wacoede
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Sat Sep 02, 2006 2:07 am

Re: phpBBSync addon for Roster 2.0

Postby wacoede » Sun Apr 20, 2008 7:46 pm

hey again Jaffa few more bits for you and the multi rank add on

firstly the SQL
Code: Select all
Show columns FROM cms_users LIKE 'user_rank%';


fairly simple stuff

as for the PHP bit that's going to be a bit more difficult

my guess would be a mysql_fetch_row then have it compare how many results it gets. so if it retrieves 1 then it shows the current option to set the main rank to guild rank but if its greater than 1 then it allows you to choose what ranks on the forums to set from the roster

and maybe even adding in the option to set things like Class and Race as ranks

Code: Select all

$sql 
'Show columns FROM cms_users LIKE \'user_rank%\';';
$row mysql_fetch_row($sql)
 if (
$row 1)   {
     
/*Insert Current Code Here???? or a variable set to 0??*/
 
}
 if (
$row 1)     {
     
/*new code?? or variable set to 1???*/
 
}
 


I know its not much help when it comes to the roster stuff as they have their own DB calls but start from the basic code and work up from there maybe one of the roster devs could help us out with this
Image
User avatar
wacoede
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Sat Sep 02, 2006 2:07 am

phpBBSync addon for Roster 2.0

Postby jaffa » Mon Apr 21, 2008 3:16 am

I've kinda been putting off working on this while I got my epic flying mount (woo!) but I see I'm going to have to put some time in. I will do the bits that I can see how to do during the week then try to have a look at the includes thing at the weekend, although that is way out of my comfort zone so it may take a while.
User avatar
jaffa
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 49
Joined: Thu Jan 10, 2008 11:35 pm

Re: phpBBSync addon for Roster 2.0

Postby wacoede » Mon Apr 21, 2008 4:54 am

np man as you can see I still need to level my character but I hate grinding so I've been putting that off lol
Image
User avatar
wacoede
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Sat Sep 02, 2006 2:07 am

phpBBSync addon for Roster 2.0

Postby jaffa » Mon Apr 21, 2008 3:17 pm

I've thought about this, and it seems the simplest way to do the separate forum specific stuff is just to have a list of strings in the separate file, like the localisation file. The update file would then look for $phpBB_avupdate or $DF_avupdate of whatever depending on the setting in the options, and that variable would contain the sql string. I guess I'd need to be able to build up the variable or function name dynamically to do that, and I don't know if that's possible in php. Also, I'm not sure how it would handle the variables inside the string (the table prefixes etc). I guess they could somehow be passed to the the separate file from update_hook.php. Unless anyone can think of another way of doing it?
User avatar
jaffa
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 49
Joined: Thu Jan 10, 2008 11:35 pm

phpBBSync addon for Roster 2.0

Postby wacoede » Mon Apr 21, 2008 4:07 pm

one thing i thought of is add a field to the _Addon_phpBBsync table where it would specify the cms type

if we can program it to pull a list of the files (without file ext) from a sub directory of the inc folder then that would help in allowing others to write addon files for other cms's

as for the SQL strings they are pretty much the same for all as long as their using mySQL (which roster requires) so we could keep those in the main file but use strings to select the table names so instead of using
Code: Select all
`{$this->data['config']['forum_prefix']}bbgroups`
we'd use
Code: Select all
`{$this->data['config']['forum_prefix']}$rsync[groups]`


then in the new files we can define $rsync[groups] as either bbgroups or whatever phpbb3 uses or any other CMS
Image
User avatar
wacoede
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Sat Sep 02, 2006 2:07 am

Re: phpBBSync addon for Roster 2.0

Postby jaffa » Mon Apr 21, 2008 4:22 pm

It is true that the queries are basically the same between DF and phpBB but that may not be the same in other forums (fora?). There are 4 tables used (which you have probably already seen) - users, ranks, groups and usergroups (a join table between users and groups). If a forum uses that structure, then we could just have 4 options listing those tables which the user could edit if need be. Then we wouldn't need to have the plugin structure you describe. The trouble arises if a different structure is used - which is probably the case in any forum not based on phpBB.
User avatar
jaffa
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 49
Joined: Thu Jan 10, 2008 11:35 pm

Re: phpBBSync addon for Roster 2.0

Postby jaffa » Mon Apr 21, 2008 4:34 pm

And come to think of it, even the queries I already have are not the same, especially the insert ones, as phpBB3 has more fields in many tables.
Last edited by jaffa on Mon Apr 21, 2008 4:34 pm, edited 1 time in total.
User avatar
jaffa
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 49
Joined: Thu Jan 10, 2008 11:35 pm

phpBBSync addon for Roster 2.0

Postby PleegWat » Mon Apr 21, 2008 5:22 pm

You'd need to pull defaults from somewhere, probably.

Also, I trust you know the INSERT INTO `table` (fields) VALUES (values) syntax?

EDIT: Oh, and there should be a config type to select a file from a specific directory.
Last edited by PleegWat on Mon Apr 21, 2008 5:23 pm, edited 1 time in total.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: phpBBSync addon for Roster 2.0

Postby jaffa » Mon Apr 21, 2008 5:53 pm

It looks like I could use call_user_func to call a function when I don't know what the function name is at design time. So if someone added an include for, say, YetAnotherCMS, I could have an option to set the CMS name, $cms, then run
Code: Select all
call_user_func(array($cms'SigUpdate')) 

to call the SigUpdate function in that class. Or I could use a dynamic variable name just to get the sql strings from the include files. I think I prefer the former as people could add new functions to specific implementations then - for instance, I could have a function called 'OtherOperations' in all the includes that could be empty in some but contain other stuff for others.
User avatar
jaffa
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 49
Joined: Thu Jan 10, 2008 11:35 pm

phpBBSync addon for Roster 2.0

Postby TankGirl » Mon Apr 21, 2008 11:55 pm

Jaffa this is just some advice to keep you from getting overwhelmed.
You should focus first on a stable addon, and features that work with STOCK Roster 2 and DFphpbb/phpbb3.
Once you start fooling around with modded versions of either, this taking you down a path that can make you crazy.
People might expect a consideration for every phpbb/roster mod out there.

I myself MOD my roster2 and phpbb3 stuff, BUT I don't expect developers of addons to make it compatible with every change I make. That responsibility should rest on MY shoulders, to make it work. I was the one that made the decision to MOD any of it, and in doing so I should accept the risks.

Don't let your brain explode and have fun. You're doing a great job.
User avatar
TankGirl
WR.net Apprentice
WR.net Apprentice
 
Posts: 51
Joined: Mon Apr 30, 2007 2:14 pm
Location: The bad place in my mind.

PreviousNext

Return to phpBB Sync

Who is online

Users browsing this forum: No registered users and 0 guests

cron