Jump to content

Members can't upload avatars


AGuyFawkesMask

Recommended Posts

Hello all,

I'm a little embarrassed to make this post, as I think I was the one responsible for this glitch. When a member on my site goes to upload their own avatar via profile_edit.tpl, a message at the top of profile_main.tpl says "Profile saved!" but the avatar is never changed.

There aren't any error messages associated with this glitch, which is why I'm uploading the files that I think are related to it.

Would anyone be able to help me out with this? If someone could just point me in the direction of where I have to look, it would be much appreciated.

Thanks in advance!

profile_edit.tpl

<h3>Edit Profile</h3>
<form action="<?php echo url('/profile');?>" method="post" enctype="multipart/form-data">
<dl>
<dt><strong>Name:</strong> <?php echo $userinfo->firstname . ' ' . $userinfo->lastname;?></dt><br />

<dt><strong>Email address:</strong> <input type="text" name="email" value="<?php echo $userinfo->email;?>" size="40" />
	<?php 
		if(isset($email_error) && $email_error == true)
		echo '<p class="error">Please enter your email address</p>'; ?>
</dt><br />

<dt><strong>Location:</strong> <select name="location">
	<?php
		foreach($countries as $countryCode=>$countryName)
		{ if($userinfo->location == $countryCode)
			$sel = 'selected="selected"';
		  else	
			$sel = '';
			echo '<option value="'.$countryCode.'" '.$sel.'>'.$countryName.'</option>';	} ?>
	</select>
	<?php 
		if(isset($location_error) &&  $location_error == true)
		echo '<p class="error">Please enter your location</p>'; ?>
</dt><br />

<dt><strong>ID badge background:</strong> <select name="bgimage">
	<?php
		foreach($bgimages as $image)
		{ if($userinfo->bgimage == $image)
			$sel = 'selected="selected"';
		  else	
			$sel = '';
			echo '<option value="'.$image.'" '.$sel.'>'.$image.'</option>'; } ?>
	</select>
</dt><br />

<?php
if($customfields)
{
	foreach($customfields as $field)
	{
		echo '<dt>'.$field->title.'</dt>
			  <dd>';

		if($field->type == 'dropdown')
		{
			$field_values = SettingsData::GetField($field->fieldid);				
			$values = explode(',', $field_values->value);


			echo "<select name=\"{$field->fieldname}\">";

			if(is_array($values))
			{						
				foreach($values as $val)
				{
					$val = trim($val);

					if($val == $field->value)
						$sel = " selected ";
					else
						$sel = '';

					echo "<option value=\"{$val}\" {$sel}>{$val}</option>";
				}
			}

			echo '</select>';
		}
		elseif($field->type == 'textarea')
		{
			echo '<textarea class="customfield_textarea"></textarea>';
		}
		else
		{
			echo '<input type="text" name="'.$field->fieldname.'" value="'.$field->value.'" />';
		}

		echo '</dd>';
	}
}
?>

<dt><strong>Avatar:</strong> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo Config::Get('AVATAR_FILE_SIZE');?>" /><input type="file" name="avatar" size="40"> Your image will be resized to <?php echo Config::Get('AVATAR_MAX_HEIGHT').' x '.Config::Get('AVATAR_MAX_WIDTH');?>px.	</dt><br />

<dt><strong>Current avatar:</strong> <?php	
		if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))
		{
			echo 'You have not selected an avatar. (Pick one and get a reward!)';
		}
		else
		{
		?>
		<img src="<?php	echo SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png';?>" />
		<?php
		}
		?></dt><br />

<dt><input type="hidden" name="action" value="saveprofile" />
	<input type="submit" name="submit" value="Save changes" />
</dt>
</dl>
</form>

Link to comment
Share on other sites

I'm an admin and I still cant

Right, and so am I, but being an admin alone shouldn't have anything to do with what Txmmy is talking about. He's referring to the permissions of the avatars folder on your server, which should be under public_html/lib/avatars

Have you Set enough permissions for the Avatar image Folder on your Server ?

I think I have the right ones set. 755, correct?

Link to comment
Share on other sites

  • 4 weeks later...

755 is the correct permission for that folder. Try uploading the original folder again to make sure you didn't change something you shouldn't have.

No luck :( I re-uploaded the avatars folder from the stock phpvms.full package and it's still not working. Let me do the same with my Profile.php and see what happens. Will report back.

Link to comment
Share on other sites

  • Moderators

You guys need to look into your local.config.php. You might be uploading a avatar that is too big than your settings in your local.config.php.

# Avatar information
Config::Set('AVATAR_FILE_SIZE', 5000); 
Config::Set('AVATAR_MAX_WIDTH', 150);
Config::Set('AVATAR_MAX_HEIGHT', 150);

The file size might needs to be increased so you can upload bigger avatars. Current avatar size is 5MB in the code.

Link to comment
Share on other sites

You guys need to look into your local.config.php. You might be uploading a avatar that is too big than your settings in your local.config.php.

# Avatar information
Config::Set('AVATAR_FILE_SIZE', 5000); 
Config::Set('AVATAR_MAX_WIDTH', 150);
Config::Set('AVATAR_MAX_HEIGHT', 150);

The file size might needs to be increased so you can upload bigger avatars. Current avatar size is 5MB in the code.

Kyle- You make a good point, but I just checked the size of the avatar my partner is uploading and it's only 65 KB. That should go through fine. phpVMS, by default, also resizes images automatically, correct?

Link to comment
Share on other sites

I managed to fix it on mine awhile back and forgot to post here how I did it. Go in the .tpl file with the form, and you need to add the following right before the submit button, at least I'm pretty sure thats what I did.

			<input type="hidden" name="pilotid" value="<?php echo $pilotinfo->pilotid;?>" />
		<input type="hidden" name="action" value="saveprofile" />
		<input type="submit" name="submit" value="Save Changes" />

Link to comment
Share on other sites

I managed to fix it on mine awhile back and forgot to post here how I did it. Go in the .tpl file with the form, and you need to add the following right before the submit button, at least I'm pretty sure thats what I did.

			<input type="hidden" name="pilotid" value="<?php echo $pilotinfo->pilotid;?>" />
		<input type="hidden" name="action" value="saveprofile" />
		<input type="submit" name="submit" value="Save Changes" />

Still no luck. Thanks for the advice, Aaron, but I think it has something to do with Profile.php. I haven't re-uploaded the original yet, so I will and I'll get back to you.Thank you all for being patient with me and giving me a hand with this. It's a huge help.

Link to comment
Share on other sites

  • 10 years later...

Hey Guys I have come across this aswell, I have changed the permissions for the folders and the images to 0777 and added the above lines, it let me change my avatar the first attempt from the standard basic one but now it wont let me change it, has anyone got any idea if you can change it in the phpadmin ??

 

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