Autofahrn

Members
  • Content count

    53
  • Joined

  • Last visited

  • Days Won

    2

Autofahrn last won the day on May 23

Autofahrn had the most liked content!

Community Reputation

58 Excellent

About Autofahrn

  • Rank
    Full Member

Contact Methods

  • Website URL
    http://www.team-tofahrn.de/en/

Profile Information

  • Gender
    Male
  • Location
    Germany

Recent Profile Visitors

171 profile views
  1. Autofahrn

    you are looking for something like: output.style.color = "red"; https://www.w3schools.com/jsref/prop_html_style.asp
  2. Autofahrn

    For me there are two issues, the SQL errors and the strange class not found errors (which sounds more like a corrupted filesystem). On what kind of system is this installation running? If the files get corrupt, I'd more expect some syntax error not a class not found. Could this be some module load order issue? Missing module dependency or similar? Anyway, this should not break the SQL side.
  3. Autofahrn

    Looks similar to this one: Do you have some caching enabled? Sounds like the cached files went corrupt for some reason and rebuilding the cache after touching the sources fixes it. Very strange.
  4. Autofahrn

    ok, got it...
  5. Autofahrn

    In which situation do you not have the required checkbox on a datetime field? On all field types I'm aware of the Required checkbox is located on Input tab. Or do I miss something?
  6. Autofahrn

    Can you give me more code context? I've just added that to my previous test code and it works quite well: <?php namespace ProcessWire; $test = $page->protabla->makeBlankItem(); // getNew(); $test->name = date('D, d M Y H:i:s'); $test->notes = 'my note'; $test->entrega = time(); // date("Y-m-d H:i"); // $test->save(); $page->of(false); // required for page save $page->protabla->add($test); $page->save('protabla'); // only save that field $page->of(true); $content = "<h4>{$page->title}</h4>"; $content .= "<table>"; foreach($page->protabla as $pt) { $content .= "<tr><td>{$pt->name}</td><td>{$pt->notes}</td><td>{$pt->entrega}</td></tr>"; } $content .= "</table>";
  7. Autofahrn

    When I set DateTime fields from API I just use the unix timestamp like: $newRow->entrega = time(); Well, doesn't help if your time source is a string.
  8. Autofahrn

    If that field should only transport some additional data, why not simply add some markup? $form->appendMarkup = "<input type='hidden' name='some-name' value='some-value' />";
  9. Well, either you strip those headers manually (which you did) or enumerate over all containers, search for the user table and continue to process that one (code only to get an idea, probably contains some typos): $AllData = json_decode($http->get('localhost:8888/playwood/pw_users.json'), true); foreach($AllData as $container) { if(($container['type'] == 'table') && ($container['name'] == 'name_users')) { $UserData = $container['data']; foreach($UserData as $v) { : } break; } } If the generated users are named from current timestamp then I suppose that $UserPwName is not set correctly. Did you check that $UserLoginName is read correctly from your data (maybe adding d($UserLoginName); and d($UserPwName); helps).
  10. We are here to exchange ideas, so please try to stay besserwisserisch as I understand that I needed to explain my approach a little better . My JSON data not only contained user login information but other stuff like avatar images, signatures various settings (from the origin) etc. My template is more a viewer for that data which allows to import or update contents on a per-user base. Of course I could also create that as a module, but for that one-time use going with a template was more straight forward for me. I prefer making a module for the reusable stuff.., That's what I meant that migrating the password (probably) does not work, unless you are able to decrypt the hash code stored in the database. I'd set some randomized password and integrate the LoginRegister module along with ForgetPassword so users are able to restore their accounts on their own. And, yes, I've omitted the closing brace in my snippets (thought it was too obvious). The row looks ok, but maybe your JSON includes some additional headers which need to be referenced first (the part before the first row of user data) like this: { "Type" : "UserData", "Users" : [ { "ID": .... Then your foreach would have to start on $UserData["Users"] and you could verify $UserData["Type"] before starting the import.
  11. Sure, using the debugger for such one-shot solutions may be faster to go. In my case the template contains much more functionality, since it generates a regular visible page. There I could pick the users to import or update information after changing fields in the user template etc.
  12. If you can export the user as JSON, it should be simple enough to write a small importer in PHP. When I did similar, I created a template with a simple file field holding the JSON containing the user database. The associated template php starts like this: <?php namespace ProcessWire; if(isset($page->json_file)) $UserData = json_decode(file_get_contents($page->json_file->path . $page->json_file->first()->name), true); else $UserData = [ ]; // ensure always set, yet empty. depending on your JSON structure you'll iterate through your users somewhat like this: foreach($UserData as $v) { // Fetch whatever fields should be imported $UserLoginName = $v["LoginName"]; $UserRealName = $v["RealName"]; $UserMail = $v["EMail"]; In my implementation I'm building a pagename from the original name and check if the user actually exists: $UserPwName = $sanitizer->pageName($UserLoginName, true); $usr = $users->get("name={$UserPwName}"); Of course you only want to add a user which does not exist yet (you may do other things like update for existing users): if($usr->id == 0) // User does not exist { $usr = $users->add($UserPwName); // Create user if($usr->id) // Success? { $usr->of(false); // Prepare for update $usr->email = $UserMail; $usr->addRole('imported-user'); // add some special role here // add more fields depending on your use case // $usr->user_name = $UserRealName; $usr->save(); } else { // may $log->error("ERROR creating user {$UserRealName}"); } } Shouldn't be too difficult to adapt for other scenarios. Take care of the passwords, which likely can't be migrated that way!
  13. Autofahrn

    Try this: $test = $page->protabla->makeBlankItem(); // getNew(); is wrong, allocation done by makeBlankItem() $page->of(false); // always a good idea $test->name = date('D, d M Y H:i:s'); $test->notes = 'my note'; // $test->save(); // not required $page->protabla->add($test); $page->save('protabla'); // only save that field $page->of(true); functional test code (with delayed output) here: <?php namespace ProcessWire; $test = $page->protabla->makeBlankItem(); $page->of(false); // always a good idea $test->name = date('D, d M Y H:i:s'); $test->notes = 'my note'; $page->protabla->add($test); $page->save('protabla'); // only save that field $page->of(true); $content = "<h4>{$page->title}</h4>"; $content .= "<table>"; foreach($page->protabla as $pt) { $content .= "<tr><td>{$pt->name}</td><td>{$pt->notes}</td></tr>"; } $content .= "</table>"; Edit: Maybe this should be moved to the ProFields Table support forum.
  14. Autofahrn

    and line 180 is which one? I'll setup a test and come back...
  15. Autofahrn

    did you save the page afterwards? $test = $page->protabla->getNew(); $page->of(false); // always a good idea $test->name = 'my name'; $test->notes = 'my note'; $test->save(); $page->save('protabla'); // only save that field $page->of(true); (only guessing)