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);
 }
Exemple #2
0
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;
}
</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 
Exemple #4
0
</a></div>
					<div class="camper_name"><a href="<?php 
            echo get_author_posts_url($usr->ID);
            ?>
"><?php 
            the_author_meta('first_name', $usr->ID);
            ?>
&nbsp;<?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>
/**
 * 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);
}
Exemple #6
0
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;
}
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>";
	}
}
Exemple #8
0
 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 {
                         //No Integration ID... so let's search for a match
                         //User may want to create a phpBB user
                         $optCre = '<option value="Cre">' . $wpuAbs->lang('L_MAP_CREATEP') . '</option>';
                         if (!empty($phpBBMappedName)) {
                             $sql = "SELECT username, user_id, user_wpuint_id FROM " . USERS_TABLE . " WHERE username = '******'\n\t\t\t\t\t\t\t\t\t\tLIMIT 1";
                             if (!($pResults = $db->sql_query($sql))) {
                                 $wpuAbs->err_msg(GENERAL_ERROR, $wpuAbs->lang('WP_DBErr_Retrieve'), $wpuAbs->lang('L_MAP_CANTCONNECTP'), __LINE__, __FILE__, $sql);
                             }
                             if ($pResults = $db->sql_fetchrow($pResults)) {
                                 //OK, so we found a username match... but show only if they're not already integrated to another acct.
                                 if (empty($pResults['user_wpuint_id'])) {
                                     if (!empty($pResults['username']) && !empty($pResults['user_id'])) {
                                         $pUsername = $pResults['username'];
                                         $pID = $pResults['user_id'];
                                         $breakOrLeave = $wpuAbs->lang('L_MAP_LEAVE_UNINT');
                                         $pStatus = $wpuAbs->lang('L_MAP_UNINT_FOUND');
                                         $selInt = 'selected="selected"';
                                         $class = 'unintfound';
                                     }
                                 } else {
                                     $breakOrLeave = $wpuAbs->lang('L_MAP_LEAVE_UNINT');
                                     $selBrk = 'selected="selected"';
                                     $pStatus = sprintf($wpuAbs->lang('L_MAP_UNINT_FOUNDBUT'), $pResults['username'], $pResults['username'], $pResults['user_wpuint_id']);
                                     $class = 'unintfoundbut';
                                 }
                             } else {
                                 // Offer to create the user
                                 $optCre = '<option value="Cre" selected="selected">' . $wpuAbs->lang('L_MAP_CREATEP') . '</option>';
                                 $pStatus = $wpuAbs->lang('L_MAP_UNINT_NOTFOUND');
                                 $pUsername = $phpBBMappedName;
                                 $breakOrLeave = $wpuAbs->lang('L_MAP_LEAVE_UNINT');
                                 $class = 'unintnotfound';
                                 /*
                                 									$breakOrLeave = $wpuAbs->lang('L_MAP_LEAVE_UNINT');
                                 									$selBrk = 'selected="selected"';
                                 									$pStatus = $wpuAbs->lang('L_MAP_UNINT_NOTFOUND'); ; */
                             }
                         }
                     }
                 } else {
                     $wpuAbs->err_msg(GENERAL_ERROR, $wpuAbs->lang('WP_DBErr_Retrieve'), $wpuAbs->lang('WP_DBErr_Retrieve'), __LINE__, __FILE__, $sql);
                 }
                 if (empty($phpBBMappedName)) {
                     $breakOrLeave = $wpuAbs->lang('L_MAP_LEAVE_UNINT');
                     $selDel = 'selected="selected"';
                     $pStatus = $wpuAbs->lang('L_MAP_ERROR_BLANK');
                     $class = "maperror";
                 }
                 $wpUtdInt->switch_db('TO_W');
                 $bg = $mustBrk == 'FALSE' ? 'none' : 'red';
                 $x = $x == 1 ? 2 : 1;
                 $template->assign_block_vars('switch_usermap_main.maplist_row', array('CLASS' => $class, 'EVERY_OTHER' => $x, 'BGCOLOUR' => $bg, 'ROW_NUM' => $itn, 'WP_ID' => $result->ID, 'WP_LOGIN' => $result->user_login, 'WP_NICENAME' => $result->user_nicename, 'WP_NUMPOSTS' => $posts, 'ALREADY_USERNAME' => $alreadyUN, 'P_USERNAME' => $pUsername, 'ALREADY_ID' => $alreadyID, 'P_ID' => $pID, 'P_STATUS' => $pStatus, 'S_INTEGRATED_SELECTED' => $selInt, 'S_BREAK_SELECTED' => $selBrk, 'S_DEL_SELECTED' => $selDel, 'L_SEL_INTEGRATE' => $intText, 'L_SEL_BREAK_OR_LEAVE' => $breakOrLeave, 'L_MAP_DEL_FROM_WP' => $wpuAbs->lang('L_MAP_DEL_FROM_WP'), 'S_MUST_BREAK' => $mustBrk, 'S_OPT_CREATE' => $optCre));
                 $itn++;
             }
             if ($thisEnd < $numWpResults) {
                 $template->assign_block_vars('switch_usermap_main.next_page_data', array('L_MAP_SKIPNEXT' => $wpuAbs->lang('L_MAP_SKIPNEXT')));
             }
         } else {
             $template->assign_block_vars('switch_usermap_main.switch_no_results', array('L_MAP_NOUSERS' => $wpuAbs->lang('L_MAP_NOUSERS')));
         }
     } else {
         die($wpuAbs->lang('L_MAP_CANT_CONNECT'));
     }
     $passVars = array('L_MAP_TITLE' => $wpuAbs->lang('L_MAP_TITLE'), 'S_WPMAP_ACTION' => append_sid("index.{$phpEx}?i=wp_united"), 'S_NEXTSTART' => $nextStart, 'S_OLDSTART' => $wpStart, 'S_TOTAL_ITN' => $itn - 1, 'L_MAP_PROCESS' => $wpuAbs->lang('L_MAP_PROCESS'), 'L_MAPMAIN_1' => $wpuAbs->lang('L_MAPMAIN_1'), 'L_MAPMAIN_2' => $wpuAbs->lang('L_MAPMAIN_2'), 'L_COL_WP_DETAILS' => $wpuAbs->lang('L_COL_WP_DETAILS'), 'L_COL_MATCHED_DETAILS' => $wpuAbs->lang('L_COL_MATCHED_DETAILS'), 'L_USERID' => $wpuAbs->lang('L_USERID'), 'L_USERNAME' => $wpuAbs->lang('L_USERNAME'), 'L_NICENAME' => $wpuAbs->lang('L_NICENAME'), 'L_NUMPOSTS' => $wpuAbs->lang('L_NUMPOSTS'), 'L_USERNAME' => $wpuAbs->lang('L_USERNAME'), 'L_USERID' => $wpuAbs->lang('L_USERID'), 'L_MAP_STATUS' => $wpuAbs->lang('L_MAP_STATUS'), 'L_MAP_ACTION' => $wpuAbs->lang('L_MAP_ACTION'), 'L_MAPMAIN_MULTI' => $wpuAbs->lang('L_MAPMAIN_MULTI'), 'L_MAP_ITEMS_PERPAGE' => $wpuAbs->lang('Map_Items_PerPage'), 'L_MAP_CHANGE_PERPAGE' => $wpuAbs->lang('Map_Change_PerPage'), 'L_MAP_QUICK_ACTIONS' => $wpuAbs->lang('Map_Quick_Actions'), 'L_MAP_DELETE_ALL_UNINTEGRATED' => $wpuAbs->lang('Map_Delete_All_Unintegrated'), 'L_MAP_BREAK_ALL' => $wpuAbs->lang('Map_Break_All'), 'L_MAP_RESET_DEFAULT' => $wpuAbs->lang('Map_Reset_Default'));
     for ($i = 50; $i <= 500; $i = $i + 50) {
         $passVars['S_NUMPERPAGE_' . $i] = $i == $numPerPage ? 'selected = "selected"' : '';
     }
     $this->showPage($passVars, 0);
 }
 /**
  * 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;
 }
 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);
 }
Exemple #11
0
    }
    ?>
					</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);
        ?>
) &not;</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 
 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;
 }
<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:'******'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>
Exemple #14
0
/**
 * {@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&amp;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>";
                break;
            default:
                $r .= "<td {$attributes}>";
                $r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID);
                $r .= "</td>";
        }
    }
    $r .= '</tr>';
    return $r;
}
Exemple #15
0
				<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>&copy; <?php 
echo date("Y");
function author_in_top()
{
    global $wpdb;
    $f_content = '';
    $lastnames = $wpdb->get_col("SELECT user_id FROM {$wpdb->usermeta} WHERE {$wpdb->usermeta}.meta_key = 'last_name' ORDER BY {$wpdb->usermeta}.meta_value ASC");
    $i = 0;
    $f_content .= '<hr /><h1>' . get_cat_name(16) . '</h1><div class="blog-list blog-sm"><div class="row"><div class="render-as-table-sm">';
    foreach ($lastnames as $userid) {
        $user = get_userdata($userid);
        $roles = $user->roles;
        $post_count = get_usernumposts($user->ID);
        $author_posts_url = get_author_posts_url($user->ID);
        $intop = get_field('top_faq', 'user_' . $user->ID);
        $posada = get_field('posada', 'user_' . $user->ID);
        $args = array('posts_per_page' => 1, 'orderby' => 'date', 'author' => $user->ID, 'cat' => 16);
        $query = new WP_Query($args);
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                if ($roles[0] == 'author' and $intop == 1 and $i < 4) {
                    $f_content .= '<div class="col-sm-3 gray-bg">';
                    $f_content .= '<div class="padding top-blog">
                      <div class="day">' . get_the_date('j.m.Y') . '</div>
                      <div class="title"><a href="' . get_the_permalink() . '" >' . trim_title_chars(45, '...') . '</a></div>
                    </div>
                    <hr />
                    <div class="img_wrapper padding">
                      <img src="' . author_img($user->ID) . '" alt="' . $user->user_firstname . ' ' . $user->user_lastname . '" />
                    </div>
                    <hr />
                    <div class="padding">
                      <div class="blog--fio">
                        <a href="' . $author_posts_url . '">' . $user->user_firstname . ' ' . $user->user_lastname . '</a>
                      </div>' . $posada . '</div>' . comments($post->ID) . '<a class="blog-more" href="' . get_the_permalink() . '" ><i class="sprite-arrow-right"></i>&nbsp;<span id="ua">Детальніше</span><span id="en">More</span></a></div>';
                    $i++;
                }
            }
        }
        wp_reset_postdata();
    }
    $f_content .= '</div><div class="clearfix"></div><div class="blog-all"> <a href="' . get_category_link(16) . '" ><i class="sprite-arrow-right"></i> ' . get_cat_name(16) . '</a></div></div><hr /></div>';
    return $f_content;
}
Exemple #17
0
        </div>
        <!-- 月別 -->
        <div id="tab_month">
            <ul><?php 
wp_get_archives('type=monthly&show_post_count=1');
?>
</ul>
        </div>
        <div id="tab_users">
            <ul>
            <?php 
//print_r($users);
$users = get_users();
foreach ($users as $value) {
    /*the_author_meta*/
    echo '<li><a href="' . get_home_url() . '/author/' . $value->user_nicename . ' ">' . $value->display_name . '(' . get_usernumposts($value->ID) . ')' . '</a></li>';
}
?>
            </ul>
        </div>
    </div>
</div>
<div id="right_box">
    <!-- 新着記事 -->
    <p>新着コメント</p>
    <div id="new_comments">
    <?php 
/*	
        Get Recent Commentsは使い勝手はいいけど
        postデータしかとってこないので保留
    
function wp_list_authors($args = '')
{
    if (is_array($args)) {
        $r =& $args;
    } else {
        parse_str($args, $r);
    }
    $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '');
    $r = array_merge($defaults, $r);
    extract($r);
    global $wpdb;
    // TODO:  Move select to get_authors().
    $query = "SELECT ID, user_nicename from {$wpdb->users} " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name";
    $authors = $wpdb->get_results($query);
    foreach ((array) $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_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($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>";
        }
    }
}
 $user_login = $myts->makeTboxData4Show($profiledata->user_login);
 $user_firstname = $myts->makeTboxData4Edit($profiledata->user_firstname);
 $user_lastname = $myts->makeTboxData4Edit($profiledata->user_lastname);
 $user_description = $myts->makeTareaData4Edit($profiledata->user_description);
 $user_nickname = $myts->makeTboxData4Edit($profiledata->user_nickname);
 $user_email = $myts->makeTboxData4Edit($profiledata->user_email);
 $user_url = $myts->makeTboxData4Edit($profiledata->user_url);
 $user_icq = $profiledata->user_icq == 0 ? "" : $profiledata->user_icq;
 $user_aim = $myts->makeTboxData4Edit($profiledata->user_aim);
 $user_msn = $myts->makeTboxData4Edit($profiledata->user_msn);
 $user_yim = $myts->makeTboxData4Edit($profiledata->user_yim);
 $user_idmode = $myts->makeTboxData4Edit($profiledata->user_idmode);
 $form = new XoopsThemeForm(_LANG_WPF_SUBT_EDIT, "profile", "profile.php");
 $form->addElement(new XoopsFormLabel(_LANG_WPF_SUBT_USERID, $profiledata->ID));
 $form->addElement(new XoopsFormLabel(_LANG_WPF_SUBT_LEVEL, $profiledata->user_level));
 $form->addElement(new XoopsFormLabel(_LANG_WPF_SUBT_POSTS, get_usernumposts($user_ID)));
 $form->addElement(new XoopsFormLabel(_LANG_WPF_SUBT_LOGIN, $user_login));
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_FIRST, "newuser_firstname", 50, 150, $user_firstname));
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_LAST, "newuser_lastname", 50, 150, $user_lastname));
 $form->addElement(new XoopsFormTextArea(_LANG_WPF_SUBT_DESC, "user_description", $user_description, 5, 60));
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_NICK, "newuser_nickname", 50, 150, $user_nickname), true);
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_MAIL, "newuser_email", 50, 150, $user_email), true);
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_URL, "newuser_url", 50, 150, $user_url));
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_ICQ, "newuser_icq", 50, 150, $user_icq));
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_AIM, "newuser_aim", 50, 150, $user_aim));
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_AIM, "newuser_msn", 50, 150, $user_msn));
 $form->addElement(new XoopsFormText(_LANG_WPF_SUBT_YAHOO, "newuser_yim", 50, 150, $user_yim));
 $form_idmode = new XoopsFormSelect(_LANG_WPF_SUBT_IDENTITY, "newuser_idmode", $user_idmode);
 $form_idmode->addOption("nickname", $profiledata->user_nickname);
 $form_idmode->addOption("login", $profiledata->user_login);
 $form_idmode->addOption("firstname", $profiledata->user_firstname);
 /**
  * setAuthorMetrics function.
  * 
  * @access public
  * @return void
  */
 function setAuthorMetrics()
 {
     global $wpdb;
     $this->_post_count = get_usernumposts($this->_user_id);
     $this->_comments_received = $wpdb->get_var("\n\t\t\t\t\tSELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_approved = 1 \n\t\t\t\t\t\tAND user_id <> {$this->_user_id}\n\t\t\t\t\t\tAND comment_post_ID IN (\n\t\t\t\t\t\t\tSELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_author = {$this->_user_id}\n\t\t\t\t)");
     $this->_comments_placed = $wpdb->get_var(" \n\t\t\t\t\tSELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_approved = 1 AND user_id = {$this->_user_id}\n\t\t\t\t");
     @$this->calculateKloutScore();
     @$this->calculateTwitterRatio();
     @$this->calculateWpsdScore();
 }
    /**
     *display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        } else {
            echo $before_title . 'Author Profile' . $after_title;
        }
        ?>
       <?php 
        $colums = $instance['columns'];
        $author_space = $instance['author_space'];
        $author_numbers = $instance['author_numbers'];
        $author_size = $instance['author_size'];
        $width = 'auto';
        if ($author_size) {
        } else {
            $author_size = 64;
            $width = 90;
        }
        if ($author_numbers) {
        } else {
            $author_numbers = 50;
        }
        if ($author_space) {
        } else {
            $author_space = 15;
        }
        if ($colums) {
        } else {
            $colums = 3;
        }
        $list = $instance['exclude_author'];
        $authorlink = "yes";
        $array = explode(',', $list);
        $count = count($array);
        for ($excludeauthor = 0; $excludeauthor <= $count; $excludeauthor++) {
            $exclude .= "user_login!='" . trim($array[$excludeauthor]) . "'";
            if ($excludeauthor != $count) {
                $exclude .= " and ";
            }
        }
        $where = "WHERE " . $exclude . "";
        global $wpdb;
        $table_prefix .= $wpdb->base_prefix;
        $table_prefix .= "users";
        $table_prefix1 .= $wpdb->base_prefix;
        $table_prefix1 .= "posts";
        //$comment_counts = (array) $wpdb->get_results("SELECT id, user_login, display_name, user_email, user_url, user_registered FROM  `{$table_prefix}` {$where} ", object);
        $get_results = "SELECT count(p.post_author) as post1,c.id, c.user_login, c.display_name, c.user_email, c.user_url, c.user_registered FROM {$table_prefix} as c , {$table_prefix1} as p {$where} and p.post_type = 'post' AND p.post_status = 'publish' and c.id=p.post_author GROUP BY p.post_author order by post1 DESC limit {$author_numbers}  ";
        $comment_counts = (array) $wpdb->get_results("{$get_results}", object);
        ?>
<table cellpadding="<?php 
        echo $author_space;
        ?>
" cellspacing="1" style="float:left;">

<?php 
        $i = 0;
        $j = $colums;
        foreach ($comment_counts as $count) {
            $user = get_userdata($count->id);
            if ($i == 0) {
                echo '<tr>';
            }
            echo '<td style="width:' . $width . 'px;text-align:center;padding-bottom:10px;" valign="top">';
            $post_count = get_usernumposts($user->ID);
            echo get_avatar($user->user_email, $size = $author_size);
            if ($authorlink == "No") {
                $temp = explode(" ", $user->display_name);
                echo '<br><div style="width:' . $width . 'px;text-align:center;align:center">' . $temp[0];
                echo '<br>' . $temp[1] . ' ' . $temp[2];
                echo "</div>";
            } else {
                $temp = explode(" ", $user->display_name);
                $link = sprintf('<a href="%1$s" title="%2$s" style="font-size:12px;"><br><div style="width:' . $width . ';text-align:center;align:center">%3$s <br> %4$s %5$s</a></div>', get_author_posts_url($user->ID, $user->user_login), esc_attr(sprintf(__('Posts by %s (%s)'), $user->display_name, get_usernumposts($user->ID))), $temp[0], $temp[1], $temp[2]);
                echo $link;
            }
            echo '</td>';
            $i++;
            if ($i == $j) {
                echo '</tr>';
                $j = $j + $colums;
            }
        }
        ?>
</table>
	   <?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }
		<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>
Exemple #23
0
				    	<div class="member-item-title">GNU/Linux Bogor</div>
				    </div>
				    <div class="member-item">
				    	<div class="member-item-logo"></div>
				    	<div class="member-item-title">BelajarFreeBSD</div>
				    </div-->
						<div class="jcarousel-wrapper">
                <div class="jcarousel">
                    <ul>
                      <?php 
//sort users descending by number of posts, display username and avatar
$uc = array();
$blogusers = get_users_of_blog();
if ($blogusers) {
    foreach ($blogusers as $bloguser) {
        $post_count = get_usernumposts($bloguser->user_id);
        $uc[$bloguser->user_id] = $post_count;
    }
    arsort($uc);
    foreach ($uc as $key => $value) {
        $user = get_userdata($key);
        $author_posts_url = get_author_posts_url($key);
        $id = $user->ID;
        $count = $value;
        if ($user->user_nicename != "admin" && $id > 3 && $count > 0) {
            echo "<li>";
            echo "<div class=\"member-item\" onclick=\"location.href='" . $author_posts_url . "';\">";
            echo "<div class=\"member-item-logo\">";
            echo get_avatar($user->ID, 170);
            echo "</div>";
            echo "<div class=\"member-item-title\">" . $user->nickname . "</div>";
/**
 * {@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 );
	$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_link = 'profile.php';
		} else {
			$edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_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 />";
		$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&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
		$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>';
	} else {
		$edit = '<strong>' . $user_object->user_login . '</strong>';
	}
	$role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($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->user_email, 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'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></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>";
		}
	}
	$r .= '</tr>';

	return $r;
}
function the_author_posts()
{
    global $id, $postdata;
    $posts = get_usernumposts($postdata['Author_ID']);
    echo $posts;
}
Exemple #26
0
function user_row($user_object, $style = '')
{
    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);
    $r = "<tr id='user-{$user_object->ID}'{$style}>\n\t\t<td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td>\n\t\t<td><label for='user_{$user_object->ID}'><strong>{$user_object->user_login}</strong></label></td>\n\t\t<td><label for='user_{$user_object->ID}'>{$user_object->first_name} {$user_object->last_name}</label></td>\n\t\t<td><a href='mailto:{$email}' title='" . sprintf(__('e-mail: %s'), $email) . "'>{$email}</a></td>\n\t\t<td><a href='{$url}' title='website: {$url}'>{$short_url}</a></td>";
    $r .= "\n\t\t<td align='center'>";
    if ($numposts > 0) {
        $r .= "<a href='edit.php?author={$user_object->ID}' title='" . __('View posts by this author') . "' class='edit'>";
        $r .= sprintf(__ngettext('View %s post', 'View %s posts', $numposts), $numposts);
        $r .= '</a>';
    }
    $r .= "</td>\n\t\t<td>";
    if (current_user_can('edit_user', $user_object->ID)) {
        $edit_link = add_query_arg('wp_http_referer', urlencode(clean_url(stripslashes($_SERVER['REQUEST_URI']))), "user-edit.php?user_id={$user_object->ID}");
        $r .= "<a href='{$edit_link}' class='edit'>" . __('Edit') . "</a>";
    }
    $r .= "</td>\n\t</tr>";
    return $r;
}
function list_authors2($optioncount = false, $exclude_admin = true, $idmode = '', $hide_empty = true, $feed = '', $feed_image = '')
{
    global $wp_id, $wpdb, $blogfilename;
    $query = "SELECT ID, user_idmode, user_nickname, user_firstname, user_lastname, user_login from {$wpdb->users[$wp_id]} " . ($exclude_admin ? "WHERE ID <> 1 " : '') . "ORDER BY user_nickname";
    $authors = $wpdb->get_results($query);
    foreach ($authors as $author) {
        $posts = get_usernumposts($author->ID, true);
        $name = $author->user_nickname;
        if (empty($idmode)) {
            $idmode = $author->user_idmode;
        }
        if ($idmode == 'nickname') {
            $name = $author->user_nickname;
        }
        if ($idmode == 'login') {
            $name = $author->user_login;
        }
        if ($idmode == 'firstname') {
            $name = $author->user_firstname;
        }
        if ($idmode == 'lastname') {
            $name = $author->user_lastname;
        }
        if ($idmode == 'namefl') {
            $name = $author->user_firstname . ' ' . $author->user_lastname;
        }
        if ($idmode == 'namelf') {
            $name = $author->user_lastname . ' ' . $author->user_firstname;
        }
        if (!$idmode) {
            $name = $author->user_nickname;
        }
        if (!($posts == 0 && $hide_empty)) {
            echo "<li>";
        }
        if ($posts == 0) {
            if (!$hide_empty) {
                echo $name;
            }
        } else {
            $link = '<a href="' . get_author_link(0, $author->ID, $author->user_login) . '" title="' . sprintf("Posts by %s", htmlspecialchars($author->user_nickname)) . '">' . stripslashes($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="' . stripslashes($feed) . '"';
                    $alt = ' alt="' . stripslashes($feed) . '"';
                    $name = stripslashes($feed);
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src=\"{$feed_image}\" border=\"0\" align=\"absbottom\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if ($optioncount) {
                $link .= ' (' . $posts . ')';
            }
        }
        if (!($posts == 0 && $hide_empty)) {
            echo "{$link}</li>";
        }
    }
}
function the_author_posts()
{
    global $id, $postdata;
    $posts = get_usernumposts($post->post_author);
    echo $posts;
}
function get_wpu_bloglist($showAvatars = TRUE, $maxEntries = 5)
{
    global $wpdb, $authordata, $scriptPath, $wpuAbs, $wpSettings, $wp_version, $phpEx;
    $start = 0;
    $start = (int) trim($_GET['start']);
    $start = $start < 0 ? 0 : $start;
    //get total count
    $sql = "SELECT count(DISTINCT {$wpdb->users}.ID) AS total\n\t\t\tFROM {$wpdb->users} \n\t\t\tINNER JOIN {$wpdb->posts}\n\t\t\tON {$wpdb->users}.ID={$wpdb->posts}.post_author\n\t\t\tWHERE {$wpdb->users}.user_login <> 'admin'";
    $count = $wpdb->get_results($sql);
    $numAuthors = $count[0]->total;
    $maxEntries = $maxEntries < 1 ? 5 : $maxEntries;
    //pull the data we want to display -- this doesn't appear to be very efficient, but it is the same method as  the built-in WP function
    // wp_list_authors uses. Let's hope the data gets cached!
    $sql = "SELECT DISTINCT {$wpdb->users}.ID, {$wpdb->users}.user_login, {$wpdb->users}.user_nicename \n\t\t\tFROM {$wpdb->users}\n\t\t\tINNER JOIN {$wpdb->posts} \n\t\t\tON {$wpdb->users}.ID={$wpdb->posts}.post_author \n\t\t\tWHERE {$wpdb->users}.user_login<>'admin' \n\t\t\tORDER BY {$wpdb->users}.display_name LIMIT {$start}, {$maxEntries}";
    $authors = $wpdb->get_results($sql);
    if (count($authors) > 0) {
        $d = get_settings('time_format');
        $time = mysql2date($d, $time);
        $itern = 1;
        $blogList = '';
        foreach ((array) $authors as $author) {
            $posts = 0;
            $_oldQuery = '';
            $avatar = '';
            $blogTitle = '';
            $blogDesc = '';
            $blogPath = '';
            $path_to_profile = '';
            $lastPostID = 0;
            $post = '';
            $lastPostTitle = '';
            $lastPostURL = '';
            $time = '';
            $lastPostTime = '';
            $posts = get_usernumposts($author->ID);
            if ($posts) {
                $author = get_userdata($author->ID);
                $pID = (int) $author->phpbb_userid;
                $name = $author->nickname;
                if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
                    $name = "{$author->first_name} {$author->last_name}";
                }
                $avatar = avatar_create_image($author);
                $blogTitle = empty($author->blog_title) ? $wpuAbs->lang('default_blogname') : $author->blog_title;
                $blogDesc = empty($author->blog_tagline) ? $wpuAbs->lang('default_blogdesc') : $author->blog_tagline;
                if ((double) $wp_version >= 2.1) {
                    //WP >= 2.1 branch
                    $blogPath = get_author_posts_url($author->ID, $author->user_nicename);
                } else {
                    //deprecated branch
                    $blogPath = get_author_link(false, $author->ID, $author->user_nicename);
                }
                $wUsrName = sanitize_user($author->user_login, true);
                if ($wUsrName == $author->user_login) {
                    $pUsrName = $author->user_login;
                } else {
                    $pUsrName == $author->phpbb_userLogin;
                }
                $profile_path = $wpuAbs->ver == 'PHPBB2' ? "profile.{$phpEx}" : "memberlist.{$phpEx}";
                $path_to_profile = empty($pID) ? append_sid($blogPath) : append_sid(add_trailing_slash($scriptPath) . $profile_path . '?mode=viewprofile&amp;u=' . $pID);
                $rssLink = get_author_rss_link(0, $author->ID, $author->user_nicename);
                $lastPostID = $author->wpu_last_post;
                if (empty($lastPostID)) {
                    $_oldQuery = $GLOBALS['wp_query'];
                    query_posts('author=' . $author->ID . '&showposts=1');
                    if (have_posts()) {
                        the_post();
                        if ((double) $wp_version >= 2.1) {
                            //WP >= 2.1 branch
                            $lastPostID = get_the_ID();
                        } else {
                            //deprecated branch
                            global $id;
                            $lastPostID = $id;
                        }
                        update_usermeta($author->ID, 'wpu_last_post', $lastPostID);
                    }
                    $GLOBALS['wp_query'] = $_oldQuery;
                }
                $post = get_post($lastPostID);
                $lastPostTitle = wpu_censor($post->post_title);
                $blogTitle = wpu_censor($blogTitle);
                $blogDesc = wpu_censor($blogDesc);
                $lastPostURL = get_permalink($lastPostID);
                $time = $post->post_date;
                $lastPostTime = apply_filters('get_the_time', $time, $d, FALSE);
                $itern = $itern == 0 ? 1 : 0;
                $blogList .= "<div class=\"wpubl{$itern}\">\n\n";
                if (!empty($avatar)) {
                    $blogList .= "<img src=\"{$avatar}\" alt=\"avatar\"/>\n";
                }
                $blogList .= "<h2 class=\"wpublsubject\" ><a href=\"{$blogPath}\">{$blogTitle}</a>, " . __('by') . ' <a href="' . $path_to_profile . '">' . $name . "</a></h2>\n\n";
                $blogList .= '<p class="wpubldesc">' . $blogDesc . "</p>\n\n";
                $blogList .= '<small class="wpublnumposts">' . __('Total Entries:') . ' ' . $posts . "</small><br />\n\n";
                $blogList .= '<small class="wpublastpost">' . __('Last Entry:') . ' <a href="' . $lastPostURL . '">' . $lastPostTitle . '</a>, ' . __('posted on') . " {$time}</small><br />\n\n";
                if (!empty($rssLink)) {
                    $blogList .= '<small class="wpublrss">' . __('RSS Feed:') . ' <a href="' . $rssLink . '">' . __('Subscribe') . "</a></small><br />\n\n";
                }
                $blogList .= "<p class=\"wpublclr\">&nbsp;</p></div>\n\n";
            }
        }
    } else {
        $blogList .= "<div class=\"wpubl\">\n";
        $blogList .= '<p class="wpubldesc">' . __('There are no authors to show') . "</p>\n";
        $blogList .= "</div>\n";
    }
    if ($numAuthors > $maxEntries) {
        $base_url = append_sid(strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/'))) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']);
        $pagination = generate_pagination($base_url, $numAuthors, $maxEntries, $start, TRUE);
        $blogList .= '<p class="wpublpages">' . $pagination . '</p>';
    }
    return $blogList;
}