Beispiel #1
0
        /// <summary>
        /// Add Reputation Controls to the User PopMenu
        /// </summary>
        private void AddReputationControls()
        {
            if (this.PageContext.PageUserID != this.DataRow["UserID"].ToType <int>() &&
                this.Get <YafBoardSettings>().EnableUserReputation&& !this.IsGuest && !this.PageContext.IsGuest)
            {
                if (!YafReputation.CheckIfAllowReputationVoting(this.DataRow["ReputationVoteDate"]))
                {
                    return;
                }

                // Check if the User matches minimal requirements for voting up
                if (this.PageContext.Reputation >= this.Get <YafBoardSettings>().ReputationMinUpVoting)
                {
                    this.AddReputation.Visible = true;
                }

                // Check if the User matches minimal requirements for voting down
                if (this.PageContext.Reputation < this.Get <YafBoardSettings>().ReputationMinDownVoting)
                {
                    return;
                }

                // Check if the Value is 0 or Bellow
                if (this.DataRow["Points"].ToType <int>() > 0 &&
                    this.Get <YafBoardSettings>().ReputationAllowNegative)
                {
                    this.RemoveReputation.Visible = true;
                }
            }
            else
            {
                this.AddReputation.Visible    = false;
                this.RemoveReputation.Visible = false;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Removes the user reputation.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void RemoveUserReputation(object sender, EventArgs e)
        {
            if (!YafReputation.CheckIfAllowReputationVoting(this.DataRow["ReputationVoteDate"]))
            {
                return;
            }

            this.AddReputation.Visible    = false;
            this.RemoveReputation.Visible = false;

            LegacyDb.user_removepoints(this.PostData.UserId, this.PageContext.PageUserID, 1);

            this.DataRow["ReputationVoteDate"] = DateTime.UtcNow;

            // Reload UserBox
            this.PageContext.CurrentForumPage.PageCache[Constants.Cache.UserBoxes] = null;

            this.DataRow["Points"]  = this.DataRow["Points"].ToType <int>() - 1;
            this.UserBox1.PageCache = null;

            this.PageContext.AddLoadMessage(
                this.GetTextFormatted(
                    "REP_VOTE_DOWN_MSG",
                    this.Get <HttpServerUtilityBase>().HtmlEncode(
                        this.DataRow[this.Get <YafBoardSettings>().EnableDisplayName ? "DisplayName" : "UserName"].ToString())),
                MessageTypes.success);
        }
Beispiel #3
0
        /// <summary>
        /// Adds the user reputation.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void AddUserReputation(object sender, EventArgs e)
        {
            if (!YafReputation.CheckIfAllowReputationVoting(this.DataRow["ReputationVoteDate"]))
            {
                return;
            }

            this.AddReputation.Visible    = false;
            this.RemoveReputation.Visible = false;

            LegacyDb.user_addpoints(this.PostData.UserId, this.PageContext.PageUserID, 1);

            this.DataRow["ReputationVoteDate"] = DateTime.UtcNow;

            // Reload UserBox
            this.PageContext.CurrentForumPage.PageCache[Constants.Cache.UserBoxes] = null;

            this.DataRow["Points"]  = this.DataRow["Points"].ToType <int>() + 1;
            this.UserBox1.PageCache = null;

            this.PageContext.AddLoadMessage(
                this.GetTextFormatted(
                    "REP_VOTE_UP_MSG",
                    this.Get <HttpServerUtilityBase>().HtmlEncode(
                        this.DataRow[this.Get <YafBoardSettings>().EnableDisplayName ? "DisplayName" : "UserName"].ToString())),
                MessageTypes.Success);

            YafContext.Current.PageElements.RegisterJsBlockStartup(
                "reputationprogressjs",
                JavaScriptBlocks.ReputationProgressChangeJs(
                    YafReputation.GenerateReputationBar(this.DataRow["Points"].ToType <int>(), this.PostData.UserId),
                    this.PostData.UserId.ToString()));
        }
Beispiel #4
0
        private string MatchUserBoxReputation([NotNull] string userBox)
        {
            string filler = string.Empty;
            var    rx     = this.GetRegex(Constants.UserBox.Reputation);

            if (this.Get <YafBoardSettings>().DisplayPoints&& !this.DataRow["IsGuest"].ToType <bool>())
            {
                filler = this.Get <YafBoardSettings>().UserBoxReputation.FormatWith(
                    this.GetText("REPUTATION"),
                    YafReputation.GenerateReputationBar(this.DataRow["Points"].ToType <int>(), this.UserId));
            }

            // replaces template placeholder with actual points
            userBox = rx.Replace(userBox, filler);
            return(userBox);
        }
Beispiel #5
0
        /// <summary>
        /// The setup user profile info.
        /// </summary>
        /// <param name="userID">
        /// The user id.
        /// </param>
        /// <param name="user">
        /// The user.
        /// </param>
        /// <param name="userData">
        /// The user data.
        /// </param>
        /// <param name="userDisplayName">
        /// The user display name.
        /// </param>
        private void SetupUserProfileInfo(
            int userID, [NotNull] MembershipUser user, [NotNull] IUserData userData, [NotNull] string userDisplayName)
        {
            this.UserLabel1.UserID = userData.UserID;

            if (this.PageContext.IsAdmin && userData.DisplayName != user.UserName)
            {
                this.Name.Text = this.HtmlEncode("{0} ({1})".FormatWith(userData.DisplayName, user.UserName));
            }
            else
            {
                this.Name.Text = this.HtmlEncode(userDisplayName);
            }

            this.Joined.Text =
                "{0}".FormatWith(this.Get <IDateTime>().FormatDateLong(Convert.ToDateTime(userData.Joined)));

            // vzrus: Show last visit only to admins if user is hidden
            if (!this.PageContext.IsAdmin && Convert.ToBoolean(userData.DBRow["IsActiveExcluded"]))
            {
                this.LastVisit.Text    = this.GetText("COMMON", "HIDDEN");
                this.LastVisit.Visible = true;
            }
            else
            {
                this.LastVisitDateTime.DateTime = userData.LastVisit;
                this.LastVisitDateTime.Visible  = true;
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.RankName))
            {
                this.RankTR.Visible = true;
                this.Rank.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.RankName));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Location))
            {
                this.LocationTR.Visible = true;
                this.Location.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Location));
            }

            if (this.User != null && userData.Profile.Country.Trim().IsSet() && !userData.Profile.Country.Equals("N/A"))
            {
                this.CountryTR.Visible = true;
                this.CountryLabel.Text =
                    this.HtmlEncode(
                        this.Get <IBadWordReplace>().Replace(this.GetText("COUNTRY", userData.Profile.Country.Trim())));

                this.CountryFlagImage.Src = this.Get <ITheme>()
                                            .GetItem(
                    "FLAGS",
                    "{0}_MEDIUM".FormatWith(userData.Profile.Country.Trim()),
                    YafForumInfo.GetURLToResource(
                        "images/flags/{0}.png".FormatWith(
                            userData.Profile.Country.Trim())));

                this.CountryFlagImage.Alt = userData.Profile.Country.Trim();
                this.CountryFlagImage.Attributes.Add("title", this.CountryLabel.Text);
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Region))
            {
                this.RegionTR.Visible = true;

                try
                {
                    var tag =
                        "RGN_{0}_{1}".FormatWith(
                            !string.IsNullOrEmpty(userData.Profile.Country.Trim())
                                ? userData.Profile.Country.Trim()
                                : this.Get <ILocalization>().Culture.Name.Remove(0, 3).ToUpperInvariant(),
                            userData.Profile.Region);
                    this.RegionLabel.Text =
                        this.HtmlEncode(this.Get <IBadWordReplace>().Replace(this.GetText("REGION", tag)));
                }
                catch (Exception)
                {
                    this.RegionTR.Visible = false;
                }
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.City))
            {
                this.CityTR.Visible = true;
                this.CityLabel.Text = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.City));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Location))
            {
                this.LocationTR.Visible = true;
                this.Location.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Location));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.RealName))
            {
                this.RealNameTR.Visible = true;
                this.RealName.InnerText = this.HtmlEncode(
                    this.Get <IBadWordReplace>().Replace(userData.Profile.RealName));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Interests))
            {
                this.InterestsTR.Visible = true;
                this.Interests.InnerText =
                    this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Interests));
            }

            if (this.User != null && (userData.Profile.Gender > 0))
            {
                string imagePath = string.Empty;
                string imageAlt  = string.Empty;

                this.GenderTR.Visible = true;
                switch (userData.Profile.Gender)
                {
                case 1:
                    imagePath = this.PageContext.Get <ITheme>().GetItem("ICONS", "GENDER_MALE", null);
                    imageAlt  = this.GetText("USERGENDER_MAS");
                    break;

                case 2:
                    imagePath = this.PageContext.Get <ITheme>().GetItem("ICONS", "GENDER_FEMALE", null);
                    imageAlt  = this.GetText("USERGENDER_FEM");
                    break;
                }

                this.Gender.InnerHtml =
                    @"<a><img src=""{0}"" alt=""{1}"" title=""{1}"" /></a>&nbsp;{1}".FormatWith(imagePath, imageAlt);
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Occupation))
            {
                this.OccupationTR.Visible = true;
                this.Occupation.InnerText =
                    this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Occupation));
            }

            this.ThanksFrom.Text =
                LegacyDb.user_getthanks_from(userData.DBRow["userID"], this.PageContext.PageUserID).ToString();
            int[] thanksToArray = LegacyDb.user_getthanks_to(userData.DBRow["userID"], this.PageContext.PageUserID);
            this.ThanksToTimes.Text         = thanksToArray[0].ToString();
            this.ThanksToPosts.Text         = thanksToArray[1].ToString();
            this.ReputationReceived.Text    = YafReputation.GenerateReputationBar(userData.Points.Value, userData.UserID);
            this.OnlineStatusImage1.UserID  = userID;
            this.OnlineStatusImage1.Visible = this.Get <YafBoardSettings>().ShowUserOnlineStatus;

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.XMPP))
            {
                this.XmppTR.Visible = true;
                this.lblxmpp.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.XMPP));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.AIM))
            {
                this.AimTR.Visible = true;
                this.lblaim.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.AIM));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.ICQ))
            {
                this.IcqTR.Visible = true;
                this.lblicq.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.ICQ));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.MSN))
            {
                this.MsnTR.Visible = true;
                this.lblmsn.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.MSN));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Skype))
            {
                this.SkypeTR.Visible = true;
                this.lblskype.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Skype));
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.YIM))
            {
                this.YimTR.Visible = true;
                this.lblyim.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.YIM));
            }

            var loadHoverCardJs = false;

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Facebook))
            {
                this.FacebookTR.Visible = true;
                this.lblfacebook.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Facebook));

                if (this.Get <YafBoardSettings>().EnableUserInfoHoverCards)
                {
                    this.lblfacebook.Attributes.Add("data-hovercard", this.lblfacebook.Text);
                    this.Facebook.Attributes.Add("data-hovercard", this.lblfacebook.Text);

                    this.lblfacebook.CssClass += " Facebook-HoverCard";
                    this.Facebook.CssClass    += " Facebook-HoverCard";

                    loadHoverCardJs = true;
                }
            }

            if (this.User != null && !string.IsNullOrEmpty(userData.Profile.Twitter))
            {
                this.TwitterTR.Visible = true;
                this.lbltwitter.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Twitter));

                if (this.Get <YafBoardSettings>().EnableUserInfoHoverCards)
                {
                    this.lbltwitter.Attributes.Add("data-hovercard", this.lbltwitter.Text);
                    this.Twitter.Attributes.Add("data-hovercard", this.lbltwitter.Text);

                    this.lbltwitter.CssClass += " Twitter-HoverCard";
                    this.Twitter.CssClass    += " Twitter-HoverCard";

                    loadHoverCardJs = true;
                }
            }

            if (loadHoverCardJs && this.Get <YafBoardSettings>().EnableUserInfoHoverCards)
            {
                var hoverCardLoadJs = new StringBuilder();

                YafContext.Current.PageElements.RegisterJsResourceInclude("hovercard", "js/jquery.hovercard.js");
                YafContext.Current.PageElements.RegisterCssIncludeResource("css/jquery.hovercard.css");

                hoverCardLoadJs.Append(
                    JavaScriptBlocks.HoverCardLoadJs(
                        ".Facebook-HoverCard",
                        "Facebook",
                        this.GetText("DEFAULT", "LOADING_FB_HOVERCARD"),
                        this.GetText("DEFAULT", "ERROR_FB_HOVERCARD")));

                hoverCardLoadJs.Append(
                    JavaScriptBlocks.HoverCardLoadJs(
                        ".Twitter-HoverCard",
                        "Twitter",
                        this.GetText("DEFAULT", "LOADING_TWIT_HOVERCARD"),
                        this.GetText("DEFAULT", "ERROR_TWIT_HOVERCARD")));

                // Setup Hover Card JS
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "hovercardtwitterfacebookjs", hoverCardLoadJs.ToString());

                if (this.Get <YafBoardSettings>().EnableUserReputation)
                {
                    // Setup UserBox Reputation Script Block
                    YafContext.Current.PageElements.RegisterJsBlockStartup(
                        "reputationprogressjs", JavaScriptBlocks.RepuatationProgressLoadJs);
                }
            }

            if (this.User != null && userData.Profile.Birthday >= DateTimeHelper.SqlDbMinTime())
            {
                this.BirthdayTR.Visible = true;
                this.Birthday.Text      =
                    this.Get <IDateTime>()
                    .FormatDateLong(userData.Profile.Birthday.AddMinutes((double)(-userData.TimeZone)));
            }
            else
            {
                this.BirthdayTR.Visible = false;
            }
        }
Beispiel #6
0
        /// <summary>
        /// The setup user profile info.
        /// </summary>
        /// <param name="userID">The user id.</param>
        /// <param name="user">The user.</param>
        /// <param name="userData">The user data.</param>
        /// <param name="userDisplayName">The user display name.</param>
        private void SetupUserProfileInfo(
            int userID,
            [NotNull] MembershipUser user,
            [NotNull] IUserData userData,
            [NotNull] string userDisplayName)
        {
            this.UserLabel1.UserID = userData.UserID;

            if (this.PageContext.IsAdmin && userData.DisplayName != user.UserName)
            {
                this.Name.Text = this.HtmlEncode("{0} ({1})".FormatWith(userData.DisplayName, user.UserName));
            }
            else
            {
                this.Name.Text = this.HtmlEncode(userDisplayName);
            }

            this.Joined.Text =
                "{0}".FormatWith(this.Get <IDateTime>().FormatDateLong(Convert.ToDateTime(userData.Joined)));

            // vzrus: Show last visit only to admins if user is hidden
            if (!this.PageContext.IsAdmin && Convert.ToBoolean(userData.DBRow["IsActiveExcluded"]))
            {
                this.LastVisit.Text    = this.GetText("COMMON", "HIDDEN");
                this.LastVisit.Visible = true;
            }
            else
            {
                this.LastVisitDateTime.DateTime = userData.LastVisit;
                this.LastVisitDateTime.Visible  = true;
            }

            if (this.User != null && userData.RankName.IsSet())
            {
                this.RankTR.Visible = true;
                this.Rank.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.RankName));
            }

            if (this.User != null && userData.Profile.Location.IsSet())
            {
                this.LocationTR.Visible = true;
                this.Location.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Location));
            }

            if (this.User != null && userData.Profile.Country.Trim().IsSet() && !userData.Profile.Country.Equals("N/A"))
            {
                this.CountryTR.Visible = true;
                this.CountryLabel.Text =
                    this.HtmlEncode(
                        this.Get <IBadWordReplace>().Replace(this.GetText("COUNTRY", userData.Profile.Country.Trim())));

                this.CountryFlagImage.Src = this.Get <ITheme>()
                                            .GetItem(
                    "FLAGS",
                    "{0}_MEDIUM".FormatWith(userData.Profile.Country.Trim()),
                    YafForumInfo.GetURLToContent("images/flags/{0}.png".FormatWith(userData.Profile.Country.Trim())));

                this.CountryFlagImage.Alt = userData.Profile.Country.Trim();
                this.CountryFlagImage.Attributes.Add("title", this.CountryLabel.Text);
            }

            if (this.User != null && userData.Profile.Region.IsSet())
            {
                this.RegionTR.Visible = true;

                try
                {
                    var tag =
                        "RGN_{0}_{1}".FormatWith(
                            userData.Profile.Country.Trim().IsSet()
                                ? userData.Profile.Country.Trim()
                                : this.Get <ILocalization>().Culture.Name.Remove(0, 3).ToUpperInvariant(),
                            userData.Profile.Region);
                    this.RegionLabel.Text =
                        this.HtmlEncode(this.Get <IBadWordReplace>().Replace(this.GetText("REGION", tag)));
                }
                catch (Exception)
                {
                    this.RegionTR.Visible = false;
                }
            }

            if (this.User != null && userData.Profile.City.IsSet())
            {
                this.CityTR.Visible = true;
                this.CityLabel.Text = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.City));
            }

            if (this.User != null && userData.Profile.Location.IsSet())
            {
                this.LocationTR.Visible = true;
                this.Location.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Location));
            }

            if (this.User != null && userData.Profile.RealName.IsSet())
            {
                this.RealNameTR.Visible = true;
                this.RealName.InnerText = this.HtmlEncode(
                    this.Get <IBadWordReplace>().Replace(userData.Profile.RealName));
            }

            if (this.User != null && userData.Profile.Interests.IsSet())
            {
                this.InterestsTR.Visible = true;
                this.Interests.InnerText =
                    this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Interests));
            }

            if (this.User != null && (userData.Profile.Gender > 0))
            {
                string imagePath = string.Empty;
                string imageAlt  = string.Empty;

                this.GenderTR.Visible = true;
                switch (userData.Profile.Gender)
                {
                case 1:
                    imagePath = this.PageContext.Get <ITheme>().GetItem("ICONS", "GENDER_MALE", null);
                    imageAlt  = this.GetText("USERGENDER_MAS");
                    break;

                case 2:
                    imagePath = this.PageContext.Get <ITheme>().GetItem("ICONS", "GENDER_FEMALE", null);
                    imageAlt  = this.GetText("USERGENDER_FEM");
                    break;
                }

                this.Gender.InnerHtml =
                    @"<a><img src=""{0}"" alt=""{1}"" title=""{1}"" /></a>&nbsp;{1}".FormatWith(imagePath, imageAlt);
            }

            if (this.User != null && userData.Profile.Occupation.IsSet())
            {
                this.OccupationTR.Visible = true;
                this.Occupation.InnerText =
                    this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Occupation));
            }

            this.ThanksFrom.Text =
                LegacyDb.user_getthanks_from(userData.DBRow["userID"], this.PageContext.PageUserID).ToString();
            int[] thanksToArray = LegacyDb.user_getthanks_to(userData.DBRow["userID"], this.PageContext.PageUserID);
            this.ThanksToTimes.Text      = thanksToArray[0].ToString();
            this.ThanksToPosts.Text      = thanksToArray[1].ToString();
            this.ReputationReceived.Text = YafReputation.GenerateReputationBar(userData.Points.Value, userData.UserID);

            if (this.Get <YafBoardSettings>().ShowUserOnlineStatus)
            {
                this.OnlineStatusImage1.UserID  = userID;
                this.OnlineStatusImage1.Visible = true;

                var suspended = userData.DBRow["Suspended"].ToType <DateTime?>();

                if (suspended.HasValue && suspended.Value > DateTime.UtcNow)
                {
                    this.ThemeImgSuspended.LocalizedTitle =
                        this.GetText("POSTS", "USERSUSPENDED")
                        .FormatWith(this.Get <IDateTime>().FormatDateTimeShort(suspended.Value));

                    this.ThemeImgSuspended.Visible  = true;
                    this.OnlineStatusImage1.Visible = false;
                }
                else
                {
                    this.ThemeImgSuspended.Visible = false;
                }
            }
            else
            {
                this.ThemeImgSuspended.Visible  = false;
                this.OnlineStatusImage1.Visible = false;
            }

            if (this.User != null && userData.Profile.XMPP.IsSet())
            {
                this.XmppTR.Visible = true;
                this.lblxmpp.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.XMPP));
            }

            if (this.User != null && userData.Profile.AIM.IsSet())
            {
                this.AimTR.Visible = true;
                this.lblaim.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.AIM));
            }

            if (this.User != null && userData.Profile.ICQ.IsSet())
            {
                this.IcqTR.Visible = true;
                this.lblicq.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.ICQ));
            }

            if (this.User != null && userData.Profile.MSN.IsSet())
            {
                this.MsnTR.Visible = true;
                this.lblmsn.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.MSN));
            }

            if (this.User != null && userData.Profile.Skype.IsSet())
            {
                this.SkypeTR.Visible = true;
                this.lblskype.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Skype));
            }

            if (this.User != null && userData.Profile.YIM.IsSet())
            {
                this.YimTR.Visible = true;
                this.lblyim.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.YIM));
            }

            var loadHoverCardJs = false;

            if (this.User != null && userData.Profile.Facebook.IsSet())
            {
                this.FacebookTR.Visible = true;
                this.lblfacebook.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Facebook));

                if (this.Get <YafBoardSettings>().EnableUserInfoHoverCards)
                {
                    this.lblfacebook.Attributes.Add("data-hovercard", this.lblfacebook.Text);
                    this.Facebook.Attributes.Add("data-hovercard", this.lblfacebook.Text);

                    this.lblfacebook.CssClass += " Facebook-HoverCard";
                    this.Facebook.CssClass    += " Facebook-HoverCard";

                    loadHoverCardJs = true;
                }
            }

            if (this.User != null && userData.Profile.Twitter.IsSet())
            {
                this.TwitterTR.Visible = true;
                this.lbltwitter.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Twitter));

                if (this.Get <YafBoardSettings>().EnableUserInfoHoverCards&& Config.IsTwitterEnabled)
                {
                    this.lbltwitter.Attributes.Add("data-hovercard", this.lbltwitter.Text);
                    this.Twitter.Attributes.Add("data-hovercard", this.lbltwitter.Text);

                    this.lbltwitter.CssClass += " Twitter-HoverCard";
                    this.Twitter.CssClass    += " Twitter-HoverCard";

                    loadHoverCardJs = true;
                }
            }

            if (loadHoverCardJs && this.Get <YafBoardSettings>().EnableUserInfoHoverCards&& Config.IsTwitterEnabled)
            {
                var hoverCardLoadJs = new StringBuilder();

                hoverCardLoadJs.Append(
                    JavaScriptBlocks.HoverCardLoadJs(
                        ".Facebook-HoverCard",
                        "Facebook",
                        this.GetText("DEFAULT", "LOADING_FB_HOVERCARD").ToJsString(),
                        this.GetText("DEFAULT", "ERROR_FB_HOVERCARD").ToJsString()));

                hoverCardLoadJs.Append(
                    JavaScriptBlocks.HoverCardLoadJs(
                        ".Twitter-HoverCard",
                        "Twitter",
                        this.GetText("DEFAULT", "LOADING_TWIT_HOVERCARD").ToJsString(),
                        this.GetText("DEFAULT", "ERROR_TWIT_HOVERCARD").ToJsString(),
                        "{0}{1}resource.ashx?twitterinfo=".FormatWith(
                            BaseUrlBuilder.BaseUrl.TrimEnd('/'),
                            BaseUrlBuilder.AppPath)));

                // Setup Hover Card JS
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "hovercardtwitterfacebookjs",
                    hoverCardLoadJs.ToString());
            }

            if (this.User != null && userData.Profile.Birthday >= DateTimeHelper.SqlDbMinTime())
            {
                this.BirthdayTR.Visible = true;
                this.Birthday.Text      =
                    this.Get <IDateTime>()
                    .FormatDateLong(userData.Profile.Birthday.AddMinutes((double)(-userData.TimeZone)));
            }
            else
            {
                this.BirthdayTR.Visible = false;
            }

            // Show User Medals
            if (this.Get <YafBoardSettings>().ShowMedals)
            {
                var userMedalsTable = this.Get <YafDbBroker>().UserMedals(this.UserId);

                if (userMedalsTable.Rows.Count <= 0)
                {
                    this.MedalsRow.Visible = false;

                    return;
                }

                var ribbonBar = new StringBuilder(500);
                var medals    = new StringBuilder(500);

                DataRow    r;
                MedalFlags f;

                int i     = 0;
                int inRow = 0;

                // do ribbon bar first
                while (userMedalsTable.Rows.Count > i)
                {
                    r = userMedalsTable.Rows[i];
                    f = new MedalFlags(r["Flags"]);

                    // do only ribbon bar items first
                    if (!r["OnlyRibbon"].ToType <bool>())
                    {
                        break;
                    }

                    // skip hidden medals
                    if (!f.AllowHiding || !r["Hide"].ToType <bool>())
                    {
                        if (inRow == 3)
                        {
                            // add break - only three ribbons in a row
                            ribbonBar.Append("<br />");
                            inRow = 0;
                        }

                        var title = "{0}{1}".FormatWith(
                            r["Name"],
                            f.ShowMessage ? ": {0}".FormatWith(r["Message"]) : string.Empty);

                        ribbonBar.AppendFormat(
                            "<img src=\"{0}{5}/{1}\" width=\"{2}\" height=\"{3}\" alt=\"{4}\" title=\"{4}\" />",
                            YafForumInfo.ForumClientFileRoot,
                            r["SmallRibbonURL"],
                            r["SmallRibbonWidth"],
                            r["SmallRibbonHeight"],
                            title,
                            YafBoardFolders.Current.Medals);

                        inRow++;
                    }

                    // move to next row
                    i++;
                }

                // follow with the rest
                while (userMedalsTable.Rows.Count > i)
                {
                    r = userMedalsTable.Rows[i];
                    f = new MedalFlags(r["Flags"]);

                    // skip hidden medals
                    if (!f.AllowHiding || !r["Hide"].ToType <bool>())
                    {
                        medals.AppendFormat(
                            "<img src=\"{0}{6}/{1}\" width=\"{2}\" height=\"{3}\" alt=\"{4}{5}\" title=\"{4}{5}\" />",
                            YafForumInfo.ForumClientFileRoot,
                            r["SmallMedalURL"],
                            r["SmallMedalWidth"],
                            r["SmallMedalHeight"],
                            r["Name"],
                            f.ShowMessage ? ": {0}".FormatWith(r["Message"]) : string.Empty,
                            YafBoardFolders.Current.Medals);
                    }

                    // move to next row
                    i++;
                }

                this.MedalsPlaceHolder.Text = "{0}<br />{1}".FormatWith(ribbonBar, medals);
                this.MedalsRow.Visible      = true;
            }
        }