Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function parse_columnist_role($author_id) {
- /* See author_is_columnist, below.
- This function takes the string 'yes' or no' and parses it.
- I probably go overboard in sanitization, but I've seen the dedication
- of our local users.
- parse_columnist_role returns true if the string parses to 'yes' */
- $meta_tag = get_the_author_meta('columnist', $author_id);
- $is_columnist = false;
- if (!empty($meta_tag)) {
- $meta_tag = strtolower($meta_tag);
- $meta_tag = strip_tags($meta_tag);
- if (strpos('yes', $meta_tag) != -1) {
- $meta_tag = preg_replace('/([^yes].*$)/', '', $meta_tag);
- } else {
- $meta_tag = preg_replace('/([^no].*$)/', '', $meta_tag);
- }
- if ($meta_tag === 'yes') {
- $is_columnist = true;
- }
- }
- return $is_columnist;
- }
- function author_is_columnist() {
- /* We've (currently unused) added a flag to each user in order to indicate
- that they have a serial column.
- parse_columnist_role parses the variable string.
- author_is_columnist returns true or false. */
- $id = get_the_author_meta('ID');
- return parse_columnist_role($id);
- }
Advertisement
Add Comment
Please, Sign In to add comment