Updating structure fields on KirbyPanel users

Hi there! I seem to have run into an issue with updating the content within structure fields on the users in my kirby panel

I used the technique described here, but when i tried to run the yaml() function it caused an error, and if i tried yaml::decode it failed to pass the entire structure, only a portion of it

i have since moved on to MySQL to handle what i needed to accomplish but I figured it was best to also pass this on incase anyone else tries to do the same (probably me in the future!)

also any functions to easily just update individual entries and their child values within the structure would be very nice, not just the ability to add new entries to it. thanks for all your hard work on this fantastic software, a customer for life!

Could you post your code, pls?

Yeah! think this was it, i trashed the page i was using but i have a lingering text document that i believe details what was going on here

      <?php foreach(yaml::decode( $site->users()->find('565fd296754fd')->puzzlestats() ) as $stat): ?>
        <div class="address">
          <?php echo $stat['puzzleid'] ?><br />
          <?php echo $stat['puzzlescore'] ?> <?php echo $stat['wins'] ?>
        </div>
    <?php endforeach ?>

i was getting jumbled output here for each time i was echoing one of the values in the structure

i copied the exact same structure into a page with a template and tried running the same code with success

i believe this following output was returned by
print_r( yaml::decode( $site->users()->find('565fd296754fd')->puzzlestats() ) )
(it might’ve been a var_dump, can’t remember)

string(170) "- puzzleid: test1 puzzlescore: “1” wins: “1” losses: “2” - puzzleid: test2 puzzlescore: “3” wins: “1” losses: “1” - puzzleid: test3 puzzlescore: “4” wins: “0” losses: “3"”

and this second one was the same implementation on the normal kirby page

string(197) "- puzzleid: test1 puzzlescore: “1” wins: “1” losses: “2” - puzzleid: test2 puzzlescore: “3” wins: “1” losses: “1” - puzzleid: test3 puzzlescore: “4” wins: “0” losses: “3"” }

like said before, the yaml function did not work on the users page but it did work when used on the normal kirby page

hopefully i’m remembering this all right haha! hopefully something can be done here! and hopefully it wasn’t just me implementing it improperly ;p

thanks!!

I think this is a bug, the yaml() and toStructure() methods throw an error when used on a structure field in a user blueprint. I’ll create an issue on GitHub.

Ah, didn’t know this was related to an already known bug

sweet! guess i’ll be looking forward to it getting fixed :smile:

thanks for all your help!