LoneRanger
LoneRanger

Reputation: 1939

Programmatically setting 'display name' in YAF

I am using YAF as my online forum. I've synched user account databases between YAF and my own application, but call 'Membership.Providers["YafMembershipProvider"].CreateUser' at the same time as I create my own members. However, there's a problem... My users are identified by email address for logon. So now the forum shows everyone's email addresses. Not a good idea.

YAF has an option called 'display name'. Is it possible to programmatically create this as well?

Upvotes: 1

Views: 712

Answers (1)

Diogo Raminhos
Diogo Raminhos

Reputation: 2023

If someone has doubts in this, Jaben's answer does not seem to work in the latest version of YAF.NET (Sample Web Application) - if you need to do this you may do so using the WebService (since the YAF.Classes.DB no longer seems to exist).

You can find the WS at <your url>/forum/YafWebService.asmx - you have a method called SetDisplayNameFromUsername, this will receive a token that you may find on your host settings page (you'll need to save the settings at least once before using the token).

If you are looking forward to do this using inside the forum itself you may do so by calling the YafWebService class directly, as explained bellow:

        var service = new YafWebService();
        service.SetDisplayNameFromUsername("[your token]",
                                           "[the username of the user]",
                                           "[the displayname you want to set]");

Note: I've found very useful/the only way so far to develop while looking at the source code on github.

Upvotes: 0

Related Questions