Jump to content

Avatar Change message / error


CarlosEduardo2409

Recommended Posts

Hi everyone, everything fine?

So I've been updating my VA in the settings profile part, but I get an error when I'm going to change the avatar.

So, I'm leaving the profile settings on several tabs (https://prnt.sc/ho331l), all the tabs are ready, the profile tab containing the name, email and location changes and are working correctly, the password change tab is also working, but avatar change tab is not working properly.

The problem is this, when I click to select the avatar and then I click to save the profile I get this message 'The email address can not be blank.', But the avatar change tab only has the function to change the avatar and I believe you do not need to put a space for the email. But I know that my problem is not in my code because when I was with the standard phpVMS code I already received this message. NOTE: The email address was not blank, and even then I got this error and keep getting it.

That's the problem, does anyone know how to fix it?

My profile_edit.php:

<form action="<?php echo url('/profile');?>" method="post" enctype="multipart/form-data">
	<div class="control-group">
		<div class="controls">
			<div class="fileinput fileinput-new" data-provides="fileinput">
				<div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;">
					<?php	
						if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))
                        {
                        	echo '';
                        } else {
                        ?>
                            <img src="<?php	echo SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png';?>" /></dd>
                        <?php
                            }
                        ?>
                </div>
          
                <div>
					<span class="btn red btn-outline btn-file">
                    	<span class="fileinput-new"> Select image </span>
                        <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo Config::Get('AVATAR_FILE_SIZE');?>" />
                        <input type="file" name="avatar" size="40" class="form-control">
                    </span>
                </div>
			</div>
		</div>
	</div>
                                                            
   	<br>
                                                            
    <input type="hidden" name="action" value="saveprofile" />
    <input type="submit" name="submit" class="btn btn-primary red btn-block" value="Upload Avatar">
</form>

 

My save_profile_post from core/module/Profile.php

	/**
	 * Profile::save_profile_post()
	 *
	 * @return
	 */
	protected function save_profile_post()
	{
		if(!Auth::LoggedIn()) {
			$this->set('message', 'You must be logged in to access this feature!');
			$this->render('core_error.php');
			return;
		}

		$pilot = Auth::$pilot;

		//TODO: check email validity
		if($this->post->email == '') {
			$this->set('message', 'The email address cannot be blank.');
			$this->render('core_error.php');
			return;
		}
		
		$fields = RegistrationData::getCustomFields();
		
		if(count($fields) > 0) {
            		foreach ($fields as $field) {
				$value = Vars::POST($field->fieldname);
				$value1 = DB::escape($value);
				if ($field->required == 1 && $value1 == '') {
					$this->set('message', ''.$field->title.' cannot be blank!');
					$this->render('core_error.php');
					return;
				} 
			}
		}

		$params = array(
		    'firstname' => $this->post->firstname,
		    'lastname' => $this->post->lastname,
			'code' => $pilot->code,
			'email' => $this->post->email,
			'location' => $this->post->location,
			'hub' => $pilot->hub,
			'bgimage' => $this->post->bgimage,
			'avatar' => $this->post->avatar,
			'retired' => false
		);

		PilotData::updateProfile($pilot->pilotid, $params);
		PilotData::SaveFields($pilot->pilotid, $_POST);

		# Generate a fresh signature
		PilotData::GenerateSignature($pilot->pilotid);

		PilotData::SaveAvatar($pilot->code, $pilot->pilotid, $_FILES);

		$this->set('message', '<strong>Your profile changes have been saved!</strong> Please, refresh the page to receive the profile changes.');
		$this->render('core_success.php');
	}

 

Sorry for all the embarrassment I said, it was very confusing and sorry if I said something wrong because I'm using google translator.

I already want to thank you all in advance,

Regards,
Carlos

Edited by CarlosEduardo2409
Link to comment
Share on other sites

  • 1 year later...
12 hours ago, BlackSwan said:

Hey everyone,

As I have the same issue, I would like to ask if anyone has figured out why anything like this happens. I use phpvms versions simpilot 5.5.2 and my skin is Crewcenter from swan58. Please help.

Open the lib/skins/CrewCenter/profile_edit.tpl or .php file and replace line from:

<input type="text" class="form-control" value="<?php echo $userinfo->email;?>">

to:

<input type="text" class="form-control" name="email" value="<?php echo $userinfo->email;?>">

Link to comment
Share on other sites

19 hours ago, BlackSwan said:

Thanks, there is no error message anymore. But the avatar still doesn't display. Inside /lib/avatars there is no avatar after changing avatar.

Hi, try it
file: app_top.php
                     <div class = "pull-left image">
                    <? php $ pilotcode = PilotData :: getPilotCode (Auth :: $ userinfo-> code, Auth :: $ userinfo-> pilotid); ?>
<img src = "<? php echo PilotData :: getPilotAvatar ($ pilotcode);?>" class = "img-circle" alt = "User Image">
                     </ Div>
file: pilot_public_profile.php

<? Php

if (! file_exists (SITE_ROOT.AVATAR_PATH. '/'. $ pilotcode. '. png'))

{

echo '<img src = "****** / en / lib / skins / crewcenter / images / pilot_profile_pic.jpg" alt = "avatar" class = "img-circle">';

}

else

{

echo '<img src = "'. SITE_URL.AVATAR_PATH. '/'. $ pilotcode. '. png'. '" alt = "No Avatar" class = "img-circle" height = "150" />';

}

?>

 

this is an example and as you can see it works. The image must have the extension * .png max 150X150 PX

http://italianichevolano.altervista.org/avatar.jpg

Filezilla FTP

http://italianichevolano.altervista.org/01.jpg

 

Edited by gio1961
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...