/** * Make sure that the one to update belongs to the user * @Developer brandon * @Date May 19, 2010 */ public function edit($id = NULL) { $journal = ORM::factory('journal', $id); if ($journal->user->id != user::current()->id) { url::redirect(''); } meta::set_title(date::user_friendly_date($journal->created_at) . ' : ' . $journal->title); parent::edit($id); }
/** * Send out the daily topic e-mail * @developer Brandon Hansen * @date May 25, 2010 */ public function send_daily_email() { if ($topic = ORM::factory('topic')->topic_of_the_day()) { $users = ORM::factory('user')->users_subscribed_to_topic_of_the_day(); $this->subject = 'Topic of the Day for ' . date::user_friendly_date(date('Y-m-d')); $this->body = View::factory('emails/daily_topic')->set('topic', $topic)->render(); foreach ($users as $user) { $this->recipient = $user->email; $this->send(); } } }
<div id="my_account"> <h2>My Account</h2> <table class="account_layout"> <tr> <th colspan="2"><?php echo count($user->journals); ?> Journal <?php echo ucwords(inflector::plural('entry', count($user->journals))); ?> </th> </tr> <tr> <th>Member Since</th> <td><?php echo date::user_friendly_date($user->created_at); ?> </td> </tr> <tr> <th>Username</th> <td><?php echo $user->username; ?> </td> </tr> <tr> <th>Email</th> <td><?php echo $user->email; ?>