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 @@
' . substr($this->access_token, -7) . '
') : '' ?> (should be greater than length 0)p3k-food