Jump to content

kyksh

Members
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

kyksh's Achievements

Newbie

Newbie (2/6)

1

Reputation

  1. Found it out myself. As a test case, I set up a vanilla multi-language site and created a custom TextLanguage field "custom1" for the images on "home". I wanted to change and save a single language value directly, e.g. $mlFieldValues->setLanguageValue("de", "new Value") ; $p->of(false); $p->save(); But this deletes all other language values. Instead, I have to 1. read in all current values, 2. change whatever language value has to be changed and 3. save the entire object. $newValues = ["de"=>"DE overwritten by script", "fi"=>"FI overwritten by script"]; $p = $pages->get(1); $img = $p->images->first(); $mlFieldValues = $img->custom1; print "\n\nBEFORE:\n";print_r($mlFieldValues); print "\n\nNEW VALUES:\n"; print_r($newValues); $p->of(false); foreach($newValues as $lang => $newValue){ $mlFieldValues->setLanguageValue($lang, $newValue) ; } $img->custom1 = $mlFieldValues; $p->save(); print "\n\nAFTER:\n";print_r($mlFieldValues); Output: BEFORE: ProcessWire\LanguagesPageFieldValue Object ( [default] => previous english value [de] => previous german value [fi] => previous finnish value ) NEW VALUES: Array ( [de] => DE overwritten by script [fi] => FI overwritten by script ) AFTER: ProcessWire\LanguagesPageFieldValue Object ( [default] => previous english value [de] => DE overwritten by script [fi] => FI overwritten by script )
  2. So embarrasingly easy. Need to check out more PW basics... Thank you!
  3. Hi! I need users to login by their email address. This works when I change the value in ProcessLogin.module 122 protected $useEmailLogin = null; to 122 protected $useEmailLogin = true; What would be a recommended way to enable this? There's this line in ProcessLogin.module: 15 * @property bool|int $allowEmail Whether or not email login is allowed (0|false=off, 1|true=Yes, 2=Yes or name also allowed) But I can't figure out how to set this. I tried next to $useEmailLogin in ProcessLogin.module and in config.php, but neither takes effect. BTW I tried module LoginWithEmail but it seems outdated. My PW version is 3.0.165
×
×
  • Create New...