I have taken the following code from a tutorial. It is meant to create a shortcode I can use to add a button to my Wordpress posts, which directly sends a message to the user who created the post.
I am getting the php error -
Fatal error: Class 'wpchats' not found in /homepages/22/d688271077/htdocs/clickandbuilds/VillaShare/wp-content/themes/listable/functions.php on line 755
Please see the functions.php code and shortcode below:
add_shortcode('wpc-link-to-chat', function($atts) {
$a = shortcode_atts( array(
'user_id' => wp_get_current_user()->ID
), $atts );
$user_id = (int) "{$a['user_id']}";
$wpchats = new wpchats;
return $wpchats->get_settings( 'messages_page' ) . "?recipient=$user_id";
});
Shortcode:
[wpc-link-to-chat user_id="3"]