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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

First Login, show different content


Go to End


3 Posts   1425 Views

Avatar
Martinjj

Community Member, 12 Posts

27 January 2014 at 10:41pm

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

Community Member, 49 Posts

28 January 2014 at 10:11am

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

Community Member, 12 Posts

29 January 2014 at 10:35am

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