This article deals with 2 things most people would be interested in making software modification:
- Getting Basic or All member data on the page / user controls
- Displaying Custom Registration Field data beside the post
Getting Basic or All member data on the page / user controls
If you decide to make changes to the code to add additional info onto the page / user control based template, in most cases, you will be interested in retrieving the information of the currently logged in member. We have a very simple object that is available on all Pages and User Controls that the software uses itself to retrieve member info, MemberInfo
Use Intellisense and you will be able to get all the properties that is available (you can retrieve such info as early as in the Init event handler).
It does not however contain all information that is available in the profile as in most cases the software doesn't need everything on every page.
If you need additional info stored in the member table (pgd_member), you will have to call
ASPPG.DAL.GetMemberProfile(MemberInfo.MemID, , , 0)
The first parameter will most likely be the member ID of the currently logged on user, MemberInfo.MemID.
The function will return a DataSet which contains a one row DataTable. So you will retrieve info using the same method you would a SQLClient DataSet object.
Calling the above function is essentially the same as calling the stored procedure directly:
exec spShowProfile @int_Mem = <the memberinfo.memID in integer>
Displaying Custom Registration Field data beside the post
Beginning version 3.5, you can make custom registration field data available on the message page which you can retrieve and show. Say, you have a field set up to store member's golf handicap index, and you want to show it beside member's posts.
There are a few steps involved.
First you need to check the registration field's 'Make this field available on the message page'. This way the software will retrieve the information for you.
Second, you need to note down the Db Column Name of that field. The name without the bracket  is the string you will need. In our case shown in the picture below, the name will be "fld_1".
Then, what you will do is modify the template
of the message page located in ~/App_Templates
/UC/MessageDisplay/ItemTemplate.ascx (and its vb) to retrieve the info:
First, declare a Protected
field in the ItemTemplate.ascx.vb file to hold the information:
Protected fld_1 as String
Then in the sub GetAllData
, retrieve the data using:
fld_1 = CstrNull(DataItem("fld_1"))
CstrNull takes a second parameter which can be set to any string value to handle Null data (meaning the user haven't specify anything for this field). Without the second parameter, CstrNull will return String.Empty if the data is Null.
Once you have the data available, you can format and then show it on the ItemTemplate.ascx