|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
Hi, I'm trying to create public facing member profile section, and would like to get nice url action happening for the members. http://mysite.com/members/[member-name] is the format i'm looking to achieve. Has anyone any suggestions how I could go about this? Thanks, Chris
|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
sorry about the double post... my enter key is too small... or too big??
|
|
 Rank: Aficionado
Joined: 7/19/2006 Posts: 165
|
It's more or less build into Umbraco already... I have never played around with this feature, but here what I know (think) Example this forum http://forum.umbraco.org/profiles/cpalmIf you look into web.config for the <add key="umbracoProfileUrl" value="profiles"/> you should change this to <add key="umbracoProfileUrl" value="members"/> Remember that your url would be http://mysite.com/members/[member-name].aspxUnless you are running Umbraco <add key="umbracoUseDirectoryUrls" value="true"/>, which require IIS (the webserver) changes. I do believe that you should create a page/node in Umbraco called members beneath your frontpage... then on this page you can grab the member via LOST HERE, :hmm: DON'T KNOW... this is so far, that I can get you
CPalm, www.cpalm.dk
|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
Hi Christian, Thanks for the reply, I've created a member node which uses a member template page. the template calls a macro linked to an xslt file, however i can't find anything in the library to get the membername from the url and the $currentPage node is pointing to the root member node even when the url is /members/membername.aspx
there must be some obvious, but subtle way of getting the member id or name, but i can't find it. any idea?
thanks, chris
|
|
 Rank: Aficionado
Joined: 8/12/2006 Posts: 139 Location: Norway
|
I'm struggling with this as well - did you find out how it works?
Kenneth Solberg - xeed* - core dev - level 2 cert pro - my blog
|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
i'm afraid to say i've got no-where.
i've found some source code in the httpmodule in the presentation module that seems to parse the url to get the membername from it. however, it needs the url to be passed into it, and when i try to get the url on a page [membername].aspx i only get an empty string.
slightly frustrated by the whole thing, i plan to come back in a week or two, and try again, and if i get nowhere, i'll reluctantly code my own from scratch, as the documentation just doesn't seem to be there in this instance.
sorry this isn't more helpful chris
|
|
 Rank: Addict
Joined: 7/29/2006 Posts: 513 Location: Sydney, Australia
|
hey all,
I'll need similar functionality soon too, so keeping an eye on this thread... although I suspect i'll code mine up as a .net control.
I'd love to have mine as members.domain.com/membername ultimately - but maybe i'm pushing my luck here. havent really thought about it extensively yet, so hoping somebody else figures it out before i need it. hehehe
cheers greg
|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
i'm stilling getting nowhere. niels and daniel will probably be able to point out something glaringly obvious as soon as they see this, as the profiles work a treat for the forum here, and i'd be surprised if that wasn't out of the box functionality.
chris
|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
Ok - I've got something up and running. Here's what I did. (with some help from the old yahoo groups) 1. Added new function to umbraco.library [i'm building of codeplex regularly, so this has been ok for me atm] Code: public static XPathNodeIterator GetCurrentProfileMember() { try { HttpContext.Current.Trace.Write("umbProfilePage", "Profile:" + System.Web.HttpContext.Current.Items["umbMemberLogin"]); string memberLogin = ""; if (System.Web.HttpContext.Current.Items["umbMemberLogin"] != null) memberLogin = System.Web.HttpContext.Current.Items["umbMemberLogin"].ToString(); else if (System.Web.HttpContext.Current.Request["member"] != null) memberLogin = System.Web.HttpContext.Current.Request["member"];
// If no member parsed, then show current member... if (memberLogin == "" && umbraco.cms.businesslogic.member.Member.GetCurrentMember() != null) memberLogin = umbraco.cms.businesslogic.member.Member.GetCurrentMember().LoginName; if (memberLogin != "") { Member m = umbraco.cms.businesslogic.member.Member.GetMemberFromLoginName(memberLogin); if (m != null) { XmlDocument mXml = new XmlDocument(); mXml.LoadXml(m.ToXml(mXml, false).OuterXml); XPathNavigator xp = mXml.CreateNavigator(); return xp.Select("/node"); } } return null; } catch { return null; } }
2. Some fairly trival xslt Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
<xsl:variable name="currentMember" select="umbraco.library:GetCurrentProfileMember()"/> <xsl:template match="/"> <h2>Login Information</h2>
<xsl:choose> <xsl:when test="umbraco.library:IsLoggedOn()='1'"> <h3>Member Information</h3> <xsl:for-each select="$currentMember"> <ul> <li><xsl:value-of select="@id"/></li> <li><xsl:value-of select="@nodeName"/></li> <li><xsl:value-of select="./data [@alias = 'Address']"/></li> <li><xsl:value-of select="./data [@alias = 'PhoneNumber']"/></li> <li><xsl:value-of select="@email"/></li> </ul> </xsl:for-each> </xsl:when> <xsl:otherwise> Member Profiles are only available when you log in. </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
So there you go.... I'm sure there's and easier and/or more elegant way, but it works ok for now. I hope to extend the member profiles to have blogs, photos and comments at some point in the future, but i don't know how the hierarchical lark will work when there is no real root node. anyway. hope thats vaguely useful to someone. chris
|
|
|
Guest |