YAFLogo

jshepler
  • jshepler
  • 100% (Exalted)
  • YAF MVP Topic Starter
15 years ago
When a "deleted" post is shown, the code doesn't include the user's avatar in the userbox. Since the userbox is cached, any other post from that user on the same page also doesn't show the avatar.

Fixed in YAF.Controls/UserBox.cs, MatchUserBoxAvatar():

		private string MatchUserBoxAvatar( string userBox )
		{
			string filler = "";
			Regex rx = new Regex( Constants.UserBox.Avatar );

            //if ( !PostDeleted &&
            //     (PageContext.BoardSettings.AvatarUpload && DataRow["HasAvatarImage"] != null && long.Parse( DataRow["HasAvatarImage"].ToString() ) > 0) )
            if ((PageContext.BoardSettings.AvatarUpload && DataRow["HasAvatarImage"] != null && long.Parse(DataRow["HasAvatarImage"].ToString()) > 0))
            {
				filler = String.Format(
					PageContext.BoardSettings.UserBoxAvatar,
					String.Format(
						@"<img class=""avatarimage"" src=""{1}resource.ashx?u={0}"" alt="""" />",
						UserId,
						YafForumInfo.ForumRoot
						)
					);
			}
            //else if ( !PostDeleted &&
            //          DataRow["Avatar"].ToString().Length > 0 ) // Took out PageContext.BoardSettings.AvatarRemote
            else if (DataRow["Avatar"].ToString().Length > 0) // Took out PageContext.BoardSettings.AvatarRemote
            {
				filler = String.Format(
					PageContext.BoardSettings.UserBoxAvatar,
					String.Format(
						@"<img class=""avatarimage"" src=""{3}resource.ashx?url={0}&amp;width={1}&amp;height={2}"" alt="""" /><br clear=""all"" />",
						HttpContext.Current.Server.UrlEncode( DataRow["Avatar"].ToString() ),
						PageContext.BoardSettings.AvatarWidth,
						PageContext.BoardSettings.AvatarHeight,
						YafForumInfo.ForumRoot
						)
					);
			}

			// replaces template placeholder with actual avatar
			userBox = rx.Replace( userBox, filler );
			return userBox;
		}

not jsheLPer

Sponsor
Mek
  • Mek
  • 100% (Exalted)
  • YAF Developer
15 years ago
Super duper ;-)

thanks muchly.

FP:Mek


UserPostedImage

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )