HTML links in the message
-
Hi!
I am using a custom page view logger created with the help of your code provided in an earlier thread:
<?php class User_Page_Visit_Logger extends \Simple_History\Loggers\Logger { public $slug = 'User_Page_Visit_Logger'; public function get_info() { return array( 'name' => __('User Page Visit Logger', 'simple-history'), 'description' => __('Logs page visits by logged-in users', 'simple-history'), 'capability' => 'read', 'messages' => array( 'page_visit' => __('User {user_id} ({user_name}, {user_email}) visited <a href="{post_permalink}">{post_title}</a>', 'simple-history'), ), 'labels' => array( 'search' => array( 'label' => __('User Page Visits', 'simple-history'), 'options' => array( __('Page Visits', 'simple-history') => array( 'page_visit', ), ), ), ), ); } public function loaded() { if (is_user_logged_in()) { add_action('wp', array($this, 'log_page_visit')); } } public function log_page_visit() { $current_user = wp_get_current_user(); $post = get_queried_object(); if ($current_user && $post) { $context = array( '_initiator' => \Simple_History\Log_Initiators::WP_USER, 'user_id' => $current_user->ID, 'user_name' => $current_user->display_name, 'user_email' => $current_user->user_email, 'post_title' => get_the_title($post), 'post_permalink' => get_permalink($post), ); $this->info_message('page_visit', $context); } } }
My issue is that the page title and URL are not displayed as a hyperlink, but as a simple text. So the last part of this code
'page_visit' => __('User {user_id} ({user_name}, {user_email}) visited <a href="{post_permalink}">{post_title}</a>', 'simple-history')
outputs like this: … visited <a href=”https://…../”>…….</a>
The log outputs the html syntax instead of a real hyperlink.
Is there a way to correct this?
Thank you!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘HTML links in the message’ is closed to new replies.