In 6.2, I'm quite easily able to add a follower or remove a follower using this:
e.g.
var follow = UserController.GetUserById(PortalSettings.PortalId, userId);
FollowersController.Instance.UnFollowUser(follow);
But how do I find out who is following a user? If I have a user, I can traverse UserInfo.Social.UserRelationships, but is this the only way?
var currentUser = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();
foreach
(UserRelationship ur
in
currentUser.Social.UserRelationships)
{
if
( ur.UserId == currentUser.UserID && ur.RelatedUserId == userId && ur.RelationshipId == 2 )
{
return
Json(
new
{ Result = (
"true"
) });
}
}