Paul's right - a cookie would work fine though if you don't want to bug the member if they use a different computer / device then you might want to store this against their member record in Umbraco. If so create a variable and use the MemberService to update this flag.
This would only be sensible for logged in members. But yes,
var umbMember = Membership.GetUser();
var _memberService = ApplicationContext.Current.Services.MemberService;
var umbMemberProfile = _memberService.GetByUsername(umbMember.UserName);
umbMemberProfile.SetValue("takenTour", true);
_memberService.Save(umbMemberProfile);
How to detect Member if it his/her first time visited the page?
Hi All,
I want to detect this member who is it's first time visited the page for my
Take A Tour
function.Can anyone give some ideas.
Thanks
Marky
Hi Marky What about using a cookie?
Kind regards
Paul
Hi Paul,
Do you have a sample code for my reference.
Thanks
Marky
Here is an example
https://stackoverflow.com/questions/9158225/using-cookie-in-asp-net-mvc-c-sharp/21478800
Paul's right - a cookie would work fine though if you don't want to bug the member if they use a different computer / device then you might want to store this against their member record in Umbraco. If so create a variable and use the MemberService to update this flag.
https://24days.in/umbraco-cms/2014/dealing-with-members/
Remember after changing a value you have to save the member!
Steve
Hi Steve,
Thanks for your ideas!
It might be need to get the
MemberId
to check if thisId
already visited the page?Thanks,
Marky
This would only be sensible for logged in members. But yes,
Hi Steve,
Sorry, I'm new in Umbraco coding.
As what I've understand in your given code, is only putting a value in
takenTour
upon registration.I think the idea is, after member registered the
takenTour
value is sets to False and when it's visited the page, it will set to True.Can you help me, on how to put this in the specific page?
Thanks,
Marky
Hi,
Hard to say where to put it - how far have you got? Do you have a member's registration and login page?
Step through my three tutorials and the penny should drop.
http://siempresolutions.co.uk/blog/UmbracoMembersProtectedAreaof_Website
http://siempresolutions.co.uk/blog/UmbracoMembersProtectedAreaofWebsitePart2UsingMVCMembersController
http://siempresolutions.co.uk/blog/UmbracoMembersPart3AFullSolution
The code's a little old now and I want to update the redirect stuff but the principles are all there.
Steve
Hi Steve,
I've done it using your code, thanks.
But is this code will not bug in the future?
Thanks you mate,
Cheers,
Marky
Sorry - I don't follow you - what you do mean by "But is this code will not bug in the future?"
Steve
is working on a reply...