Using Members properties in Content (editable by Member)
Hi everyone,
I'd like to create a Member type with some properties, Name, Address, Phone etc.. and allow members to update their information via a login.
Furthermore, I'd like to be able to select Members via the Ultimate Picker so I can list their information somewhere on a page.
I've successfuly created a Member type and assigned it properties, and I can probably figure out how to make their information updatable, but how would I go about selecting member nodes and listing their information?
In the end, I ended up using code from another post (which I've lost the link to).
Either way, here it is.. It's basically a custom extension that selects members by Group Name/Id and allows me to use XSLT for the output.
using System; using System.Data; using System.Data.SqlClient; using System.Text; using System.Xml; using System.Xml.XPath; using Microsoft.ApplicationBlocks.Data; using umbraco.cms.businesslogic.member;
namespace Custom_Controls.xsltExtensions {
public class customExt { public static XPathNodeIterator GetMembersByGroupName(string groupName) { try { return GetMembersByGroupId(MemberGroup.GetByName(groupName).Id); } catch (Exception ex) { XmlDocument xd = new XmlDocument(); xd.LoadXml("<response><success>false</success><error>" + ex.Message.ToString() + "</error></response>"); return xd.CreateNavigator().Select("/response"); } } public static XPathNodeIterator GetMembersByGroupId(int id) { XmlDocument xd = new XmlDocument();
try { DataSet ds = SqlHelper.ExecuteDataset( new SqlConnection(umbraco.GlobalSettings.DbDSN), CommandType.Text, @" Select ccx.xml from cmsContentXml ccx inner join cmsMember cm on ccx.nodeId = cm.nodeId inner join cmsMember2MemberGroup cm2mg on cm.nodeId = cm2mg.Member Where cm2mg.MemberGroup = @group ", new SqlParameter("@group", id.ToString()));
Using Members properties in Content (editable by Member)
Hi everyone,
I'd like to create a Member type with some properties, Name, Address, Phone etc.. and allow members to update their information via a login.
Furthermore, I'd like to be able to select Members via the Ultimate Picker so I can list their information somewhere on a page.
I've successfuly created a Member type and assigned it properties, and I can probably figure out how to make their information updatable, but how would I go about selecting member nodes and listing their information?
Any help would be appreciated.
Cheers,
Marko
Hello Marko,
I found this post that might help you along
http://our.umbraco.org/forum/developers/api-questions/8828-Get-Properties-from-Member-in-Umbraco-programmatically
Best
danielcruger.comhttp://our.umbraco.org/forum/developers/api-questions/8828-Get-Properties-from-Member-in-Umbraco-programmatically
Thanks for your help Dan.
In the end, I ended up using code from another post (which I've lost the link to).
Either way, here it is.. It's basically a custom extension that selects members by Group Name/Id and allows me to use XSLT for the output.
is working on a reply...