From 0046e24f6da7dad378062a545b67d54194a656f3 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Mon, 13 Oct 2014 16:06:07 -0400 Subject: [PATCH] add note about the "p3k-food" parameter. fix undefined $url variable error. --- controllers/controllers.php | 9 +++++++-- views/new-post.php | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/controllers/controllers.php b/controllers/controllers.php index 5aa7867..a8bc0a3 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -182,6 +182,7 @@ $app->post('/post', function() use($app) { $entry->save(); // Send to the micropub endpoint if one is defined, and store the result + $url = false; if($user->micropub_endpoint) { $mp_request = array( @@ -208,11 +209,15 @@ $app->post('/post', function() use($app) { } $entry->save(); + } + + if($url) { + $app->redirect($url); } else { + // TODO: Redirect to an error page or show an error on the teacup post page $url = Config::$base_url . $user->url . '/' . $entry->id; + $app->redirect($url); } - - $app->redirect($url); } }); diff --git a/views/new-post.php b/views/new-post.php index 0c4ece0..a07f0ea 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -74,6 +74,10 @@ access token String of length access_token) ?>access_token) > 0) ? (', ending in ' . substr($this->access_token, -7) . '') : '' ?> (should be greater than length 0) + + p3k-food + The button you tap (or your custom text) will be sent to your Micropub endpoint in a field named p3k-food +