theruss

While I haven't had to do this myself since SS3, looking at the code, you'd need to write your own IdentityStore implementation. So have a look at SessionAuthenticationHandler and BasicAuthAuthenticationHandler for how you might achieve this.

muskie9

Injector::inst()->get(IdentityStore::class)->logIn($member);

Jack

Hi folks. What's the best way to login a member manually now that Member->LogIn() is depreciated? I am writing the member through a sign up form and I want to log them in straight after. I could not find good documentation on this. Cheers

Jay

I need to migrate the page type history to the newest version. How do I do this?

adrianstein

Yup. That has been done and I just re did it

theruss

Can you post the relevant parts of your config, including the relevant use blocks?

theruss

Assuming your Page class calls use for the relevent DataObject subclass, and your DataObject for sure is extended by Versioned, then the following should work (This works on my own 4.4 site)

  1. private static $owns = [
  2. 'LogoMobile',
  3. 'LogoMobileHighResolution'
  4. ];
  5.  
  6. private static $has_one = [
  7. 'LogoMobile' => Image::class,
  8. 'LogoMobileHighResolution' => Image::class
  9. ];
adrianstein

` private static $has_one = [ 'EBook' => EBook::class ];

private static $owns = [
    'EBook'
];

`

adrianstein

` private static $belongs_many = [ 'LandingPages' => LandingPage::class, 'EBookDownloads' => EBookDownload::class ];

private static $extensions = [
    Versioned::class,
];

`

theruss

Does the EBook relation to LandingPage work as you expected? I mean in terms of saving and publishing?

theruss

Because everything you've posted so far looks OK to me.

adrianstein

if I make a change to ebook and just save and not publish it shows right away on the page

adrianstein

is it the way I call Ebook from the template maybe?

adrianstein

is there a recommended way to get either live or stage base on the version the page it at?

theruss

No, not really. For a start a "Stage" (aka "Draft" <-- stupid naming) isn't a "Version". A "Version" as SilverStripe knows it, is only something that is, or has been published.

theruss

If an object is published, and the user-access is from a non-authenticated session (i.e. a new browser, or an incognito browsing session) then $Foo as you're doing should just work, and return the currently published version.

adrianstein

Well if the URL has ?stage=Stage the content shows if not it does not

adrianstein

I just unpublished the page and then republished it and the Ebook section now shows on the live version....

adrianstein

I have not chanegd anything but it appears to work as expected now

adrianstein

maybe as I created the page before adding versioning??

adrianstein

Thanks for the help 🙂 At least I did it right, I was starting to think I was loosing my mind 😛


Show less replies
theruss

Right. Ensure you have flushed your cache every time you make a change to YML config and to any private (config related) statics

adrianstein

I can see it on the draft version of the page but not live