-
Notifications
You must be signed in to change notification settings - Fork 0
Drupal 8 Module to track your people
License
rg-viza/where_are_my_people
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Copyright 2017 Neil Paul Davis Jr ## This file is part of Where are my people?. ## ## Where are my people? is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## Where are my people? is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Where are my people?. If not, see <http://www.gnu.org/licenses/>. To Do: Android app -- in progress News: Straightened out the dependency injection, cleaned things up. README Warning: I built this by day 4 of learning Drupal 8. I have Drupal 6/7 experience but Drupal 8 is a whole lot different, as far as coding goes :-) Purpose: Enables updating a user location in drupal to show their location on a map. Designed to be used in conjunction with a Android or iPhone app that POSTs longitude and latitude at your drupal server's REST API (instructions below) to update a user's location Android app coming soon (or possibly a link to an existing android app)! Step 1: Create new google maps API key at https://console.developers.google.com/apis/credentials and add it to templates/map.html.twig template replacing YOUR_GOOGLE_MAPS_API_KEY string with your key Step 2: git clone to ../modules/custom directory under web root of drupal Step 3: Enable "Where are my people?", REST UI, RESTful Web services and Serialization modules in Drupal 8 Step 4: Go to Configuration | Rest UI and enable Where are my People? API Routes. Select all checkboxes. Step 5: Point location app at your server and send a json payload via POST such as: { "username":"admin", "long":-86.5537833, "lat":29.283338 } To http://[www.yoursever.com]/where_are_my_people?_format=json IMPORTANT : You will need to send the following headers along with JSON payload: X-CSRF-Token: [valid session ID] Content-Type: application/json If your server requires it, you may also need to send: Authorization: Basic [some auth hash] as well. To see location of users use the following new route defined by this module: http://[www.yoursever.com]i/where_they_are/admin for example (Route is http://[www.yoursever.com]/where_they_are/{username}) I have also included a REST API call for getting a user's location, in case you want to integrate this location data into another application(or even your own modules, such as a tracking log!): http://[www.yoursever.com]/where_are_my_people/{drupal username}?_format=json example: http://[www.yoursever.com]/where_are_my_people/admin?_format=json returns: { "location":{ "longitude":[ { "value": "-76.5537833" } ], "latitude":[ { "value": "39.2833380" } ] } } Enjoy!
About
Drupal 8 Module to track your people
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published