IProfileModule is an interface designed to allow module developers to create modules displayed on User Profile pages. The primary benefit for using this interface is it exposes the ProfileUserId variable (which is the profile currently being viewed) and it also tells the core framework if the current module should be displayed to the public.
IProfileModule requires the implementation of two read-only properties: A boolean DisplayModule and an integer ProfileUserId.
It is worth noting that this interface is implemented by the
ProfileModuleUserControlBase class. Developers who are building non-MVP style user profile modules should inherit from that class and thus (through inheritance) will be implementing IProfileModule. If you are developing an MVP style user profile module, you will not be able to inherit from ProfileModuleUserControlBase and will need to implement IProfileModule directly in your code.
Example Code (VB)
Class Declaration
Partial Class ViewProfile
Implements IProfileModule
Implementation
Public ReadOnly Property DisplayModule() As Boolean
Get
Return True
End Get
End Property
Public ReadOnly Property ProfileUserId() As Integer
Get
Dim UserId As Integer = Null.NullInteger
If Not String.IsNullOrEmpty(Request.QueryString("userid")) Then
UserId = Int32.Parse(Request.QueryString("userid"))
End If
Return UserId
End Get
End Property
Example Code (C#)
Class Declaration
partial class ViewProfile : IProfileModule
Implementation
public bool DisplayModule
{
get { return true; }
}
public int ProfileUserId
{
get
{
int UserId = Null.NullInteger;
if (!string.IsNullOrEmpty(Request.QueryString["userid"]))
{
UserId = Int32.Parse(Request.QueryString["userid"]);
}
return UserId;
}
}