Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Is there some sort of numerical user id?

Started by Brian 5 years ago · 4 replies · 592 views
5 years ago

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

5 years ago

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' 😃 .
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.

5 years ago

@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?
5 years ago

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 🙂

5 years ago

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.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
3 66 28 minutes ago
Support · by Anna, 3 days ago
2 72 21 hours ago
Support · by Justin Young, 22 hours ago
1 40 22 hours ago
Support · by Duc , 1 week ago
2 76 6 days ago
Support · by Colin Hume, 1 week ago
2 70 6 days ago