本文整理汇总了PHP中get_usernumposts函数的典型用法代码示例。如果您正苦于以下问题:PHP get_usernumposts函数的具体用法?PHP get_usernumposts怎么用?PHP get_usernumposts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_usernumposts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: constantTest
protected function constantTest()
{
$time = microtime(true);
for ($i = 0; $i < $this->runNumber; $i++) {
$user_id = 1;
$post_id_1 = get_usernumposts($user_id);
}
$time = microtime(true) - $time;
$this->enterResult($time);
}
示例2: wpu_homelink
function wpu_homelink($default)
{
global $wpSettings, $user_ID, $wpu_done_head, $altered_link, $wp_version, $wputab_altered_link;
if ($wpu_done_head && !$altered_link || $default == "wpu-activate-theme") {
$wpuConnSettings = get_settings('wputd_connection');
if (!empty($wpuConnSettings['blogs'])) {
$altered_link = TRUE;
// prevents this from becoming recursive -- we only want to do it once anyway
if (!is_admin()) {
$authorID = wpu_get_author();
} else {
$authorID = $user_ID;
}
if (!empty($authorID)) {
if (get_usernumposts($authorID)) {
// only change URL if author has posts
if ((double) $wp_version >= 2.1) {
//WP >= 2.1 branch
$blog_url = get_author_posts_url($authorID);
} else {
$blog_url = get_author_link(false, $authorID, '');
}
$blog_url = $blog_url[strlen($blog_url) - 1] == "/" ? substr($blog_url, 0, -1) : $blog_url;
//kill trailing slash
}
if (empty($blog_url)) {
$blog_url = $default;
}
return $blog_url;
}
}
}
return $default;
}
示例3: get_usernumposts
</strong> <?php
echo $profiledata->ID;
?>
| <strong><?php
echo _LANG_WPF_SUBT_LEVEL;
?>
</strong>
<?php
echo $profiledata->user_level;
?>
| <strong><?php
echo _LANG_WPF_SUBT_POSTS;
?>
</strong>
<?php
$posts = get_usernumposts($user_ID);
echo $posts;
?>
| <strong><?php
echo _LANG_WPF_SUBT_LOGIN;
?>
</strong> <?php
echo $profiledata->user_login;
?>
</p>
<style type="text/css" media="screen">
th { text-align: right; }
</style>
<table width="99%" border="0" cellspacing="2" cellpadding="3">
<tr>
<th width="15%" scope="row"><?php
示例4: get_author_posts_url
</a></div>
<div class="camper_name"><a href="<?php
echo get_author_posts_url($usr->ID);
?>
"><?php
the_author_meta('first_name', $usr->ID);
?>
<?php
the_author_meta('last_name', $usr->ID);
?>
</a></div>
<div class="camper_posts"><a href="<?php
echo get_author_posts_url($usr->ID);
?>
">Posts (<?php
echo get_usernumposts($usr->ID);
?>
)</a></div>
</div>
<?php
}
?>
</div>
<?php
wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
?>
<?php
edit_post_link(__('Edit this entry', 'arclite'));
?>
</div>
示例5: get_the_author_posts
/**
* Retrieve the number of posts by the author of the current post.
*
* @since 1.5
* @uses $post The current post in the Loop's DB object.
* @uses get_usernumposts()
* @return int The number of posts by the author.
*/
function get_the_author_posts()
{
global $post;
return get_usernumposts($post->post_author);
}
示例6: user_row
function user_row($user_object, $style = '', $role = '')
{
global $wp_roles;
$current_user = wp_get_current_user();
if (!(is_object($user_object) && is_a($user_object, 'WP_User'))) {
$user_object = new WP_User((int) $user_object);
}
$email = $user_object->user_email;
$url = $user_object->user_url;
$short_url = str_replace('http://', '', $url);
$short_url = str_replace('www.', '', $short_url);
if ('/' == substr($short_url, -1)) {
$short_url = substr($short_url, 0, -1);
}
if (strlen($short_url) > 35) {
$short_url = substr($short_url, 0, 32) . '...';
}
$numposts = get_usernumposts($user_object->ID);
if (current_user_can('edit_user', $user_object->ID)) {
if ($current_user->ID == $user_object->ID) {
$edit = 'profile.php';
} else {
$edit = clean_url(add_query_arg('wp_http_referer', urlencode(clean_url(stripslashes($_SERVER['REQUEST_URI']))), "user-edit.php?user_id={$user_object->ID}"));
}
$edit = "<a href=\"{$edit}\">{$user_object->user_login}</a>";
} else {
$edit = $user_object->user_login;
}
$role_name = translate_with_context($wp_roles->role_names[$role]);
$r = "<tr id='user-{$user_object->ID}'{$style}>\n\t\t<th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role}' value='{$user_object->ID}' /></th>\n\t\t<td><strong>{$edit}</strong></td>\n\t\t<td>{$user_object->first_name} {$user_object->last_name}</td>\n\t\t<td><a href='mailto:{$email}' title='" . sprintf(__('e-mail: %s'), $email) . "'>{$email}</a></td>\n\t\t<td>{$role_name}</td>";
$r .= "\n\t\t<td class='num'>";
if ($numposts > 0) {
$r .= "<a href='edit.php?author={$user_object->ID}' title='" . __('View posts by this author') . "' class='edit'>";
$r .= $numposts;
$r .= '</a>';
} else {
$r .= 0;
}
$r .= "</td>\n\t</tr>";
return $r;
}
示例7: list_authors
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
global $wpdb;
$query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name";
$authors = $wpdb->get_results($query);
foreach ( $authors as $author ) {
$author = get_userdata( $author->ID );
$posts = get_usernumposts($author->ID);
$name = $author->nickname;
if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
$name = "$author->first_name $author->last_name";
if ( !($posts == 0 && $hide_empty) )
echo "<li>";
if ( $posts == 0 ) {
if ( !$hide_empty )
$link = $name;
} else {
$link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) {
$link .= ' ';
if (empty($feed_image))
$link .= '(';
$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
if ( !empty($feed) ) {
$title = ' title="' . $feed . '"';
$alt = ' alt="' . $feed . '"';
$name = $feed;
$link .= $title;
}
$link .= '>';
if ( !empty($feed_image) )
$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
else
$link .= $name;
$link .= '</a>';
if ( empty($feed_image) )
$link .= ')';
}
if ( $optioncount )
$link .= ' ('. $posts . ')';
}
if ( !($posts == 0 && $hide_empty) )
echo "$link</li>";
}
}
示例8: usermap_main
function usermap_main()
{
global $wpuAbs, $phpEx, $phpbb_root_path, $wpSettings, $db, $template;
// NUMBER OF RESULTS PER PAGE -- COULD ADJUST THIS FOR LARGE USERBASES
$numPerPage = $numResults = (int) request_var('wpumapperpage', 50);
//Get integration settings
$wpSettings = get_integration_settings();
if ($wpSettings == FALSE || $wpSettings['wpPath'] == '') {
$wpuAbs->err_msg(GENERAL_ERROR, $wpuAbs->lang('WP_DBErr_Gen'), $wpuAbs->lang('L_WP_NO_SETTINGS'), __LINE__, __FILE__, $sql);
}
$this->page_title = 'L_MAP_TITLE';
$this->tpl_name = 'acp_wp_united';
// set the page section to show
$template->assign_block_vars('switch_usermap_main', array());
// Eventually this will be in a dropdown.
$action = request_var('mapaction', '');
if ($action == $wpuAbs->lang('Map_Change_PerPage')) {
$wpStart = (int) request_var('oldstart', 0);
} else {
$wpStart = (int) request_var('start', 0);
}
$thisEnd = $nextStart = $wpStart + $numResults;
// Enter WordPress and pull user data
global $wpdb, $wpUtdInt;
require_once $phpbb_root_path . 'wp-united/wp-integration-class.' . $phpEx;
$wpUtdInt = WPU_Integration::getInstance(get_defined_vars());
define('USE_THEMES', FALSE);
if ($wpUtdInt->can_connect_to_wp()) {
$wpUtdInt->enter_wp_integration();
eval($wpUtdInt->exec());
$sql = "SELECT count(*) AS total\n\t\t\t\tFROM {$wpdb->users} \n\t\t\t\tWHERE {$wpdb->users}.user_login <> 'admin'";
$countEntries = $wpdb->get_results($sql);
$numWpResults = $countEntries[0]->total;
//$thisEnd = ($thisEnd > $numWpResults) ? $numWpResults : $thisEnd
$numPages = ceil($numWpResults / $numResults);
$curPage = ceil($wpStart / $numResults + 1);
$sql = "SELECT ID, user_login, user_nicename \n\t\t\t\tFROM {$wpdb->users}\n\t\t\t\tWHERE user_login<>'admin'\n\t\t\t\tORDER BY user_login\n\t\t\t\tLIMIT {$wpStart}, {$thisEnd}";
//execute sql
$results = $wpdb->get_results($sql);
if (count($results) > 0) {
//output table with results
if ($numPages > 1) {
$template->assign_block_vars('switch_usermap_main.switch_multipage', array());
}
$itn = 0;
$x = 2;
foreach ((array) $results as $result) {
$optCre = '';
$posts = get_usernumposts($result->ID);
//TODO: show number of comments
if (empty($result->ID)) {
$wpuAbs->err_msg(GENERAL_ERROR, 'No WordPress ID!', 'No ID error!', __LINE__, __FILE__, $sql);
}
$phpBBMappedName = get_usermeta($result->ID, 'phpbb_userLogin');
if (empty($phpBBMappedName)) {
$phpBBMappedName = $result->user_login;
}
$wpUtdInt->switch_db('TO_P');
$pUsername = '';
$pID = '';
$class = '';
$pStatus = $wpuAbs->lang('L_MAP_NOT_INTEGRATED');
$intText = $wpuAbs->lang('L_MAP_INTEGRATE');
$selInt = '';
$selBrk = '';
$selDel = '';
$alreadyID = '';
$alreadyUN = '';
$mustBrk = 'FALSE';
//First let's see if they are already integrated
$sql = "SELECT username, user_id FROM " . USERS_TABLE . " WHERE user_wpuint_id = '{$result->ID}'";
if ($pFirstResults = $db->sql_query($sql)) {
$numResults = 0;
$pRes = '';
if ($pResNew = $db->sql_fetchrow($pFirstResults)) {
//We found an integration ID...
$ctr = 1;
while ($pResNew) {
$pID .= $numResults > 1 ? ', ' . $pResNew['user_id'] : $pResNew['user_id'];
$pUsername .= $numResults > 1 ? ', ' . $pResNew['username'] : $pResNew['username'];
$pRes = $pResNew;
$pResNew = $db->sql_fetchrow($pFirstResults);
$numResults++;
}
if ($numResults > 1) {
$pStatus = $wpuAbs->lang('L_MAP_ERROR_MULTIACCTS');
$breakOrLeave = $wpuAbs->lang('L_MAP_BRK_MULTI');
$selBrk = 'selected="selected"';
$mustBrk = 'TRUE';
$class = "mustbrk";
} else {
$pStatus = $wpuAbs->lang('L_MAP_ALREADYINT');
$breakOrLeave = $wpuAbs->lang('L_MAP_BRK');
$selInt = 'selected="selected"';
$intText = $wpuAbs->lang('L_MAP_LEAVE_INT');
$alreadyID = $pRes['user_id'];
$alreadyUN = $pRes['username'];
$class = "alreadyint";
}
} else {
//.........这里部分代码省略.........
示例9: authorPostsLink
/**
* Creates the link to the author pages.
*
* @param $user Author object.
* @return string Link to author pages.
*/
private function authorPostsLink($user)
{
$count = get_usernumposts($user->ID);
$link = '';
if (0 < $count) {
global $wp_rewrite;
$link = $wp_rewrite->get_author_permastruct();
if (empty($link)) {
$file = get_option('home') . '/';
$link = $file . '?author=' . $user->ID;
} else {
$link = str_replace('%author%', $user->user_login, $link);
$link = get_option('home') . trailingslashit($link);
}
}
return $link;
}
示例10: list_authors2
function list_authors2($optioncount = false, $exclude_admin = true, $idmode = '', $hide_empty = true, $feed = '', $feed_image = '', $echo = true)
{
$list_authors2 = '';
if ($exclude_admin) {
$criteria = new Criteria('ID', 1, '<>');
} else {
$criteria = new CriteriaCompo();
}
$criteria->setSort('user_nickname');
$userHandler =& wp_handler('User');
$userObjects =& $userHandler->getObjects($criteria);
foreach ($userObjects as $userObject) {
$author =& $userObject->exportWpObject($idmode);
$name = htmlspecialchars(get_author_name($author->ID, $idmode), ENT_QUOTES);
$posts = get_usernumposts($author->ID);
if (!($posts == 0 && $hide_empty)) {
$list_authors2 .= "<li>";
}
if ($posts == 0) {
if (!$hide_empty) {
$list_authors2 .= $name;
}
} else {
$link = '<a href="' . get_author_link(0, $author->ID, $author->user_login) . '" title="' . sprintf("Posts by %s", $name) . '">' . $name . '</a>';
if (!empty($feed_image) || !empty($feed)) {
$link .= ' ';
if (empty($feed_image)) {
$link .= '(';
}
$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_login) . '"';
if (!empty($feed)) {
$title = ' title="' . $feed . '"';
$alt = ' alt="' . $feed . '"';
$name = $feed;
$link .= $title;
}
$link .= '>';
if (!empty($feed_image)) {
$link .= "<img src=\"{$feed_image}\" border=\"0\" align=\"bottom\"{$alt}{$title}" . ' />';
} else {
$link .= $name;
}
$link .= '</a>';
if (empty($feed_image)) {
$link .= ')';
}
}
if ($optioncount) {
$link .= ' (' . $posts . ')';
}
}
if (!($posts == 0 && $hide_empty)) {
$list_authors2 .= "{$link}</li>";
}
}
return _echo($list_authors2, $echo);
}
示例11: _e
}
?>
</div>
<div class="clear"></div>
<div class="userpage-posts">
<?php
if (have_posts()) {
?>
<h3><?php
_e('Posts by', 'comicpress');
?>
<?php
echo $authorname;
?>
(<?php
echo get_usernumposts($curauth->ID);
?>
) ¬</h3>
<?php
// this area is a loop that shows what posts the person has done.
?>
<ol>
<li><table class="month-table">
<?php
while (have_posts()) {
the_post();
?>
<tr><td class="archive-date" align="right"><?php
the_time('M j, Y');
?>
</td><td class="archive-title"><a href="<?php
示例12: subscriptions_link
function subscriptions_link($content)
{
// assuming you have created a page/post entitled 'debug'
if ($GLOBALS['post']->post_name == 'inscricao') {
if (get_usernumposts($post->post_author)) {
$subscriptions_link = '<a href="#">Visualizar inscrições anteriores</a>';
} else {
$subscriptions_link = '';
}
// $subscriptions_link = '<a href="#">Visualizar inscrições anteriores</a>';
$content .= $subscriptions_link;
}
// otherwise returns the database content
return $content;
}
示例13: _e
<div class="wrap">
<h2><?php _e('Edit User'); ?></h2>
<form name="edituser" id="edituser" action="user-edit.php" method="post">
<table width="99%" border="0" cellspacing="2" cellpadding="3">
<tr>
<th width="33%" scope="row"><?php _e('Login:') ?></th>
<td width="73%"><input type="text" name="new_user_login" id="new_user_login" value="<?php echo $edituser->user_login; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Level:') ?></th>
<td><?php echo $edituser->user_level; ?></td>
</tr>
<tr>
<th scope="row"><?php _e('Posts:') ?></th>
<td><?php echo get_usernumposts($edituser->ID); ?></td>
</tr>
<?php if ( '0000-00-00 00:00:00' != $edituser->user_registered ) { ?>
<tr>
<th scope="row"><?php _e('Registered on:') ?></th>
<td><?php echo substr($edituser->user_registered, 0, 11); ?></td>
</tr>
<?php } ?>
<tr>
<th scope="row"><?php _e('First name:') ?></th>
<td><input type="text" name="new_firstname" id="new_firstname" value="<?php echo $edituser->user_firstname ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Last name:') ?></th>
<td><input type="text" name="new_lastname" id="new_lastname2" value="<?php echo $edituser->user_lastname ?>" /></td>
</tr>
示例14: user_row
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $user_object
* @param unknown_type $style
* @param unknown_type $role
* @return unknown
*/
function user_row($user_object, $style = '', $role = '')
{
global $wp_roles;
$current_user = wp_get_current_user();
if (!(is_object($user_object) && is_a($user_object, 'WP_User'))) {
$user_object = new WP_User((int) $user_object);
}
$user_object = sanitize_user_object($user_object, 'display');
$email = $user_object->user_email;
$url = $user_object->user_url;
$short_url = str_replace('http://', '', $url);
$short_url = str_replace('www.', '', $short_url);
if ('/' == substr($short_url, -1)) {
$short_url = substr($short_url, 0, -1);
}
if (strlen($short_url) > 35) {
$short_url = substr($short_url, 0, 32) . '...';
}
$numposts = get_usernumposts($user_object->ID);
$checkbox = '';
// Check if the user for this row is editable
if (current_user_can('edit_user', $user_object->ID)) {
// Set up the user editing link
// TODO: make profile/user-edit determination a seperate function
if ($current_user->ID == $user_object->ID) {
$edit_link = 'profile.php';
} else {
$edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(esc_url(stripslashes($_SERVER['REQUEST_URI']))), "user-edit.php?user_id={$user_object->ID}"));
}
$edit = "<strong><a href=\"{$edit_link}\">{$user_object->user_login}</a></strong><br />";
// Set up the hover actions for this user
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
if ($current_user->ID != $user_object->ID) {
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&user={$user_object->ID}", 'bulk-users') . "'>" . __('Delete') . "</a>";
}
$actions = apply_filters('user_row_actions', $actions, $user_object);
$action_count = count($actions);
$i = 0;
$edit .= '<div class="row-actions">';
foreach ($actions as $action => $link) {
++$i;
$i == $action_count ? $sep = '' : ($sep = ' | ');
$edit .= "<span class='{$action}'>{$link}{$sep}</span>";
}
$edit .= '</div>';
// Set up the checkbox (because the user is editable, otherwise its empty)
$checkbox = "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role}' value='{$user_object->ID}' />";
} else {
$edit = '<strong>' . $user_object->user_login . '</strong>';
}
$role_name = isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role]) : __('None');
$r = "<tr id='user-{$user_object->ID}'{$style}>";
$columns = get_column_headers('users');
$hidden = get_hidden_columns('users');
$avatar = get_avatar($user_object->ID, 32);
foreach ($columns as $column_name => $column_display_name) {
$class = "class=\"{$column_name} column-{$column_name}\"";
$style = '';
if (in_array($column_name, $hidden)) {
$style = ' style="display:none;"';
}
$attributes = "{$class}{$style}";
switch ($column_name) {
case 'cb':
$r .= "<th scope='row' class='check-column'>{$checkbox}</th>";
break;
case 'username':
$r .= "<td {$attributes}>{$avatar} {$edit}</td>";
break;
case 'name':
$r .= "<td {$attributes}>{$user_object->first_name} {$user_object->last_name}</td>";
break;
case 'email':
$r .= "<td {$attributes}><a href='mailto:{$email}' title='" . sprintf(__('e-mail: %s'), $email) . "'>{$email}</a></td>";
break;
case 'role':
$r .= "<td {$attributes}>{$role_name}</td>";
break;
case 'posts':
$attributes = 'class="posts column-posts num"' . $style;
$r .= "<td {$attributes}>";
if ($numposts > 0) {
$r .= "<a href='edit.php?author={$user_object->ID}' title='" . __('View posts by this author') . "' class='edit'>";
$r .= $numposts;
$r .= '</a>';
} else {
$r .= 0;
}
$r .= "</td>";
//.........这里部分代码省略.........
示例15: COUNT
<p class="bio">
I love everything simple, real and beautiful. I do a bit web design, web<br/>
development, technical writing, translating and marketing.
</p>
<p class="bio">Vancouver<span class="divider">·</span>ilite.me</p>
</div>
<div id="board" align="left">
<?php
global $wpdb;
$user_id = $post->post_author;
//change this if not in a std post loop
$where = 'WHERE comment_approved = 1 AND user_id = ' . $user_id;
$comment_count = $wpdb->get_var("SELECT COUNT( * ) AS total\n\t\t\t\t\t\t\tFROM {$wpdb->comments}\n\t\t\t\t\t\t\t{$where}\n\t\t\t\t\t\t");
$user = get_userdata($user_id);
$post_count = get_usernumposts($user->ID);
echo '<ul><li><span class="num">' . $post_count . '</span><br/>ARTICLES</li><li><span class="num">' . $comment_count . '</span><br/>COMMENTS</li>';
?>
<li><span class="num">2009</span><br/>EVER SINCE</li>
</ul>
<a class="button" href="<?php
bloginfo('url');
?>
/blog/">Visit my blog</a>
</div>
</div>
<div id="footer" class="container">
<ul>
<li>© <?php
echo date("Y");