function handle_shortcode($attributes) { global $post; global $current_user; // Check to see if we have rights to see stuff $min_level = $this->options['min-level']; get_currentuserinfo(); $allcaps = $current_user->allcaps; if (1 != $allcaps[$min_level]) { return; // not authorized to see CS } // else - continue // get the expiration timestamp $timestamp = get_post_meta($post->ID, '_cs-expire-date', true); if (empty($timestamp)) { return false; } else { $expirationdt = DateUtilities::getReadableDateFromTimestamp($timestamp); } $return_string = sprintf(__("Expires: %s", 'contentscheduler'), $expirationdt); return $return_string; }
$auth_id = $post_data['post_author']; // get the author email address $auth_info = get_userdata($auth_id); $auth_email = "Author <" . $auth_info->user_email . ">"; // get the post ID $post_id = $post_data['ID']; // get the post title $post_title = $post_data['post_title']; // get / create the post viewing URL $post_view_url = $post_data['guid']; // get / create the post editing url // $post_edit_url = "Fake Post Editing URL"; // get the post expiration date // $post_expiration_date = ( get_post_meta( $post_data['ID'], '_cs-expire-date', true) ); $post_expiration_date_timestamp = get_post_meta($post_data['ID'], '_cs-expire-date', true); $post_expiration_date = DateUtilities::getReadableDateFromTimestamp($post_expiration_date_timestamp); // pack it up into our array // make a new item array $new_item['ID'] = $post_id; $new_item['post_title'] = $post_title; $new_item['view_url'] = $post_view_url; // $new_item['edit_url'] = $post_edit_url; $new_item['expiration_date'] = $post_expiration_date; if ($notify_whom == 'author' or $notify_whom == 'both') { // add the post to the notification list $notify_list[$auth_email][] = $new_item; } // if we are notifying admin, we can add it to their array if ($notify_whom == 'admin' or $notify_whom == 'both') { // See if the site_admin_email matches the author email. // If it does, the admin is already being notified, so we should not continue