IProfileModule

Return to previous page

  • 4/7/2015
  • 741 Views

Comments

741 Views

IProfileModule

Last updated 6 years ago

Comments

Common

(Enter the content of this article below)

Advanced

 
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;
}
}
Contents
No sections defined

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out