Files
2024_WEBSITE_fipf/plugins/custer/queries.php
2024-04-02 18:55:59 +02:00

74 lines
1.0 KiB
PHP

<?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) {
$admin_email = get_option( 'admin_email' );
return $admin_email;
}
?>