Installing

Just build the source and copy the uMember.dll into your Umbraco bin folder

Using uMembership

The 'uMember' class shown below and is what the methods return and you work with, what I like about this whole new solution is that it will automatically pick up new properties as you add them.

public class uMember
{
    public int MemberId { get; set; }
    public string MemberLoginName { get; set; }
    public string MemberEmail { get; set; }
    public string MemberCreateDateTime { get; set; }
    public Dictionary<string, string> MemberProperties { get; set; }
}

Methods Included

The methods you can currently use to get members are the following

uMember GetMemberById(int memberId)
uMember GetCurrentMember()
uMember GetMemberByEmail(string email)
uMember GetMemberByLogin(string loginName)
IEnumerable<uMember> SearchMembersByDateCreated(DateTime dateFrom, DateTime dateTo)
IEnumerable<uMember> SearchMembersByPropertyValue(string propertyName, string search)
IEnumerable<uMember> SearchMembersByLogin(string search)
IEnumerable<uMember> GetMembersByCSV(string csv)
IEnumerable<uMember> GetAllMembers()
IEnumerable<uMember> GetMembersByGroup(string groupName) 

Some Example Usages

Getting All Members From Specific Member Group

var sb = new StringBuilder();
var db = new uMembership();
var members = db.GetMembersByGroup("MyMemberGroupName");
foreach (var mem in members)
{
    sb.AppendFormat("<p>{0}<p>", mem.MemberLoginName);
    sb.AppendFormat("<p>{0}<p>", mem.MemberProperties["PropertyNameHere"]);
} 


Get All Members By A Property Value

var sb = new StringBuilder();
var db = new uMembership();
var members = db.SearchMembersByPropertyValue("MyPropertyName", "ValueToSearchFor");
foreach (var mem in members)
{
    sb.AppendFormat("<p>{0}<p>", mem.MemberLoginName);
    sb.AppendFormat("<p>{0}<p>", mem.MemberProperties["PropertyNameHere"]);
}


Get Members By CSV

var sb = new StringBuilder();
var db = new uMembership();
var csv = "13210,2712,10502,8381,14927";
var members = db.GetMembersByCSV(csv);
foreach (var mem in members)
{
    sb.AppendFormat("<p>{0}<p>", mem.MemberLoginName);
    sb.AppendFormat("<p>{0}<p>", mem.MemberProperties["PropertyNameHere"]);
}

Last edited Mar 9, 2013 at 8:21 AM by jimmysmithjnr, version 5

Comments

No comments yet.