Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
Do you actually need to get the author like that at all?
The way the authors are handled I would think just "new UserAuthor(user)" is probably all you need for most situations.
If you actually need a commited instance (eg if you need to get at its ID in your own code) you can do something like "var author = AuthorHandler.Instance.ChangeAuthor(null, new UserAuthor(user))" which will fetch the existing author or commit a new author for the user as necessary.
This might be a bit of n00b question, but I am upgrading a community from 3 -> 4 and I only have limited experience with 4.
I am a little unsure of what is best practice when it comes to getting the author for a user. the GetUserAuthor method has been removed from the API as far as I can see.
I have found a way, but it not really elegant at all:
var authors = AuthorHandler.Instance.GetAuthors(MyUser);
if(authors.Count > 0)
userAuthor = authors[0];
else
userAuthor = new UserAuthor(MyUser);
Anyone out there with a better solution?