Jump to:

23477 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » First Login, show different content

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

Page: 1
Go to End
Author Topic: 318 Views
  • Martinjj
    Avatar
    Community Member
    12 Posts

    First Login, show different content Link to this post

    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

  • flipsidenz
    Avatar
    Community Member
    49 Posts

    Re: First Login, show different content Link to this post

    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?

  • Martinjj
    Avatar
    Community Member
    12 Posts

    Re: First Login, show different content Link to this post

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

    318 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.