So , I am having a state list and I want to show all agent by state page ..
What I Have ...
1. I created a document type state and agents and member type as agents ...
2. How I able to get all member information as on every state page ... ( example like if any agents belongs to CA then all member list show on CA page )
How get members profile property without login and display on public page
Hello,
How I am able to get all members profile proerty without login and display on public page for search...
Example as like ...
1. I am having a member type called teacher
2. Member type having custom textbox as like name , address , subject ... etc.
What I want to here that ..
1. Teachers can login and edit profile item.. ( I complete it )
2. How I get all teachers profile information as name , address , subject ... so that students can view them on search page without login ..
Please any one help me , how I can do that .... any example ?
Hi Pradeep,
What version of Umbraco are you using?
If you are using latest you have to use MemberService for getting all information about members. Docs here :
https://our.umbraco.org/documentation/Reference/Management-v6/Services/MemberService
Thanks, Alex
Hi Alex ,
Thank you very much for reply , Yes I am using latest version of Umbraco ..
How I get all the information and display on page and result based on search ....
So , Can you please provide me codes , and also how I able to filter result based on location too.
-------------------------------------------------------------------------------------------
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Umbraco.Core;
@using Umbraco.Core.Models;
@using Umbraco.Core.Services;
@{
var agents = Services.MemberService.GetMembersByMemberType("agents");
}
@foreach(var item in agents)
{
@item.Name
@item.Company
@item.Email
}
----------------------------------
Thanks
Waiting for reply
Hi Pradeep,
Custom fields are retrieving by method GetValue(), so for the fields like e.g name , address , subject you can do it like this
Hope this helps,
/Dennis
Hi Dennis, Thanks for reply , its nice we can use getvale method ...
But the macro is not working , error in loading , I not get any idea , what is problem there...
Please current my syntax for macro
-Thanks
Pradeep, can you look at traceLog ?
sorry by mistake i click on solution
Try to change to :
Hi Alex ,
Thanks its started working now ...
So , I am having a state list and I want to show all agent by state page ..
What I Have ...
1. I created a document type state and agents and member type as agents ...
2. How I able to get all member information as on every state page ... ( example like if any agents belongs to CA then all member list show on CA page )
How I can do that ,,,,
Thanks again for your help...
You have to filter members somehow. How do you recognize where agent is belong ?
By adding a Custom fields ....
.GetMembersByPropertyValue("city", "Horsens");
Its works ??
Yes, you can use Linq:
var agentsFiltered = agents.Where(agent => agent.GetMembersByPropertyValue
Thanks ,,
Its can be possible any way .... that I will be pass the current page name here ..
Example like someone visit on CA state page .. ( url like myhome/ca/)
-----------------------------------------------------
var statename = @currentpage.Name
var agentsFiltered = agents.Where(agent => agent.GetMembersByPropertyValue("city").Equals(statename));
---------------------------
How It will be used when search .... same ?
This code will return agents from current city, what isn't right ?
Yes ,code is working fine ...
var states = ApplicationContext.Current.Services.MemberService.GetMembersByPropertyValue("state","CA");
Thanks alex ...
I hope everything works fine ... , if I have any issue let you know .
Thanks again for your help
is working on a reply...