YAFLogo

dprus
  • dprus
  • 57.2% (Neutral)
  • YAF Camper Topic Starter
8 years ago
Hi all,

I've successfully created a user registration module so that user's are automatically created when they browse to the forum within a domain using Active Directory and all that. I'm able to use the YAF API to set the username, password, display name, email, etc. Great.

However, I'd also like to be able to update the user's Avatar and Location as well as set the "Automatically adjust for DST" option. For these I don't see anywhere in the APISet that supports it.

Any help would be greatly appreciated!

Thanks.
Sponsor

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
8 years ago
Take a look at the source

Quote:

I'd also like to be able to update the user's Avatar



controls/EditUsersAvatar.ascx.cs

// save the avatar right now...
                LegacyDb.user_saveavatar(
                    this._currentUserID,
                    "{0}{1}".FormatWith(
                        BaseUrlBuilder.BaseUrl, this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("av")),
                    null,
                    null);

controls/EditUserProfile.ascx.cs

YafUserProfile userProfile = YafUserProfile.GetProfile(userName);

            userProfile.Location = this.Location.Text.Trim();

            userProfile.Save();

// save remaining settings to the DB
            LegacyDb.user_save(
                this.currentUserID,
                this.PageContext.PageBoardID,
                null,
                displayName,
                null,
                this.TimeZones.SelectedValue.ToType<int>(),
                language,
                culture,
                theme,
                editor,
                this.UseMobileTheme.Checked,
                null,
                null,
                null,
                this.DSTUser.Checked,
                this.HideMe.Checked,
                null);
dprus
  • dprus
  • 57.2% (Neutral)
  • YAF Camper Topic Starter
8 years ago
Thanks. This helped me with the Avatar :)

Unfortunately the Location one doesn't appear to work. It all runs successfully but the location is never actually updated.

As for the one to set the DST flag - it looks like I can't just pass null to all the other options I don't want to update?
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
8 years ago
Quote:

As for the one to set the DST flag - it looks like I can't just pass null to all the other options I don't want to update?



You need to parse the first to parameters the user id and the board id
dprus
  • dprus
  • 57.2% (Neutral)
  • YAF Camper Topic Starter
8 years ago
Originally Posted by: tha_watcha 

Quote:

As for the one to set the DST flag - it looks like I can't just pass null to all the other options I don't want to update?



You need to parse the first to parameters the user id and the board id



Yeah - I did that. First 2 and the DST flag as "true" with everything else null. It throws an exception that the timezone cannot be null.
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button