Wayne Posted April 23, 2009 Report Share Posted April 23, 2009 I know it goes into a module just not sure how to call it i guess you could say when you register so that it will create a account in the forums as well Quote Link to comment Share on other sites More sharing options...
roboa Posted April 23, 2009 Report Share Posted April 23, 2009 Yeah, I'm trying to do the same thing and sticking the code in a module on it's own won't do anything Quote Link to comment Share on other sites More sharing options...
packo88 Posted April 23, 2009 Report Share Posted April 23, 2009 Yeah I have given it a go and cant seem to get it to do anything. I feel some step by step instructions are needed for us not so PHP educated VA admins. A forum is a big part of a VA, not just for help, but also for the particular VA community to share there experiances and offer there ideas for new routes, Hubs ect. ect. I feel the best scenario would be a very simple forum to be intergrated with PHPVMS but I dont think this is in the pipeline at all. Quote Link to comment Share on other sites More sharing options...
roboa Posted April 23, 2009 Report Share Posted April 23, 2009 That code would work just not sure where I should be putting it! Quote Link to comment Share on other sites More sharing options...
flynryan692 Posted April 23, 2009 Report Share Posted April 23, 2009 I feel some step by step instructions are needed for us not so PHP educated VA admins. Word. I would greatly appreciate the help of the more educated guys. Quote Link to comment Share on other sites More sharing options...
G-NEWC Posted April 24, 2009 Report Share Posted April 24, 2009 Same goes for me...not sure where to start. Any guidance would be appreciated. Cheers. Quote Link to comment Share on other sites More sharing options...
goldenairways Posted April 24, 2009 Report Share Posted April 24, 2009 I am exacly the same. I am also wanting to make a custom template but I don't have any of the software in either tutorials to do it with, neither the experiance. Then I am not sure how much coding this is going to need. I just hope its either no coding after that part about making it writable or the template or not too much coding. lol I have hit a brick wall so far. At least I have another un-sucessful, stuipid project I am trying. lol Quote Link to comment Share on other sites More sharing options...
steelerboi Posted April 25, 2009 Report Share Posted April 25, 2009 Hi guys, I was having probs integrating the membership into SMF too, so one night last week I sat down with a mate who's a programmer and working from the original ForumRegister module code which Mark posted, we came up with the following code which seems to work ok. [*]Step 1: Create a new folder in /core/modules called ForumRegister [*]Step 2: In that folder create a new php file called ForumRegister.php [*]Step 3: Copy and paste in the following code <?phpclass ForumRegister extends CodonModule{ public function __construct() { CodonEvent::addListener('ForumRegister'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'registration_complete') { $userinfo = $eventinfo[2];$fname = $userinfo['firstname'];$lname = $userinfo['lastname'];$pass = $userinfo['password1'];$email = $userinfo['email'];$code = $userinfo['code'];$get_uinfo = mysql_query("SELECT * FROM phpvms_pilots WHERE firstname='".$fname."' AND lastname='".$lname."' AND email='".$email."'");$uinfo = mysql_fetch_array( $get_uinfo );$str = $uinfo['pilotid'];$pilot_id = str_pad ($str,4,"0",STR_PAD_LEFT);$pilot_id = $code.$pilot_id; $pilot_name = mysql_escape_string ($fname. ' ' .$lname);$passsha1 = mysql_escape_string (sha1(strtolower($email) . $pass));$passsalt = substr(md5(mt_rand()), 0, 4);$email = mysql_escape_string($email);$tm = time();mysql_query("INSERT INTO smf_members (member_name, real_name, passwd, email_address, hide_email, id_group, time_offset, location, lngfile, validation_code, id_theme, is_activated, id_msg_last_visit, date_registered, password_salt) VALUES ('".$email."', '".$pilot_name."', '".$passsha1."', '".$email."', '1', '4', '', '', '', '', '0', '1', '1', '".$tm."', '".$passsalt."')");$member_id = mysql_insert_id(); mysql_query("update smf_settings set value = '$pilot_name' where variable='latestRealName'");mysql_query("update smf_settings set value = '$member_id' where variable='latestMember'"); } }}?> Save everything and try a signup from your VA site and all being well a new account will also be created in SMF We modified the code so that some different variables were inserted into the SMF database and also included the queries that perform an update to show the latest member. In addition, the password salt line has also been included, as otherwise without this the new user would need to login twice to SMF to begin with in order for the salt to be created. This is now generated automatically by the extra lines in the code above. The other thing we tweaked was the way of logging into SMF, as originally it used the fullname and pilot code. The code now uses the email address, so the pilot can use the exact same login as on the VA site. Hope this helps you all, as I know it was a huge relief to me to finally get the memberships working together Quote Link to comment Share on other sites More sharing options...
Strider Posted April 26, 2009 Report Share Posted April 26, 2009 nige I tried it, and it didn't work. I copied and pasted you code did what you said, and signed up after uploading the forumregister folder. Cheers Dan C Quote Link to comment Share on other sites More sharing options...
steelerboi Posted April 26, 2009 Report Share Posted April 26, 2009 Dan, is your SMF running on a separate database, or the same one as phpvms ? One of the things I forgot to mention is that I have both using the same database, so if you're using 2 databases, you would need to call the correct database from the code. Quote Link to comment Share on other sites More sharing options...
flynryan692 Posted April 26, 2009 Report Share Posted April 26, 2009 How would I go about making this work in phpbb? Quote Link to comment Share on other sites More sharing options...
steelerboi Posted April 27, 2009 Report Share Posted April 27, 2009 Not too sure about PHPBB, as I don't use that myself. Theoretically you should just be able to create the ForumRegister module and use the code which Mark posted earlier in your ForumRegister.php file, as that was specifically for PHPBB. Quote Link to comment Share on other sites More sharing options...
selwynorren Posted May 27, 2009 Report Share Posted May 27, 2009 Hi everyone I have followed all the posts and have implemented the forum registration and it all work perfectly. I am using phpBB 2 and here is my problem. I want to be able to send the country name to the forum databse, I can get the country code in easy enough, but just not the actual country name here is my code completed (without teh country thingy as I cannot get it to work) <?php class ForumRegister extends CodonModule { public function __construct() { CodonEvent::addListener('ForumRegister'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'registration_complete') { $userinfo = $eventinfo[2]; $fname = $userinfo['firstname']; $lname = $userinfo['lastname']; $pass = $userinfo['password1']; $email = $userinfo['email']; $code = $userinfo['code']; $countries = $userinfo['countries']; $get_uinfo = mysql_query("SELECT * FROM phpvms_pilots WHERE firstname='".$fname."' AND lastname='".$lname."' AND email='".$email."'"); //echo "Result Select: ".mysql_error()."<br>"; $uinfo = mysql_fetch_array( $get_uinfo ); $str = $uinfo['pilotid']; $pilot_id = str_pad ($str,3,"0",STR_PAD_LEFT); $pilot_id = $code.$pilot_id; $pilot_id_klein = strtolower($pilot_id); $passMD5 = md5($pass); $tm = time(); $query = ("INSERT INTO phpbb_users ( user_id, user_active, username, user_password, user_session_time, user_lastvisit, user_regdate, user_timezone, user_style, user_lang, user_dateformat, user_attachsig, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify_pm, user_popup_pm, user_email, user_from) VALUES($str, 1, '$pilot_id', '$passMD5', '$tm', '$tm', '$tm', 0.00, 2, 'english', 'D M d, Y g:i a', 1, 1, 1, 1, 1, 1, 1, 1, '$email', '$countries')"); $result = mysql_query($query) or die(mysql_error()); $query = ("INSERT INTO phpbb_groups (group_type, group_description, group_moderator, group_single_user) VALUES(1, 'Personal User', 0, 1)"); $result = mysql_query($query) or die(mysql_error()); $group_user_id = mysql_insert_id(); $query = ("INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES('$group_user_id', '$str', 0)"); $result = mysql_query($query) or die(mysql_error()); //echo "Result: ".mysql_error()."<br>"; //print_r($userinfo); } } } Any help is greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted May 28, 2009 Administrators Report Share Posted May 28, 2009 Use: <?php $country_name = Countries::getCountryName($userinfo['location']); Or whichever variable holds the country code (pretty sure it's "location") Quote Link to comment Share on other sites More sharing options...
selwynorren Posted May 28, 2009 Report Share Posted May 28, 2009 ;D ;D I would have said cheesy grin, if I could. I was so close yet so far. Nabeel would the list of variables used be under the development documentation? Admittedly I have not ready that very well. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted May 29, 2009 Administrators Report Share Posted May 29, 2009 There isn't really a list, but it will be the same as the column names. The quick trick that I still use for the variable names are var_dump or print_r... print_r($userinfo); And will give you a list of the members Quote Link to comment Share on other sites More sharing options...
Kreu Posted August 7, 2009 Report Share Posted August 7, 2009 Could anyone be so kind as to paste a fully working phpBB script for the ForumRegsiter module? I tried using the phpBB listed codes but only got a series of errors back... Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted August 7, 2009 Administrators Report Share Posted August 7, 2009 Can you post the errors? It would help for improving this Quote Link to comment Share on other sites More sharing options...
Kreu Posted August 7, 2009 Report Share Posted August 7, 2009 This is what I get upon registering a new account: Confirmation Sent Thanks for registering for Fly Melita, you will be notified via email of your registration status. Warning: mysql_query() [function.mysql-query]: Access denied for user 'flymelit'@'localhost' (using password: NO) in /home1/flymelit/public_html/core/modules/ForumRegister/ForumRegister.php on line 26 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home1/flymelit/public_html/core/modules/ForumRegister/ForumRegister.php on line 26 Result Select: Access denied for user 'flymelit'@'localhost' (using password: NO) Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home1/flymelit/public_html/core/modules/ForumRegister/ForumRegister.php on line 28 PilotID: Warning: mysql_query() [function.mysql-query]: Access denied for user 'flymelit'@'localhost' (using password: NO) in /home1/flymelit/public_html/core/modules/ForumRegister/ForumRegister.php on line 43 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home1/flymelit/public_html/core/modules/ForumRegister/ForumRegister.php on line 43 And this is the code I used: <?php class ForumRegister extends CodonModule { public function __construct() { CodonEvent::addListener('ForumRegister'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'registration_complete') { $userinfo = $eventinfo[2]; $fname = $userinfo['firstname']; $lname = $userinfo['lastname']; $pass = $userinfo['password1']; $email = $userinfo['email']; $code = $userinfo['code']; //mysql_query("INSERT INTO phpbb_users (username, user_password, group_id, user_timezone, user_dst, user_lang, user_type, user_actkey, user_dateformat, user_style, user_regdate) VALUES ($userr, $pass, '2','1.0', '0','en','0','','d M Y H:i', '1', time())"); $get_uinfo = mysql_query("SELECT * FROM phpvms_pilots WHERE firstname='".$fname."' AND lastname='".$lname."' AND email='".$email."'"); echo "Result Select: ".mysql_error()."<br>"; $uinfo = mysql_fetch_array( $get_uinfo ); //echo "Uinfo: ".$uinfo['pilotid']; $str = $uinfo['pilotid']; $pilot_id = str_pad ($str,4,"0",STR_PAD_LEFT); $pilot_id = $fname.$lname.$code.$pilot_id; $pilot_id_klein = strtolower($pilot_id); //echo "Pass: ".$pass."<br>"; $passMD5 = md5($pass); //echo "Pass MD5: ".$passMD5."<br>"; echo "PilotID: ".$str."<br>"; $tm = time(); mysql_query("INSERT INTO phpbb_users (username, username_clean, user_password, user_email, group_id, user_timezone, user_dst, user_rank, user_lang, user_colour, user_type, user_actkey, user_dateformat, user_style, user_regdate) VALUES ('".$pilot_id."', '".$pilot_id_klein."', '".$passMD5."', '".$email."', '9','0.0', '0', '2','en','0099FF','1','5BN4938HB2','D M d, Y g:i a', '2', '".$tm."')"); //mysql_query("INSERT INTO phpbb_users (username, user_password) VALUES ('".$pilot_id."', '".md5($userinfo['password'])."')"); //echo "Result: ".mysql_error()."<br>"; //print_r($userinfo); } } } ?> Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted August 7, 2009 Administrators Report Share Posted August 7, 2009 Seems there's something wrong with your username/password for your database Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted August 7, 2009 Administrators Report Share Posted August 7, 2009 And I believe an updated version of that was posted Quote Link to comment Share on other sites More sharing options...
Kreu Posted August 7, 2009 Report Share Posted August 7, 2009 and how can i correct that? ??? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted August 7, 2009 Administrators Report Share Posted August 7, 2009 This should be a fixed up version, using the proper API calls <?php class ForumRegister extends CodonModule { public function __construct() { parent::construct(); CodonEvent::addListener('ForumRegister'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'registration_complete') { $userinfo = $eventinfo[2]; $fname = $userinfo['firstname']; $lname = $userinfo['lastname']; $pass = $userinfo['password1']; $email = $userinfo['email']; $code = $userinfo['code']; $uinfo = PilotData::GetPilotByEmail($userinfo['email']); $code = PilotData::GetPilotCode($uinfo->code, $uinfo->pilotid); $pilot_id = $fname.$lname.$code.$pilot_id; $pilot_id_klein = strtolower($pilot_id); $passMD5 = md5($pass); $tm = time(); DB::query("INSERT INTO phpbb_users (username, username_clean, user_password, user_email, group_id, user_timezone, user_dst, user_rank, user_lang, user_colour, user_type, user_actkey, user_dateformat, user_style, user_regdate) VALUES ('".$pilot_id."', '".$pilot_id_klein."', '".$passMD5."', '".$email."', '9','0.0', '0', '2','en','0099FF','1','5BN4938HB2','D M d, Y g:i a', '2', '".$tm."')"); } } } ?> Quote Link to comment Share on other sites More sharing options...
Kreu Posted August 7, 2009 Report Share Posted August 7, 2009 Website won't even show up! This error is diplayed though: Fatal error: Call to undefined method CodonModule::construct() in /home1/flymelit/public_html/core/modules/ForumRegister/ForumRegister.php on line 7 Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted August 7, 2009 Administrators Report Share Posted August 7, 2009 Delete this line: parent::construct(); Quote Link to comment Share on other sites More sharing options...
Kreu Posted August 7, 2009 Report Share Posted August 7, 2009 Brilliant! phpBB is working fine with this code! Thanks! Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted October 16, 2009 Report Share Posted October 16, 2009 This should be a fixed up version, using the proper API calls <?php class ForumRegister extends CodonModule { public function __construct() { parent::construct(); CodonEvent::addListener('ForumRegister'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'registration_complete') { $userinfo = $eventinfo[2]; $fname = $userinfo['firstname']; $lname = $userinfo['lastname']; $pass = $userinfo['password1']; $email = $userinfo['email']; $code = $userinfo['code']; $uinfo = PilotData::GetPilotByEmail($userinfo['email']); $code = PilotData::GetPilotCode($uinfo->code, $uinfo->pilotid); $pilot_id = $fname.$lname.$code.$pilot_id; $pilot_id_klein = strtolower($pilot_id); $passMD5 = md5($pass); $tm = time(); DB::query("INSERT INTO phpbb_users (username, username_clean, user_password, user_email, group_id, user_timezone, user_dst, user_rank, user_lang, user_colour, user_type, user_actkey, user_dateformat, user_style, user_regdate) VALUES ('".$pilot_id."', '".$pilot_id_klein."', '".$passMD5."', '".$email."', '9','0.0', '0', '2','en','0099FF','1','5BN4938HB2','D M d, Y g:i a', '2', '".$tm."')"); } } } ?> So this is the final answer to the phpBB3 integration? I really want to use something like this but I can wait until all the kinks have been worked out. I really appreciate all the hard work everyone puts into phpVMS. I can mod the hell right out of phpBB2.x and 3.x but this phpVMS is REAL brand new to me. If I do use this, I create that folder in the modules folder and insert the php doc that I create and then install a phpBB3 using the same database as phpVMS and thats it? When a new person registers it will create a phpBB3 account? Or do I need to do something further in the Admin section of my phpVMS install? Sorry to sound like such a newb, but I really am here ;D Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 17, 2009 Administrators Report Share Posted October 17, 2009 So this is the final answer to the phpBB3 integration? I really want to use something like this but I can wait until all the kinks have been worked out. I really appreciate all the hard work everyone puts into phpVMS. I can mod the hell right out of phpBB2.x and 3.x but this phpVMS is REAL brand new to me. If I do use this, I create that folder in the modules folder and insert the php doc that I create and then install a phpBB3 using the same database as phpVMS and thats it? When a new person registers it will create a phpBB3 account? Or do I need to do something further in the Admin section of my phpVMS install? Sorry to sound like such a newb, but I really am here ;D Welcome! And yep, that should be it! It hooks in using the EventListener() function, so no core code has to be touched to extend. It may break in phpBB updates, or something might be nulled or wrong with the user created - I'm not sure. To be sure, it has to use the phpBB API, but I haven't had the time to search that out. There was another post around here where I grabbed it from, it might be worth skimming through that Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted October 17, 2009 Report Share Posted October 17, 2009 Ok I'll have a search and read. Thanks a bunch. Quote Link to comment Share on other sites More sharing options...
Kieran Posted February 14, 2010 Report Share Posted February 14, 2010 So you simply add the ForumRegister module... and that's it? Is there anything that you need to modify in the registration scripts? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.