Is there some sort of numerical user id?

Hi everyone!

Brand new using Grav and I think it will do what I want with a few plugins. But my question is this; is there a way to assign each user who registers a numerical id? I need users to be able to create custom versions of a puzzle which is then saved in a database.

I then need for them to be able to log in at a later date and see that stats on their puzzles.

The PHP code is more or less written in PHP, I’m just missing a userID field to tie it all together.

Thanks

Brian

Hi @MildlyDeviant ,
no, Grav does not maintain a numerical User ID, users in Grav are represented as a collection of Flex Objects - this is a relativ new approach to handle all sorts of structured data inside Grav, you can consider this as the ‘Grav Database’ :smiley: .
so, you could think about to model your puzzle data with flex objects, this way you can achieve a full integration into Grav, eliminating the need to use an external database.
or, you could map the Grav User Objects to your database, adding numerical ID as you described.

@MildlyDeviant, No, out of the box, Grav does not maintain userIDs. However…

Grav is very flexible and almost any part of its internal functionality can be used/extended in your app. But before elaborating on the options you have, a tad more context would be nice.

  • Is the puzzle an existing external app/library/api which needs to be accessed?
  • Or has the puzzel app yet to be created solely using Grav functionality?

Thanks @hoernerfranz, I’ll take a look at the plugin and see if it makes sense to me. Would it be able to handle the scenario below where a user could have multiple saved instances of a particular puzzle.

Basically, I’m creating a site that will host puzzles for Geocachers. A user (or cache hider) will create their custom instance of a particular puzzle for a mystery geocache they are hiding. They’ll then link to their puzzle instance, and people wanting to find that geocache will solve the puzzle to get the coordaintes. So a particular cache hider may have multiple instances of a puzzle for different puzzle hides. Or a cache hider might want to use all my puzzles for different hides. Hopefully that makes sense lol :slight_smile:

Thanks @pamtbaau, see my response to hoernerfranz for birdseye view of what I’m trying to achieve. To answer your questions, I have a number of puzzles that I’ve been using for my own hides which are fairly basic stand alone php files that currently have no database requirements.

I’ve converted one to use a mysql database, as it’s probably the easiest one. Once I get this working with Grav (including multi user / multi instance) then I’ll convert the others to work too.