Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Trying to make a macro which looks up some of member profile properties based on a lookup by a member email supplied as a macro parameter:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using System.Web.Mvc.Html @using ClientDependency.Core.Mvc @using Umbraco.Web @using Umbraco.Web.Controllers @using Umbraco.Core @using Umbraco.Core.Models @using Umbraco.Core.Services @{ string authorUsername; string authorName =""; string authorEmail =""; string authorTwitterUsername =""; if (Model.MacroParameters["authorEmail"] != null) { authorEmail = (string)Model.MacroParameters["authorEmail"]; var authorModel = Member.GetByEmail(authorEmail); authorName = member.getProperty("Name").Value; authorTwitterUsername = member.getProperty("TwitterUsername").Value; } } Contact the author: @authorEmail or @authorTwitterUsername
However, could not get it to work as intendend.
Solved. In case anybody interested in an authorbio macro:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using System.Web.Mvc.Html @using ClientDependency.Core.Mvc @using Umbraco.Web @using Umbraco.Web.Controllers @using Umbraco.Core @using Umbraco.Core.Models @using Umbraco.Core.Services @{ string authorName =""; string authorEmail =""; string authorCity =""; string authorOccupation =""; string authorTwitterUsername =""; string authorProfilePage =""; string authorEmailHash =""; string authorImage = ""; if (Model.MacroParameters["authorEmail"] != null) { authorEmail = (string)Model.MacroParameters["authorEmail"]; var authorModel = Members.GetByEmail(authorEmail); authorName = authorModel.Name.ToString(); authorTwitterUsername = (string)authorModel.GetProperty("twitterUsername").Value; authorEmailHash = Umbraco.CreateMd5Hash(authorEmail); authorImage = "http://www.gravatar.com/avatar/" + authorEmailHash + ".jpg?s=70"; authorCity = (string)authorModel.GetProperty("city").Value; authorOccupation = (string)authorModel.GetProperty("occupation").Value; authorTwitterUsername =(string)authorModel.GetProperty("twitterUsername").Value; authorProfilePage =(string)authorModel.GetProperty("profilePage").Value; } } <div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person" class="author-bio"> <div class="author-photo" property="v:photo"> <img src="@authorImage" class="photo author-photo"> </div> <div class="author-info"> <p class="author-title">Av <span property="v:name" class="fn">@authorName</span></h3> <p class="author-description"<span property="v:title">@authorOccupation</span>. <span rel="v:address">@authorCity</span>. </p> <p class="author-links"><a href="@authorProfilePage" rel="v:url">Forfatterside</a> på <span property="v:affiliation">helselosen.no</span> </p> </div> </div> <style> .author-bio {background: #9ec6d7; padding: 0px; margin: 5px; width: 100%; height:auto; overflow:auto;} .author-photo {float: left; padding: 0px; margin: 0px; height:70px; width:70px;} .author-info {float: left; height:70px; padding: 7px;} .author-title {color:#323740; font-size: 1.3rem; margin:0px; } .author-description {color:#323740;font-size: 1.3rem; margin:0px; } .author-links {color:#323740;font-size: 1.3rem; margin:0px;} .author-links a {color:#323740; text-decoration:underline;} </style>
Thank you Ole :-)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Get member properties in macro by members email
Trying to make a macro which looks up some of member profile properties based on a lookup by a member email supplied as a macro parameter:
However, could not get it to work as intendend.
Solved. In case anybody interested in an authorbio macro:
Thank you Ole :-)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.