Let's code the form for post creation right into our user's profile page. This form will only show up if the logged-in user is looking at their own profile.
1. Open
user/profile.php
.2. Let's first check to see if the profile the user is looking at is their own.
<div class="span8"> <?php if ($is_current_user) { ?> <h2>Create a new post</h2> <?php } ?> <h2>Posts</h2> </div>
3. Next, let's add a form that will allow the currently logged-in user to make posts.
<div class="span8"> <?php if ($is_current_user) { ?> <h2>Create a new post</h2> <form action="<?php echo $this->make_route('/post')?>" method="post"> <textarea id="content" name="content" class="span8" rows="3"> </textarea> <button id="create_post" class="btn btn-primary">Submit </button> </form> <?php } ?> <h2>Posts</h2> </div>