function print_summary($link) { global $current_user; static $comment_counter = 0; if(!$this->read) return; $comment_counter++; echo '<li id="c-'.$this->id.'"><div class="comment-body" id="comment-'.$comment_counter.'"><a href="'.$_SERVER['PHP_SELF'].'?id='.$link->id.'#comment-'.$comment_counter.'"><strong>#'.$comment_counter.'</strong></a> '.$this->put_smileys(save_text_to_html($this->content)).'</div>'; echo '<div class="comment-info">'; echo _('escrito por'). ' <a href="./user.php?login='******'">'.$this->username.'</a> '._('hace').' '.txt_time_diff($this->date); echo '<img src="'.get_gravatar_url($this->email, 20).'" width="20" height="20" alt="'.$this->username.'" title="gravatar.com" /></div></li>'."\n"; }
function send_feedback_after_comment($comment_id) { $comment = get_comment($comment_id); $author_uname = $comment->comment_author; $raw_message = $comment->comment_content; //get author of original post $post_id = $comment->comment_post_ID; $post = get_post($post_id); $author_id = $post->post_author; //get comment author gravatar $author = get_user_by('login', $author_uname); $author_email = $author->user_email; $gravatar = get_gravatar_url($author_email); $message = array("feedback" => $raw_message, "author" => $author_uname, "icon_url" => $gravatar); send_push_notification(users_gcm_ids($author_id), $message); }
function mw_getRecentAssignments($args) { global $wp_xmlrpc_server; $wp_xmlrpc_server->escape($args); $blog_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; if (isset($args[3])) { $query = array('numberposts' => absint($args[3]), 'post_type' => "assignment"); } else { $query = array('post_type' => "assignment"); } // Let's run a check to see if credentials are okay if (!($user = $wp_xmlrpc_server->login($username, $password))) { return $wp_xmlrpc_server->error; } $posts_list = wp_get_recent_posts($query); if (!$posts_list) { return array(); } $struct = array(); foreach ($posts_list as $entry) { $post_date = _convert_date($entry['post_date']); $post_date_gmt = _convert_date_gmt($entry['post_date_gmt'], $entry['post_date']); $post_modified = _convert_date($entry['post_modified']); $post_modified_gmt = _convert_date_gmt($entry['post_modified_gmt'], $entry['post_modified']); $categories = array(); $catids = wp_get_post_categories($entry['ID']); foreach ($catids as $catid) { $categories[] = get_cat_name($catid); } $tagnames = array(); $tags = wp_get_post_tags($entry['ID']); if (!empty($tags)) { foreach ($tags as $tag) { $tagnames[] = $tag->name; } $tagnames = implode(', ', $tagnames); } else { $tagnames = ''; } $post = get_extended($entry['post_content']); $link = post_permalink($entry['ID']); // Get the post author info. $author = get_userdata($entry['post_author']); $author_email = $author->user_email; $allow_comments = 'open' == $entry['comment_status'] ? 1 : 0; $allow_pings = 'open' == $entry['ping_status'] ? 1 : 0; // Consider future posts as published if ($entry['post_status'] === 'future') { $entry['post_status'] = 'publish'; } // Get post format $post_format = get_post_format($entry['ID']); if (empty($post_format)) { $post_format = 'standard'; } $struct[] = array('dateCreated' => $post_date, 'userid' => $entry['post_author'], 'postid' => (string) $entry['ID'], 'description' => $post['main'], 'title' => $entry['post_title'], 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'mt_excerpt' => $entry['post_excerpt'], 'mt_text_more' => $post['extended'], 'wp_more_text' => $post['more_text'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $entry['post_name'], 'wp_password' => $entry['post_password'], 'wp_author_id' => (string) $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => $post_date_gmt, 'post_status' => $entry['post_status'], 'custom_fields' => $wp_xmlrpc_server->get_custom_fields($entry['ID']), 'wp_post_format' => $post_format, 'date_modified' => $post_modified, 'date_modified_gmt' => $post_modified_gmt, 'sticky' => $entry['post_type'] === 'post' && is_sticky($entry['ID'])); //get user thumbnail $avatar = get_gravatar_url($author_email); $entry_index = count($struct) - 1; //get assignment thumbnail $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($entry['ID']), 'thumbnail'); $url = $thumb['0']; $struct[$entry_index]['user_thumbnail'] = $avatar; $struct[$entry_index]['wp_post_thumbnail'] = $url; //get_post_thumbnail_id( $entry['ID'] ); } $recent_posts = array(); for ($j = 0; $j < count($struct); $j++) { array_push($recent_posts, $struct[$j]); } return $recent_posts; }
$votes_page_size = 20; $votes_offset=($votes_page-1)*$votes_page_size; $votes = $db->get_results("SELECT vote_user_id, vote_ip, user_email, user_login, date_format(vote_date,'%d/%m %T') as vote_date FROM votes, users WHERE vote_type='links' and vote_link_id=".$link_id." AND vote_user_id > 0 AND vote_value > 0 AND user_id = vote_user_id ORDER BY vote_date LIMIT $votes_offset,$votes_page_size"); if (!$votes) die; $votes_users = $db->get_var("SELECT count(*) FROM votes WHERE vote_type='links' and vote_link_id=".$link_id." AND vote_user_id!=0 AND vote_value > 0"); $votes_anon = $db->get_var("SELECT count(*) FROM votes WHERE vote_type='links' and vote_link_id=".$link_id." AND vote_user_id=0 AND vote_value > 0"); $votes_negatives = $db->get_var("SELECT count(*) FROM votes WHERE vote_type='links' and vote_link_id=".$link_id." AND vote_value < 0"); echo '<div id="voters-list">'; foreach ( $votes as $vote ){ echo '<div class="item">'; echo '<a href="user.php?login='******'" title="'.$vote->vote_date.'">'; echo '<img src="'.get_gravatar_url($vote->user_email, 20).'" width="20" height="20" alt="'.$vote->user_login.'"/>'; echo $vote->user_login.'</a>'; echo '</div>'; } echo "</div>\n"; echo '<div class="news-details">'; echo _('votos usuarios'). ': '.$votes_users.', '; echo _('votos anónimos'). ': '.$votes_anon.', '; echo _('votos negativos').': '. $votes_negatives; echo '</div>'; do_shakers_pages($votes_users, $votes_page, $votes_page_size); function do_shakers_pages($total, $current, $page_size=20) {
<?php echo get_sympal_pager_header($pager, $content); ?> <?php foreach ($content as $content) { ?> <div class="row"> <h3><?php echo link_to($content, $content->getRoute()); ?> </h3> <?php echo image_tag(get_gravatar_url($content->CreatedBy->getEmailAddress()), 'align=right'); ?> <p class="date"> <strong> Posted by <?php echo $content->CreatedBy->getName(); ?> on <?php echo format_datetime($content->date_published, sfSympalConfig::get('date_published_format')); ?> </strong> </p> <p class="teaser"><?php echo $content->getRecord()->getTeaser(); ?>
//add to users array and ignore if already added $displayed_users = array(); foreach ($messages as $message) { $message_author = get_post_meta($message->ID, 'author', true); $message_recipient = get_post_meta($message->ID, 'recipient', true); $author = get_userdata($message_author); //message_author must equal message->post_author $recipient = get_userdata($message_recipient); if ($current_user->ID != $message_author) { //current user is the recipient, show author avatar $display_gravatar = get_gravatar_url($author->user_email); $display_name = $author->user_login; $display_id = $author->ID; } else { //current user is author, so get recipient instead $display_gravatar = get_gravatar_url($recipient->user_email); $display_name = $recipient->user_login; $display_id = $recipient->ID; } //check if user is already added if (!in_array($display_name, $displayed_users)) { print '<tr class="user_row" user_id="' . $display_id . '" title="' . $display_name . '" gravatar="' . $display_gravatar . '"> <th scope="row"><img class="user_row" src="' . $display_gravatar . '"></th> <td><span class="inbox_name">' . $display_name . '</span></br> <span class="inbox_text">' . $message->post_title . '</span> </tr>'; //add user to array of displayed $displayed_users[] = $display_name; } } ?>
function print_summary($type='full') { global $current_user, $current_user, $globals; if(!$this->read) return; if($this->is_votable()) { $this->voted = $this->vote_exists($current_user->user_id); } $url = $this->url; $title_short = wordwrap($this->title, 36, " ", 1); echo '<div class="news-summary" id="news-'.$this->id.'">'; echo '<div class="news-body">'; if ($type != 'preview' && !empty($this->title)) { $this->print_shake_box($votes_enabled); } echo '<h3 id="title'.$this->id.'">'; echo '<a href="'.htmlspecialchars($url).'">'. $title_short. '</a>'; echo '</h3>'; echo '<div class="news-submitted">'; if ($type != 'short') echo '<a href="user.php?login='******'" title="'.$this->username.'"><img src="'.get_gravatar_url($this->email, 25).'" width="25" height="25" alt="icon gravatar.com" /></a>'; echo '<strong>'.htmlentities(preg_replace('/^http:\/\//', '', txt_shorter($this->url))).'</strong>'."<br />\n"; if ( $globals['interface'] == "monouser" ) echo _('enviado hace').txt_time_diff($this->date); else echo _('enviado por').' <a href="user.php?login='******'&view=history"><strong>'.$this->username.'</strong></a> '._('hace').txt_time_diff($this->date); if($this->status == 'published') echo ', ' ._('publicado hace').txt_time_diff($this->published_date); echo "</div>\n"; if($type=='full' || $type=='preview') { if ( $globals['interface'] == "monouser" ) echo '<div class="news-body-text">'.trim($this->content).'</div>'; else echo '<div class="news-body-text">'.text_to_html($this->content).'</div>'; } if (!empty($this->tags)) { echo '<div class="news-tags">'; echo '<strong><a href="cloud.php" title="'._('nube').'">'._('etiquetas').'</a></strong>:'; $tags_array = explode(",", $this->tags); $tags_counter = 0; foreach ($tags_array as $tag_item) { $tag_item=trim($tag_item); $tag_url = urlencode($tag_item); if ($tags_counter > 0) echo ','; echo ' <a href="index.php?search=tag:'.$tag_url.'">'.$tag_item.'</a>'; $tags_counter++; } echo '</div>'; } echo '<div class="news-details">'; if ($globals['comments']) { $ncomments = $this->comments(); if($ncomments > 0) { $comments_mess = $ncomments . ' ' . _('comentarios'); $comment_class = "comments"; } else { $comments_mess = _('sin comentarios'); $comment_class = "comments_no"; } if(empty($globals['link_id'])) echo '<a href="story.php?id='.$this->id.'" class="tool '.$comment_class.'">'.$comments_mess. '</a>'; else echo '<span class="tool comments">'.$comments_mess. '</span>'; } /* if (!empty($this->tags)) { echo '<span class="tool"><a href="cloud.php" title="'._('nube').'">'._('etiquetas').'</a>:'; $tags_array = explode(",", $this->tags); $tags_counter = 0; foreach ($tags_array as $tag_item) { $tag_item=trim($tag_item); $tag_url = urlencode($tag_item); if ($tags_counter > 0) echo ','; echo ' <a href="index.php?search=tag:'.$tag_url.'">'.$tag_item.'</a>'; $tags_counter++; } echo '</span>'; } */ echo '<span class="tool">'._('categoría'). ': <a href="./index.php?category='.$this->category.'" title="'._('categoría').'">'.$this->category_name().'</a></span>'; // Allow to modify it if ($type != 'preview' && $this->is_editable()) { echo ' <span class="tool"><a href="editlink.php?id='.$this->id.'">'._('editar').'</a></span> '; } if($current_user->user_id > 0 && $this->status!='published' && $this->votes > 0 && $type != 'preview' && $current_user->user_karma > 5 && $this->votes_enabled /*&& $this->author != $current_user->user_id*/) { $this->print_problem_form(); } elseif ($current_user->user_level == 'god') { $this->print_problem_form(); } echo '</div>'."\n"; echo '</div></div>'."\n"; }
function do_profile() { global $user, $current_user, $login; // echo '<div id="contents-wide">'; echo '<fieldset><legend>'; echo _('información personal'); if($login===$current_user->user_login) { echo ' (<a href="profile.php">'._('modificar').'</a>)'; } elseif ($current_user->user_level == 'god') { echo ' (<a href="profile.php?login='******'">'._('modificar').'</a>)'; } echo '</legend>'; echo '<img class="sub-nav-img" src="'.get_gravatar_url($user->email, 80, false).'" width="80" height="80" alt="'.$user->username.'" title="gravatar.com" />'; echo '<dl>'; if(!empty($user->username)) { echo '<dt>'._('usuario').':</dt><dd>'.$user->username; if ($login===$current_user->user_login || $current_user->user_level == 'god') echo " (<em>$user->level</em>)"; echo '</dd>'; } if(!empty($user->names)) echo '<dt>'._('nombre').':</dt><dd>'.$user->names.'</dd>'; if(!empty($user->url)) echo '<dt>'._('sitio web').':</dt><dd><a href="'.$user->url.'">'.$user->url.'</a></dd>'; echo '<dt>'._('desde').':</dt><dd>'.get_date($user->date).'</dd>'; if(!empty($user->karma)) echo '<dt>'._('karma').':</dt><dd>'.$user->karma.'</dd>'; echo '</dl></fieldset>'; $user->all_stats(); echo '<fieldset><legend>'._('estadísticas de meneos').'</legend><dl>'; echo '<dt>'._('noticias enviadas').':</dt><dd>'.$user->total_links.'</dd>'; echo '<dt>'._('noticias publicadas').':</dt><dd>'.$user->published_links.'</dd>'; echo '<dt>'._('comentarios').':</dt><dd>'.$user->total_comments.'</dd>'; echo '<dt>'._('número de votos').':</dt><dd>'.$user->total_votes.'</dd>'; echo '<dt>'._('votos de publicadas').':</dt><dd>'.$user->published_votes.'</dd>'; echo '</dl></fieldset>'; // echo '</div>'; }
/** * Template Name: Plantilla Membres * * @package wp-softcatala */ //JS and Styles related to the page //Template initialization $title = 'Membres - Softcatalà'; $description = 'Membres, col·laboradors, gent de Softcatalà'; if (!empty($wp_query->query_vars['author'])) { $template = array('single-author.twig'); $author = new TimberUser($wp_query->query_vars['author']); $context_holder['author'] = $author; $context_holder['author_role'] = get_user_role($author); $context_holder['author_content'] = apply_filters('the_content', $author->{'wpcf-descripcio_activitat'}); $context_holder['author_image'] = get_gravatar_url($author->user_email); $context_holder['content_title'] = 'Publicades per ' . $author->name(); $title = $author->name() . ' - Softcatalà'; $description = $author->description(); $projectes_ids = get_user_meta($author->ID, 'projectes', true); if ($projectes_ids) { $context_holder['projectes'] = array_map(function ($projecte_id) { $_projecte = get_post($projecte_id); return array('link' => get_post_permalink($projecte_id), 'title' => $_projecte->post_title); }, $projectes_ids); } } else { $template = array('archive-author.twig'); $post = new TimberPost(); $context_holder['post'] = $post; //Show only active members
$displayed_messages = 0; //track last message from other user $last_message = 0; foreach ($messages as $message) { /* * Loop through messages * Check if current user is author or recipient * Check if requested user is author or recipient */ if ($displayed_messages < 25) { $message_author = get_post_meta($message->ID, 'author', true); $message_recipient = get_post_meta($message->ID, 'recipient', true); if ($message_recipient == $user_id || $message_author == $user_id) { //show message $author = get_userdata($message->post_author); $display_gravatar = get_gravatar_url($author->user_email); $display_name = $author->user_login; print '<div class="chat chat-' . $message->ID . ' rounded"> <span class="gravatar"><img src="' . $display_gravatar . '" width="23" height="23" onload="this.style.visibility=\'visible\'" /></span> <span class="author">' . $display_name . ':</span><span class="text">' . $message->post_title . '</span> <span class="time">' . $message->post_date . '</span></div>'; $displayed_messages++; if ($current_user->ID != $message_author) { $last_message = $message->ID; } } } else { //we don't want to go through all messages break; } }
echo '<a href="'.$_SERVER['PHP_SELF'].'?sortby='.$i.'">'.$items[$i].'</a>'; echo '</th>'; } echo '<th class="short">karma</th>'; echo '</tr>'; $user = new User; $rows = $db->get_var("SELECT count(*) as count $from_where"); $users = $db->get_results("$select $from_where $order_by LIMIT $offset,$page_size"); if ($users) { foreach($users as $dbuser) { $user->id=$dbuser->user_id; $user->read(); $user->all_stats(); echo '<tr>'; echo '<td><a href="user.php?login='******'"><img src="'.get_gravatar_url($user->email, 20).'" width="20" height="20" alt="icon gravatar.com" />'.$user->username.'</a></td>'; echo '<td class="short">'.$user->total_links.'</td>'; if($user->total_links>0) echo '<td class="short">'.$user->published_links.' ('.intval($user->published_links/$user->total_links*100).'%)</td>'; else echo '<td class="short">'.$user->published_links.' (-)</td>'; echo '<td class="short">'.$user->total_comments.'</td>'; echo '<td class="short">'.$user->total_votes.'</td>'; if($user->total_votes>0) echo '<td class="short">'.$user->published_votes.' ('.intval($user->published_votes/$user->total_votes*100).'%)</td>'; else echo '<td class="short">'.$user->published_votes.' (-)</td>'; echo '<td class="short">'.$user->karma.'</td>'; echo '</tr>'; } }
echo link_to_sympal_comment_website($comment); ?> . <?php } else { ?> <?php echo $comment['author_name']; ?> . <?php } ?> </small> <?php echo image_tag(get_gravatar_url($comment['author_email_address']), 'align=right'); ?> <?php echo sfSympalMarkdownRenderer::convertToHtml($comment['body']); ?> </li> <?php } ?> </ul> <?php } else { ?> <h3>No Comments Created. Be the first to comment.</h3> <?php
function wp_gcm_chat_dashboard_widget_function() { ?> <div id="chatContainer"> <?php $current_user = wp_get_current_user(); $gravatar_link = get_gravatar_url($current_user->user_email); ?> <div id="chatTopBar" class="rounded"> <span> <img id="user_thumb" src="<?php echo $gravatar_link; ?> " width="23" height="23" /> <span class="name"> <?php echo $current_user->user_nicename; ?> </span> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <img id="users-button" src="<?php echo plugins_url('../assets/img/users.png', __FILE__); ?> "> <div id="users_dialog" style="display: none;"> <div id="chatUsers" class="rounded"> <?php $blog_users = get_users('blog_id=1&orderby=nicename'); foreach ($blog_users as $user) { if ($user->user_nicename != $current_user->user_nicename) { print '<div class="user_thumb" user_id="' . $user->ID . '" title="' . $user->user_nicename . '" gravatar="' . get_gravatar_url($user->user_email) . '"><img src="' . get_gravatar_url($user->user_email) . '" width="30" height="30" onload="this.style.visibility=\'visible\'" /></div>'; } } ?> <p class="count"><a href="<?php print get_admin_url(); ?> /users.php"><?php print count($blog_users) - 1; ?> Total Users</a></p> </div> </div> <img id="inbox-button" src="<?php echo plugins_url('../assets/img/inbox.png', __FILE__); ?> "> </span> </div> <div id="chatRecipient"></div> <div id="chatLineHolderContainer"> <div id="chatLineHolder"></div> </div> <div id="inbox"> </div> <div id="chatBottomBar" class="rounded"> <div class="tip"></div> <div id="chatForm" author_id="<?php echo $current_user->ID; ?> " author="<?php echo $current_user->user_nicename; ?> " gravatar="<?php echo $gravatar_link; ?> "> <input id="chatText" name="chatText" class="rounded" maxlength="255" /> <input id="submitChat" type="submit" class="blueButton" value="Send" /> </div> </div> </div> <?php }