/** * Widget Output. * @see WP_Widget::widget() */ public function widget($args, $instance) { global $wpdb; extract($args, EXTR_SKIP); $number = (int) $instance['number']; if (1 > $number) { $number = 5; } elseif (20 < $number) { $number = 20; } echo $before_widget; if (!empty($instance['title'])) { echo $before_title . $instance['title'] . $after_title; } echo '<ul>'; $subquery = aoc_roles_subquery(); $query = "SELECT ID, user_login, display_name FROM ( {$subquery} ) AS usr " . "ORDER BY user_registered DESC " . "LIMIT 0,{$number};"; $users = $wpdb->get_results($query); foreach ($users as $user) { echo '<li>'; if ($instance['avatar']) { echo get_avatar($user->ID, $instance['avatar-size']); } echo '<a href="' . aoc_profile_link(urlencode($user->user_login)) . '">' . $user->display_name . '</a></li>'; } echo '</ul>'; echo $after_widget; }
/** * Creates the HTMML anchor for user profile page. * * @param int $user_id User ID we want to retrieve the anchor * @param object $user Optional user data object * @return string The HTML anchor. */ function aoc_user_anchor($user_id, &$user = false) { if (!is_object($user)) { $user = get_userdata($user_id); } return '<a href="' . aoc_profile_link($user->user_login) . '">' . $user->display_name . '</a>'; }
* Copyright 2009, 2010 Jordi Canals <*****@*****.**> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ ?> <div id="wall"> <h1 class="alkivia-title"><?php printf(__("%s's Activity Wall", $i18n), '<a href="' . aoc_profile_link($user->user_login) . '">' . $user->display_name . '</a>'); ?> </h1> <?php foreach ($items as $item) { echo '<p>' . $item['avatar']; echo '<span class="datetime">' . ak_time_ago($item['date'], $i18n) . '</span><br />' . $item['text'] . '</p>'; } ?> </div>
/** * Filter to replace the comments author link. * The link is only replaced if the user is registered and is from an allowed role. * * @hook filter 'get_comment_author_link' * @param string $link Link to author home page generated by WordPress * @return string Link to the user profile page if user is registered and from an allowed role. */ function commentAuthorLink($link) { global $comment; if (!empty($comment->user_id) && $this->canShowUser($comment->user_id)) { $user = get_userdata($comment->user_id); $link = '<a href="' . aoc_profile_link($user->user_login) . '" class="url">' . $user->display_name . '</a>'; } return $link; }
Copyright 2009, 2010 Jordi Canals <*****@*****.**> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $gallery_title = '<h1 class="alkivia-title">' . sprintf(__("%s's Photo Gallery", $i18n), '<a href="' . aoc_profile_link($user->user_login) . '">' . $user->display_name . '</a>') . '</h1>'; // Apply a filter to the title to allow changing the title when using the gallery in other places. echo apply_filters('aoc_gallery_title', $gallery_title); ?> <?php if (!empty($edit_link)) { ?> <h3 class="alkivia-admin-link"><?php echo $edit_link; ?> </h3> <?php } ?>