Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

First Login, show different content


Reply

3 Posts   331 Views

Avatar
Martinjj

27 January 2014 at 10:41pm Community Member, 12 Posts

Hello, i am trying to get my head around how to show different content in a page template once a new user has registered, Successful registration will redirect the user to their account page, on the first visit to this page i wish to show a div with a few lines of content, this div will only be visible during the new members first login, after the first login then it will no longer be shown.

I know i need to be using "Numvisit", is there a way to use this directly into a template without using page controller or should i build a function and wrap it around the div with a "with_CurrentUser" statement,.

Please no code, just point me in the right direction i like to learn hands on, i just need the somewhere to start.

regards and thanks
Martin

Avatar
flipsidenz

28 January 2014 at 10:11am Community Member, 49 Posts

You can access NumVisit off the CurrentMember object directly in the table using dot annotation - i.e. CurrentMember.NumVisit. You should be able to write a conditional if statement from there.

http://doc.silverstripe.org/framework/en/reference/templates

Alternatively, the Member class contains an is_repeat_member method.

http://api.silverstripe.org/3.1/class-Member.html

Hope that helps?

Avatar
Martinjj

29 January 2014 at 10:35am Community Member, 12 Posts

Brilliant, thanks, i went the way of using a conditional directly in the template ss file, works a treat.