Jump to content

Recommended Posts

  • Administrators
Posted

Originally from this topic:

http://forum.phpvms.net/index.php?topic=272.0

<?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'];

      
         $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 far, confirmed working by one person. But I would feel more comfortable if it were using the phpBB API for adding users.

  • 2 weeks later...
  • 1 month later...
Guest Ryyaann
Posted

Would anyone be able to write a quick tutorial on how to actually implement this code?

Im not quite sure what to do with it.

Cheers,

Tom.

Second that Tomo ! ;D

Posted

Scrap that sorry. Ryan:

Make a module folder "ForumRegister"

Pase that code in as ForumRegister.php

done.

I'm having a problem though, the users are inactive and when I made them identical to other registered members they can't see any of the forums.

Any ideas?

Don't worry I fixed it myself.

Guest Ryyaann
Posted

Well, the user went into the database with the right information but its not shown as the newest user and i can not login.

Posted

Yeah the code provided only works for the person who posted it in the first place. You need to add quite a few more things and change things (e.g. group, unless you made a group 9)

Guest Ryyaann
Posted

OK, found out the problem.

They send over fine but they are placed in inactive users. Reason: Unknown

Any help?

Thanks in advance,

Ryan

Could anyone tell me how I could get it to change the username every time their airline changes? So if they are STP555 on the forums and they change airlines they would change to PTY555.

  • 2 weeks later...
  • Administrators
Posted

It really needs to use the phpBB API to do it, not raw calls to the database. If someone can find out that info, I might be able to scratch something up real quick.

Join the conversation

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

Guest
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.

Loading...
×
×
  • Create New...