コード例 #1
0
/**
 *	Check to see if comment prompts are hidden for logged-in users
 *
 *	@return boolean True if setting is enabled, false otherwise
 */
function after_comment_prompts_is_hidden_for_logged_in()
{
    $option = after_comment_prompts_get_settings();
    if (isset($option['hide_for_logged_on']) && $option['hide_for_logged_on'] == 1) {
        return true;
    }
    return false;
}
コード例 #2
0
 /**
  *	Add the content for the prompt modal
  */
 public function add_prompt_content()
 {
     // Bail if the functionality is not enabled
     if (!after_comment_prompts_is_enabled()) {
         return;
     }
     // Bail if comment_added query arg is not set or is something other than a number
     if (!isset($_GET['comment_added']) || !is_numeric($_GET['comment_added'])) {
         return;
     }
     // Bail if the modal is disable for logged-in users
     if (after_comment_prompts_is_hidden_for_logged_in() && is_user_logged_in()) {
         return;
     }
     // Comment object
     $comment = get_comment($_GET['comment_added']);
     if (!$comment) {
         return;
     }
     // Commenter's first name
     $author_names = explode(' ', $comment->comment_author);
     $author_fname = $author_names[0];
     // Message setting value
     $message = after_comment_prompts_get_settings()['message'];
     // Replace merge tags
     $message = str_replace('{commenter_name}', $author_fname, $message);
     // Final output
     $output = after_comment_prompts_get_modal($message);
     echo apply_filters('after_comment_prompts_modal_output_comments', $output, $comment, $message);
 }