summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2019-02-24 14:01:27 -0600
committerGitHub <noreply@github.com>2019-02-24 14:01:27 -0600
commitc38d6c9d09211976b63200dfd1d384bf890fc002 (patch)
tree2780d7f08cda7faef0132b0b615dec2fcbccc59c
parentacc8a8e673b1b71ea828422ec15f77450a409983 (diff)
parentd30486e7c610e2ba2998ed5997fd86c6dcae5c77 (diff)
Merge pull request #108 from dshanske/profile
Simple Addition of Profile Data to Quill
-rw-r--r--lib/helpers.php11
-rw-r--r--views/index.php10
-rw-r--r--views/settings.php7
3 files changed, 27 insertions, 1 deletions
diff --git a/lib/helpers.php b/lib/helpers.php
index 36e964b..0edaa5c 100644
--- a/lib/helpers.php
+++ b/lib/helpers.php
@@ -42,6 +42,17 @@ function session($key) {
return null;
}
+function profile($key) {
+ if ( ! session('auth') ) {
+ return null;
+ }
+ $auth = session('auth');
+ if ( array_key_exists('profile', $auth) && array_key_exists($key, $auth['profile'] ) ) {
+ return $auth['profile'][$key];
+ }
+ return null;
+ }
+
function k($a, $k, $default=null) {
if(is_array($k)) {
$result = true;
diff --git a/views/index.php b/views/index.php
index f60b560..4277fe1 100644
--- a/views/index.php
+++ b/views/index.php
@@ -5,7 +5,15 @@
<p class="tagline">Quill is a simple app for posting text notes to your website.</p>
- <? if(session('me')): ?>
+<? if(session('me')):
+ if ( profile('photo') ) {
+ ?> <img src="<?php echo profile('photo'); ?>" height="125" alt="Profile Image" />
+<?php }
+ if ( profile('name') ) {
+ ?> <p><?php echo profile('name'); ?></p>
+<?php }
+ ?>
+
<p>You're already signed in!<p>
<p><a href="/dashboard" class="btn btn-primary">Continue</a></p>
<? else: ?>
diff --git a/views/settings.php b/views/settings.php
index f94b9fe..51d3a6b 100644
--- a/views/settings.php
+++ b/views/settings.php
@@ -8,6 +8,13 @@
<td>me</td>
<td><code><?= $this->user->url; ?></code> (should be your URL)</td>
</tr>
+ <?php if ( profile('name') ) {
+ ?>
+ <tr>
+ <td>User Name</td>
+ <td><code><?= profile('name'); ?></code> </td>
+ </tr>
+ <?php } ?>
<tr>
<td>scope</td>
<td><code><?= $this->user->micropub_scope ?></code> (should be a space-separated list of permissions including "create")</td>