Interface IUserController
Provides access to manage users.
Namespace: DotNetNuke.Entities.Users
Assembly: DotNetNuke.dll
Syntax
public interface IUserController
Methods
| Improve this Doc View SourceGetCurrentUserInfo()
Gets the current logged in user's information.
Declaration
UserInfo GetCurrentUserInfo()
Returns
Type | Description |
---|---|
UserInfo | The logged in user's UserInfo object or an empty UserInfo if the current user is not logged in. |
GetUser(Int32, Int32)
Gets a specific user information.
Declaration
UserInfo GetUser(int portalId, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | The site (portal) id on which to get the user from. |
System.Int32 | userId | The user id to get the information for. |
Returns
Type | Description |
---|---|
UserInfo | A UserInfo instance or null. |
GetUserByDisplayname(Int32, String)
Get a user based on their display name and portal.
Declaration
UserInfo GetUserByDisplayname(int portalId, string displayName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | The portal ID. |
System.String | displayName | The display name. |
Returns
Type | Description |
---|---|
UserInfo | A UserInfo instance or null. |
GetUserById(Int32, Int32)
Retrieves a User from the DataStore.
Declaration
UserInfo GetUserById(int portalId, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | The ID of the Portal. |
System.Int32 | userId | The ID of the user being retrieved from the Data Store. |
Returns
Type | Description |
---|---|
UserInfo | A UserInfo instance or null. |
GetUserProfilePictureUrl(Int32, Int32, Int32, Int32)
Gets the (relative) URL to the given user's profile picture in the given portal.
Declaration
string GetUserProfilePictureUrl(int portalId, int userId, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | Portal ID. |
System.Int32 | userId | User ID. |
System.Int32 | width | Width in pixels. |
System.Int32 | height | Height in pixels. |
Returns
Type | Description |
---|---|
System.String | Relative URL, e.g. |
Remarks
IMPORTANT NOTE: this overloaded method does not depend on the current portal setting so it can be used in background threads or scheduler jobs.
GetUserProfilePictureUrl(Int32, Int32, Int32)
Gets the (relative) URL to the given user's profile picture in the current portal.
Declaration
string GetUserProfilePictureUrl(int userId, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userId | User ID. |
System.Int32 | width | Width in pixels. |
System.Int32 | height | Height in pixels. |
Returns
Type | Description |
---|---|
System.String | Relative URL, e.g. |
Examples
Usage: ascx:
<asp:Image ID="avatar" runat="server" CssClass="SkinObject" />
code behind:
avatar.ImageUrl = UserController.Instance.GetUserProfilePictureUrl(userInfo.UserID, 32, 32)
|
Improve this Doc
View Source
GetUsersAdvancedSearch(Int32, Int32, Int32, Int32, Int32, Boolean, Int32, Int32, String, Boolean, String, String)
Searches for users via user fields and profile properties.
Declaration
IList<UserInfo> GetUsersAdvancedSearch(int portalId, int userId, int filterUserId, int filterRoleId, int relationTypeId, bool isAdmin, int pageIndex, int pageSize, string sortColumn, bool sortAscending, string propertyNames, string propertyValues)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | The portal ID in which to search for users. |
System.Int32 | userId | The ID of the user searching. This is used to determine access to view profile properties. Can be |
System.Int32 | filterUserId | The ID of a user with whom the resulting user must have a relationship. Only applies if |
System.Int32 | filterRoleId | The ID of a role which the resulting user must hold. Can be |
System.Int32 | relationTypeId | The ID of a relationship type by which the resulting user and the |
System.Boolean | isAdmin | Whether the requesting user is an admin (i.e. whether they can view admin-only profile properties). |
System.Int32 | pageIndex | The 0-based page index. |
System.Int32 | pageSize | The number of results to return in each page. |
System.String | sortColumn | The name of the column/property to sort by. Sorts by |
System.Boolean | sortAscending | Whether the sort is ascending or descending. |
System.String | propertyNames | A comma-delimited list of property names (e.g. |
System.String | propertyValues | A comma-delimited list of property values (e.g. |
Returns
Type | Description |
---|---|
IList<UserInfo> | A list of UserInfo instances. |
Remarks
All property values must match for a result to be included (i.e. this is an AND
search).
GetUsersBasicSearch(Int32, Int32, Int32, String, Boolean, String, String)
Searches for users via a user property.
Declaration
IList<UserInfo> GetUsersBasicSearch(int portalId, int pageIndex, int pageSize, string sortColumn, bool sortAscending, string propertyName, string propertyValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | The portal ID in which to search for users. |
System.Int32 | pageIndex | The 0-based page index. |
System.Int32 | pageSize | The number of results to return in each page. |
System.String | sortColumn | The name of the column/property to sort by. Sorts by |
System.Boolean | sortAscending | Whether the sort is ascending or descending. |
System.String | propertyName | A property name (i.e. a column from |
System.String | propertyValue | The value to search by, results will contain this text in the property. |
Returns
Type | Description |
---|---|
IList<UserInfo> | A list of UserInfo instances. |
IsValidUserName(String)
Check if userName
is a valid username.
Declaration
bool IsValidUserName(string userName)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | The username to check. |
Returns
Type | Description |
---|---|
System.Boolean | true is the |
Remarks
Checks the userName
against the following rules:
- Invalid characters (based on a host setting or
). - Length check for 5 chars
- It must not start or end with space