**Notice**: Trying to access array offset on value of type null in **/home/u48255p44743/domains/fxweb.snowfreakz.nl/public_html/wp-content/plugins/wp-discourse/lib/discourse-comment-formatter.php** on line **90**
**Notice**: Trying to access array offset on value of type null in **/home/u48255p44743/domains/fxweb.snowfreakz.nl/public_html/wp-content/plugins/wp-discourse/lib/discourse-comment-formatter.php** on line **106**
**Notice**: Trying to access array offset on value of type null in **/home/u48255p44743/domains/fxweb.snowfreakz.nl/public_html/wp-content/plugins/wp-discourse/lib/discourse-comment-formatter.php** on line **127**
**Notice**: Trying to access array offset on value of type null in **/home/u48255p44743/domains/fxweb.snowfreakz.nl/public_html/wp-content/plugins/wp-discourse/lib/discourse-comment-formatter.php** on line **127**
**Notice**: Trying to access array offset on value of type null in **/home/u48255p44743/domains/fxweb.snowfreakz.nl/public_html/wp-content/plugins/wp-discourse/lib/discourse-comment-formatter.php** on line **148**
**Notice**: Trying to access array offset on value of type null in **/home/u48255p44743/domains/fxweb.snowfreakz.nl/public_html/wp-content/plugins/wp-discourse/lib/discourse-comment-formatter.php** on line **148**
Which are all related to the $URL in the file. I am calling the comments with:
<?php
global $post;
use WPDiscourse\Utilities\Utilities as DiscourseUtilities;
$discourse_comments = DiscourseUtilities::get_discourse_comments($post->ID);
echo $discourse_comments;
?>
Thnx for reaching out … it’s a “fresh” Wordpress installation running Bricks template builder and just installed WPdiscourse for the connection. Besides mod_headers server caching there are no other aggressive plugins altering any scripts.
Just added the direct PHP line again and … magically the URL is there. No idea what i did different.
<?php
global $post;
use WPDiscourse\Utilities\Utilities as DiscourseUtilities;
$discourse_comments = DiscourseUtilities::get_discourse_comments($post->ID);
echo $discourse_comments;
echo get_post_meta( $post->ID, 'discourse_permalink', true );
?>
But i still have the Notices which relate to code lines where the URL should be constructed and the link after " Continue the discussion at" is not showing.
When I include the “main” wordpress comments (which is a bricks template element) it shows the “normal WP comment form” which is not replaced by the Discourse reviews plugin. See the above URL; i changed the lay-out adding the WP comments below the Blog.
There will be various updates to the get_discourse_comments utility function in the next release (2.4.6), which is currently being prepared for release. The updated utility method signature will look like this
/**
* Get the Discourse comment HTML so that it can be displayed without loading the comments template.
*
* @param int $post_id The post ID to display the comments for.
* @param bool $perform_sync Determines whether a comment sync is maybe performed when loading comments.
* @param bool $force_sync Determines whether comment sync cache is bypassed when loading comments.
* @param string $comment_type Type of comment display.
*
* @return string
*/
public static function get_discourse_comments( $post_id, $perform_sync = true, $force_sync = false, $comment_type ) {
@Joep_Kannegieter This will have a few upshots for your case (and a few other cases):
The comment display will work
You’ll control the comment display type (i.e. all comments or comment link) programmatically
Coming back here; basically “i get it working” although not with the Bricks Builder template.
When i switch to twentytwenty theme the Discourse integration shows below the blog post, replacing the Comments field
When using Bricks Builder there is an element “Comments” which loads the WP comments; which is not replaced by the plugin. Neither programmatically called with:
Error: Too few arguments to function WPDiscourse\Utilities\Utilities::get_discourse_comments(), 1 passed in /home/u43655p432443/domains/domain.nl/public_html/wp-content/themes/bricks/includes/elements/code.php(159) : eval()'d code on line 4 and exactly 4 expected
So its Bricks related. Gonna ask the Bricks commmunity as well.
This error is telling you that your use of the utility function get_discourse_comments needs updating. Here’s an example of how you could use it.
global $post;
use WPDiscourse\Utilities\Utilities as DiscourseUtilities;
$discourse_comments = DiscourseUtilities::get_discourse_comments($post->ID, true, true, 'display-comments');
echo $discourse_comments;