?> <span class="delbtn"><input type="button" class="delete_comment" value="Delete Comment" /></span> </form> </div> <?php } ?> </div> <!-- END comment_container --> <?php } ?> <?php foreach ($awaiting_comments as $awaiting_comment) { $ngstaff_user = Helper_Account::is_ngstaff($awaiting_comment->user); ?> <div class="comment_container awaiting_moderation<?php if ($ngstaff_user) { echo "comment_ngstaff ngstaff"; } ?> "> <div class="avatar<?php if ($ngstaff_user) { echo " ngstaff"; } ?> "> <div class="avatar_inner<?php if ($ngstaff_user) {
<h3>Gender:</h3> <?php echo form::select('gender', array('male' => 'Male', 'female' => 'Female'), $user->gender); ?> <br /><br /> <h3>Set User as Admin:</h3> <?php echo form::checkbox('admin_user', '1', Arr::get($_POST, 'admin_user', Helper_Account::is_admin($user)), array("id" => "confirm")); ?> Yes <h3>Set User as NG Staff:</h3> <?php echo form::checkbox('ngstaff_user', '1', Arr::get($_POST, 'ngstaff_user', Helper_Account::is_ngstaff($user)), array("id" => "ngstaff_confirm")); ?> Yes <?php if (!Helper_Account::is_approved($user)) { echo new Element("div", HTML::anchor("admin/users/approve/" . $user->id, "Force Parent Approval"), array("style" => "margin-top:15px;")); } ?> </div> <!-- END: title --> <div class="title_bottom"></div> <div class="submit_container"> <ul class="buttons"> <li><?php echo form::submit('submit', '', array('class' => 'save')); ?>
/** * Edit a user * * @return void * @author Will Robertson */ public function action_edit($user_id = null) { $user = ORM::factory('user')->where('id', '=', $user_id)->find(); /* Load the view. */ $this->template->styles = array('public/js/vendor/datepicker/jquery-ui-1.8.5.custom.css' => 'screen'); $this->template->scripts = array('public/js/vendor/jquery-ui-1.8.5.custom.min.js', 'public/js/vendor/word-count.js', 'public/js/account/vanity_preview.js'); $content = $this->template->content = View::factory('admin/users/edit'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); if ($user->loaded()) { $this->template->content->set(array('user' => $user)); } else { Message::set(Message::NOTICE, "This user does not exist."); Request::instance()->redirect('admin/users'); } if ($_POST) { /* Do they want to make this user an admin? */ $set_admin_user = Arr::get($_POST, 'admin_user'); /* Do they want to make this user a NG Staff member? */ $set_ngstaff_user = Arr::get($_POST, 'ngstaff_user'); /* Load the validation rules, filters etc.*/ $post = $user->validate_update($_POST); /* If the post data validates using the rules setup in the user model. */ if ($post->check()) { $admin_role = new Model_Role(array('name' => 'admin')); $ngstaff_role = new Model_Role(array('name' => 'ngstaff')); if ($set_admin_user) { if (!Helper_Account::is_admin($user)) { $user->add('roles', $admin_role); } } else { $user->remove('roles', $admin_role); } if ($set_ngstaff_user) { if (!Helper_Account::is_ngstaff($user)) { $user->add('roles', $ngstaff_role); } } else { $user->remove('roles', $ngstaff_role); } /* Affects the sanitized vars to the user object. */ $user->email = $post['email']; $user->username = $post['username']; /* If the user wants to change the display name */ if ($user->display_name != $post['display_name']) { /* Set new display name if it isn't in use already */ if (Helper_Account::display_name_exists($post['display_name'])) { echo 'problem'; Message::set(MESSAGE::ERROR, array('Display name already in use!', 'The display name you entered (' . $post['display_name'] . ') is already in use, please choose another one. Reverting to your previous display name (' . $user->display_name . ').')); } else { $user->display_name = $post['display_name']; } } $user->birthdate = $post['birthdate']; $user->gender = $post['gender']; $user->vanity_url = $post['vanity_url']; /* Create the account. */ $user->save(); /* Redirect to users edit page. */ Request::instance()->redirect('admin/users'); } else { /* Get errors for display in view. */ Message::set(Message::ERROR, $post->errors("user")); } } }
?> </div> <p class="caption"> <?php echo $caption->caption; ?> </p> </div> </div> <!-- END comment_container --> <?php } ?> <?php foreach ($awaiting_captions as $awaiting_caption) { $ngstaff_user = Helper_Account::is_ngstaff($awaiting_caption->user); ?> <div class="comment_container awaiting_moderation<?php if ($ngstaff_user) { echo " ngstaff"; } ?> "> <div class="avatar"> <div class="avatar_inner"> <?php echo html::anchor(Helper_Account::get_public_account_url($awaiting_caption->user), html::image(Helper_Account::get_avatar($awaiting_caption->user, 'thumbnail'))); ?> </div> </div> <div class="text">
echo $user->display_name; ?> </h1> <?php if ($loggedin) { if (!$user_owns_page && !$isaFan) { echo html::anchor("/account/addfan/" . $user->id, "+Fan", array('class' => 'fan_btn')); } else { if (!$user_owns_page) { echo html::anchor("/account/removefan/" . $user->id, "-Fan", array('class' => 'unfan_btn')); } } } echo HTML::image(Helper_Account::get_avatar($user, 'medium'), array("class" => "profile-thumb")); if (Helper_Account::is_ngstaff($user)) { ?> <div class="staffer"><img src="/public/images/layout/staff_tag.png" alt="NG Staff" /></div> <?php } if (Helper_Account::is_admin()) { if ($user->avatar->loaded()) { ?> <div class="moderation-link"><?php echo html::anchor('admin/avatars/view/' . $user->avatar->id, 'Moderate Avatar'); ?> </div> <?php } ?> <div id="watch-photographer" class="moderation-link"><?php