Találtam egyet, de, valahogy már az elején láttam, hogy baromság, de kisebb átalakítással talán működhet:
-----------------------------------------------------------------------------
I have seen many members and non members ask how to sync IPB with another IPB.
The answer always the same wait for IP.Converge, if you want the answers for IP.Converge when, how, why, what, etc. check
here.
ok let's start:
You have 2 forums
ForumsA & ForumsB
open conf_global.php on ForumsA
look for:
$INFO['sql_host'] = 'localhost';
$INFO['sql_database'] = 'ForumsA';
$INFO['sql_user'] = 'ForumsA';
$INFO['sql_pass'] = 'ForumsA';
$INFO['sql_tbl_prefix'] = 'ibf_';
add below:
$INFO['sql_host2'] = 'localhost';
$INFO['sql_database2'] = 'ForumsB';
$INFO['sql_user2'] = 'ForumsB';
$INFO['sql_pass2'] = 'ForumsB';
$INFO['sql_tbl_prefix2'] = 'ibf_';
Save ForumsA conf_global.php
open /modules/ipb_member_sync.php
look for:
function on_create_account($member, $converge)
{
global $ipsclass;
Add After:
$ipsclass->DB2 = new db_driver;
$ipsclass->DB2->obj['sql_database'] = $ipsclass->vars['sql_database2'];
$ipsclass->DB2->obj['sql_user'] = $ipsclass->vars['sql_user2'];
$ipsclass->DB2->obj['sql_pass'] = $ipsclass->vars['sql_pass2'];
$ipsclass->DB2->obj['sql_host'] = $ipsclass->vars['sql_host2'];
$ipsclass->DB2->obj['sql_tbl_prefix'] = $ipsclass->vars['sql_tbl_prefix2'];
$ipsclass->DB2->obj['use_shutdown'] = USE_SHUTDOWN;
$ipsclass->DB2->connect();
$ipsclass->DB2->do_insert( 'members_converge', $converge );
//-----------------------------------------
// Insert: MEMBERS
//-----------------------------------------
$check = $this->ipsclass->DB2->build_and_exec_query(array('select'=>'id','from'=>'members','where'=>"id=".$this->ipsclass->member['id']));
if($check['id'])
{
$this->ipsclass->DB2->close_db();
$this->ipsclass->DB->connect();
$this->ipsclass->lang['asdf'] = "";
$this->ipsclass->Error(array('MSG'=>'Member ID in Use!'));
}
$check = $this->ipsclass->DB2->build_and_exec_query(array('select'=>'name','from'=>'members','where'=>"name=".$this->ipsclass->member['name']));
if($check['name'])
{
$this->ipsclass->DB2->close_db();
$this->ipsclass->DB->connect();
$this->ipsclass->lang['asdf'] = "";
$this->ipsclass->Error(array('MSG'=>'Member Name in Use!'));
}
$check = $this->ipsclass->DB2->build_and_exec_query(array('select'=>'members_display_name','from'=>'members','where'=>"members_display_name=".$this->ipsclass->member['members_display_name']));
if($check['members_display_name'])
{
$this->ipsclass->DB2->close_db();
$this->ipsclass->DB->connect();
$this->ipsclass->lang['asdf'] = "";
$this->ipsclass->Error(array('MSG'=>'Member Display Name in Use!'));
}
$check = $this->ipsclass->DB2->build_and_exec_query(array('select'=>'email','from'=>'members','where'=>"id=".$this->ipsclass->member['email']));
if($check['email'])
{
$this->ipsclass->DB2->close_db();
$this->ipsclass->DB->connect();
$this->ipsclass->lang['asdf'] = "";
$this->ipsclass->Error(array('MSG'=>'Email Address in Use!'));
}
$ipsclass->DB2->force_data_type = array( 'name' => 'string' );
$ipsclass->DB2->do_insert( 'members', $member );
$ipsclass->DB2->close_db();
Save modules/ipb_member_sync.php
Change this line:
$this->ipsclass->Error(array('MSG'=>'asdf'));
asdf to an Error Message you want shown to the member.
open sources/action_public/register.php
look for:
$member['password'] = trim($this->ipsclass->input['PassWord']);
$this->modules->on_create_account($member);
Replace With:
$this->modules->on_create_account($member, $converge); $member['password'] = trim($this->ipsclass->input['PassWord']);
Save sources/action_public/register.php
This takes the members info from ForumA and inserts into ForumB database.
open /modules/ipb_member_sync.php
look for:
function on_group_change( $id, $new_group )
{
global $ipsclass;
if ($new_group != 3) {
return;
}
//---- START
Add After:
$ipsclass->DB2 = new db_driver;
$ipsclass->DB2->obj['sql_database'] = $ipsclass->vars['sql_database2'];
$ipsclass->DB2->obj['sql_user'] = $ipsclass->vars['sql_user2'];
$ipsclass->DB2->obj['sql_pass'] = $ipsclass->vars['sql_pass2'];
$ipsclass->DB2->obj['sql_host'] = $ipsclass->vars['sql_host2'];
$ipsclass->DB2->obj['sql_tbl_prefix'] = $ipsclass->vars['sql_tbl_prefix2'];
$ipsclass->DB2->obj['use_shutdown'] = USE_SHUTDOWN;
$ipsclass->DB2->connect();
$ipsclass->DB2->do_update( 'members', array( 'mgroup' => intval($new_group) ), 'id='.intval($id) );
$uptime = time()+300;
$ipsclass->DB2->do_update('task_manager', array('task_next_run' => $uptime), 'task_id=3');
$ipsclass->DB2->close_db();
Save modules/ipb_member_sync.php
This updates ForumB's groups when the user in ForumA has been moved to a different group.
Right now this is a One Way Sync.
If you want ForumB to sync to ForumA just do the same edits to ForumB.
Next Update will include:
Idézet
| - on_delete: Is called when member deleted (single, multiple)
| - on_email_change: When email address change is confirmed
| - on_profile_update: When profile is updated (msn, sig, etc)
| - on_pass_change: When password is updated
| - on_signature_update: When the users signature is changed
| - on_name_change: When the member's name has been changed
Might not be all of those but at least 2 more.
If you want to use more forums just do the edits to the other forums.
Be Advised you will need to add DB3, DB4, etc to the queries and conf_global so you can sync to those respective DB's
-----------------------------------------------------------------------------
Nos, már a legelső szerkesztésnél elakadtam : open /modules/ipb_member_sync.php
Amit kér, hogy keressek ki, nem találtam sehol ( 1.3-tól 3.0-ig semmi, ami érdekes).
Ebben tudna valaki segíteni? Mert jónak látszik, csak valahogy nekem nem nagyon megy...
Meg persze, gondolom a következő szerkesztést ( open /modules/ipb_member_sync.php) már a másik fórumban kell csinálni egyértelműen, de az előtte lévő regisztrációt is?
A srác nem a tutorial írásáról lehetett híres...