turned custer into a repo
This commit is contained in:
69
get_user_id.php
Normal file
69
get_user_id.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* get the current author id
|
||||
* return 0 if not found
|
||||
* get id outside loop : https://wordpress.stackexchange.com/q/65548
|
||||
*
|
||||
*/
|
||||
function get_author_id() {
|
||||
if (is_author()) {
|
||||
$user_id = get_queried_object_id();
|
||||
}
|
||||
else {
|
||||
$user_id = get_the_author_meta('ID');
|
||||
}
|
||||
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* get the anker user id
|
||||
* return 0 if not found
|
||||
*
|
||||
*/
|
||||
//function get_anchor_id($anchor_name) {
|
||||
// $option_anchor = Custer::OPTION_ANCHOR;
|
||||
//error_log("anchor_name:");
|
||||
//error_log($anchor_name);
|
||||
//
|
||||
// $anchors = get_option($option_anchor);
|
||||
//error_log("anchors:");
|
||||
//error_log(json_encode($anchors));
|
||||
// if ($anchors === false) {
|
||||
//error_log("anchors === false");
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// if (isset($anchors[$anchor_name])) {
|
||||
// $user_id = $anchors[$anchor_name];
|
||||
// }
|
||||
//
|
||||
// if (empty($user_id)) {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// return $user_id;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user