function authors_block($options) { $mydirname = empty($options[0]) ? 'xpress' : $options[0]; $this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_authors.html' : trim($options[1]); $optioncount = empty($options[2]) ? 0 : 1; $exclude_admin = empty($options[3]) ? 0 : 1; $show_fullname = empty($options[4]) ? 0 : 1; $hide_empty = empty($options[5]) ? 0 : 1; $mydirpath = get_xpress_dir_path(); if (xpress_is_wp_version('<', '2.3')) { $param_str = 'optioncount=' . $optioncount . '&exclude_admin=' . $exclude_admin . '&show_fullname=' . $show_fullname . '&hide_empty=' . $hide_empty; ob_start(); wp_list_authors($param_str); //WP2011 wp_list_authors() used only parse_str() $list_authors = ob_get_contents(); ob_end_clean(); } else { $param = array('optioncount' => $optioncount, 'exclude_admin' => $exclude_admin, 'show_fullname' => $show_fullname, 'hide_empty' => $hide_empty, 'feed' => '', 'feed_image' => '', 'echo' => false); $list_authors = wp_list_authors($param); } if (xpress_is_multi_user()) { $all_link = '<li>' . '<a href="' . get_bloginfo('url') . '" title="' . __('All Authors', 'xpress') . '">' . __('All Authors', 'xpress') . '</a></li>'; } else { $all_link = ''; } $output = "<ul>\n" . $all_link . $list_authors . "\n</ul>\n"; $block['authors'] = $output; return $block; }
function xpress_set_author_cookie($query_vars) { global $wp, $wpdb; if (is_admin()) { return $query_vars; } $author_cookie = 'select_' . get_xpress_dir_name() . "_author"; if (xpress_is_multi_user()) { if (!empty($_GET)) { $auth = intval(@$_GET["author"]); if ($auth > 0) { setcookie($author_cookie, $auth, time() + 3600, COOKIEPATH); $_COOKIE[$author_cookie] = $auth; } } else { if (xpress_is_wp_version('<', '2.1')) { // Maybe, I think that it is ver2.1 or less. if (!empty($wp->matched_query)) { if (strpos($wp->matched_query, 'author_name') !== false) { $pattern = "author_name\\s*=\\s*(.*)\\s*"; if (preg_match("/" . $pattern . "/i", $wp->matched_query, $match)) { $author_name = "{$match['1']}"; $auth = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE user_login = '******'"); setcookie($author_cookie, $auth, time() + 3600, COOKIEPATH); $_COOKIE[$author_cookie] = $auth; } } } else { setcookie($author_cookie, 0, time() + 3600, COOKIEPATH); $_COOKIE[$author_cookie] = 0; } } else { if (!empty($wp->query_vars)) { if (!empty($wp->query_vars['author_name'])) { $author_name = $wp->query_vars['author_name']; $auth = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE user_login = '******'"); setcookie($author_cookie, $auth, time() + 3600, COOKIEPATH); $_COOKIE[$author_cookie] = $auth; } } else { setcookie($author_cookie, 0, time() + 3600, COOKIEPATH); $_COOKIE[$author_cookie] = 0; } } } } else { // $GLOBALS["wp_xoops_author"] = null; setcookie($author_cookie, 0, time() + 3600, COOKIEPATH); $_COOKIE[$author_cookie] = 0; } return $query_vars; }