Jump to content

Pilot Country Help


Leiserson

Recommended Posts

Ok so I am adding a pilot country field to the registration form and have already edited the registration_mainform.tpl, RegistrationData.class.php and the registration.php files.

How I edited -

The template-

I added a drop down box, set the value of the box as country and entered the country data and the values aswell.

The registration.php-

	
<?php
function ProcessRegistration()
{

	// Yes, there was an error
	if(!$this->VerifyData())
	{
		Template::Show('registration_mainform.tpl');
	}
	else
	{
		$firstname = $this->post->firstname;
		$lastname = $this->post->lastname;
		$email = $this->post->email;
		$code = $this->post->code;
		$country = $this->post->country;
		$location = $this->post->location;
		$hub = $this->post->hub;
		$password = $this->post->password1;

		if(CodonEvent::Dispatch('registration_precomplete', 'Registration', $_POST) == false)
		{
			return false;
		}

		if(RegistrationData::AddUser($firstname, $lastname, $email, $code, $location, $country, $hub, $password) == false)
?>
 

I haven't added the check to see if valid yet but i will do that later on.

I also edited the RegistrationData.class.php as follows-

<?php
/**
 * Add a  User
 */
public function AddUser($firstname, $lastname, $email, $code, $country, $location, $hub, $password, $confirm=false)
{
	//Set the password, add some salt
	$salt = md5(date('His'));
	$password = md5($password . $salt);

	//Stuff it into here, the confirmation email will use it.
	self::$salt = $salt;

	$firstname = ucwords($firstname);
	$lastname = ucwords($lastname);
	//Add this stuff in

	if($confirm == true)
		$confirm = 1;
	else
		$confirm = 0;

	$sql = "INSERT INTO ".TABLE_PREFIX."pilots (firstname, lastname, email,
				code, country, location, hub, password, salt, confirmed)
			  VALUES ('$firstname', '$lastname', '$email', '$code', '$country',
						'$location', '$hub', '$password', '$salt', $confirm)";

	$res = DB::query($sql);

	if(DB::errno() != 0)
	{
		if(DB::errno() == 1062)
		{
			self::$error = 'This E-mail address has a;ready been used before';
			return false;
		}

		return false;
	}
?>
 

Now my question Nabeel is, are there any more files i must edit for the data to become vaild and what must i add to be able to retrieve the country and an icon representing the flag and display it on the pilots profile.

 

Edited by Leiserson
Personal info
Link to comment
Share on other sites

  • Administrators

You don't need to do all this. In the admin panel, under settings, there's "Custom Fields", you can add it there.http://www.phpvms.net/docs/managing_you ... ile_fieldsAfter adding it, to show it in the profile, you have to call it (assuming you named it "Country"):

echo PilotData::GetFieldValue($pilot->pilotid, 'Country');

As for showing icons, that'd be a bit trickier. But if this seems like something everyone wants, I can add it in, that way there's no hassle during updates. I'm not quite sure where to get the icons as well.

Link to comment
Share on other sites

Hmmm well the problem with custom fields as you said...Is i can call up the icons which is something im wanting. But if you are considering adding it to an update i can give you a source for the icons and maybe even help out abit with the process. You can add me on Im (msn:jacob.krustchinsky@live.com yahoo:jakewestward gmail:jakewestward) and we can talk if you like!Cheers!Jacob Allen KrustchinskyChief Executive OfficerFlyZen Virtual

Link to comment
Share on other sites

  • 11 months later...

You don't need to do all this. In the admin panel, under settings, there's "Custom Fields", you can add it there.

http://www.phpvms.net/docs/managing_you ... ile_fields

After adding it, to show it in the profile, you have to call it (assuming you named it "Country"):

echo PilotData::GetFieldValue($pilot->pilotid, 'Country');

As for showing icons, that'd be a bit trickier. But if this seems like something everyone wants, I can add it in, that way there's no hassle during updates. I'm not quite sure where to get the icons as well.

Hey Nabeel, I know this is old as can be and then some, but I have a COMPLETE set of flags from every country in the world that would work perfect. If you ever need them for something like this, please feel free to give me a shout and I will gladly share with you.

Link to comment
Share on other sites

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