custer v0.2.2 includes queries in all output
This commit is contained in:
72
plugins/custer/queries.php
Normal file
72
plugins/custer/queries.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace CUSTER;
|
||||
|
||||
/*
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
|
||||
function get_queries($user_id, $if_empty) {
|
||||
$special_queries = Custer::QUERIES;
|
||||
|
||||
$queries = array();
|
||||
foreach($special_queries as $query) {
|
||||
$queries[$query] = \CUSTER\format_user_info($query, $user_id, $if_empty);
|
||||
}
|
||||
return $queries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function find_author_page_url($user_id) {
|
||||
return get_author_posts_url($user_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* find the posts of the user and return the first one
|
||||
*
|
||||
*/
|
||||
function find_user_post_url($user_id) {
|
||||
$user_post_url = '';
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'post',
|
||||
'author' => $user_id,
|
||||
'posts_per_page' => 1,
|
||||
);
|
||||
$posts = get_posts($args);
|
||||
|
||||
if (empty($posts)) {
|
||||
$user_post_url = '';
|
||||
}
|
||||
else {
|
||||
$query = reset($posts);
|
||||
$user_post_url = get_permalink($query->ID);
|
||||
}
|
||||
|
||||
return $user_post_url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function find_admin_email($user_id) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user