• Welcome to the all-new Kolakube support, the official place to get help for Marketers Delight, XFtoWP, CryptoWP, and other WordPress products! Please login with your account details to access members-only support forums.

Resolved Change content in the pinned post and exclude it from comment count

Techsense

Member
Messages
10
Reaction score
1
By default XFtoWP fetches the OP content as the first "reply" in WP" when there're no forum replies. This doesn't make too much sense as the WP post already has the same content. I'd like to add a tailored message to all zero-forum-reply posts. How to get this done? I just want to change the content, nothing else.

Also I want to exclude the first message of all zero-forum-reply posts from the comment count which shows "1", but in fact it should be "0".
 
Solution
But I would suggest to separate the count of forum replies from that of wp comments, as your plugin can be used to deliver distinctive information other than forum discussions.
Yes, XFtoWP adds the total # of thread replies to any given post's comments count including where it renders in templates with get_comments_number().

You can get the total # of thread replies by accessing the wp_postmeta for any post with this helper function:

PHP:
$forum_comments = xf_post_meta( 'total' );

or if you already know the post ID, search that way:

PHP:
$forum_comments = xf_post_meta( 'total', 34535 );

I really need to remove the OP content from the WP posts. Could you please point me which php code I should modify?
...

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,758
Reaction score
1,916
By default XFtoWP fetches the OP content as the first "reply" in WP" when there're no forum replies. This doesn't make too much sense as the WP post already has the same content. I'd like to add a tailored message to all zero-forum-reply posts. How to get this done? I just want to change the content, nothing else.
This was designed back in version 1.0 with the intention of the author writing a different message for the forum thread opening post.

When used to post excerpts and full article lengths, as has proven to be the most common use case, I agree that it should be able to be different than OP.

Currently the only way to do it is to change the OP content on the forum, then the next time your comments refresh it will update the post.

If you'd like to post this to the feature request forum it will be easier to track. I've added it to my notes as it has been requested another time before.
Also I want to exclude the first message of all zero-forum-reply posts from the comment count which shows "1", but in fact it should be "0".
So, without a reply to the thread you are reporting that the plugin adds a 1 each time you connect a thread with no replies?

If I understand correctly, does the post also have 0 comments? If you have a page like this I can view, it will help me better understand the issue.
 
Comment

Techsense

Member
Messages
10
Reaction score
1
Hi Alex, I found the second issue turned out to be a negligence of the comment coming with a fresh wp installation. But I would suggest to separate the count of forum replies from that of wp comments, as your plugin can be used to deliver distinctive information other than forum discussions.

I've PMed you the pages to illustrate a totally different use of your plugin. I really need to remove the OP content from the WP posts. Could you please point me which php code I should modify?
 
Last edited:
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,758
Reaction score
1,916
But I would suggest to separate the count of forum replies from that of wp comments, as your plugin can be used to deliver distinctive information other than forum discussions.
Yes, XFtoWP adds the total # of thread replies to any given post's comments count including where it renders in templates with get_comments_number().

You can get the total # of thread replies by accessing the wp_postmeta for any post with this helper function:

PHP:
$forum_comments = xf_post_meta( 'total' );

or if you already know the post ID, search that way:

PHP:
$forum_comments = xf_post_meta( 'total', 34535 );

I really need to remove the OP content from the WP posts. Could you please point me which php code I should modify?
I've just released XFtoWP 1.5 Beta 4 (1.4.94) which offers a new option (and a slight re-wording) to disable the original post entirely.

Download the latest beta from your account area and reinstall the plugin to use it.

Screen Shot 2022-05-05 at 10.54.55 PM.png
 
Comment
Solution

Techsense

Member
Messages
10
Reaction score
1
Hi Alex.

It's really strange! At the click to a WP post via a link from another page, the original XF post still appears. Upon refreshing the page the XF original post then disappears.

I've PMed you the url.
 
Comment

Techsense

Member
Messages
10
Reaction score
1
On further investigation, I didn't find the source code for the original XF post despite its showing up in the WP post. I guess the phantom content might be produced by XFtoWP js script.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,758
Reaction score
1,916
Hi @Techsense, thank you for posting the update and apologies for my delayed reply.

I looked into the behavior and see that the new option is being ignored on the AJAX request after the time interval you set has passed. I have corrected the logic to always hide the first post if the new option is enabled and will send out a patch shortly.
 
Comment

Techsense

Member
Messages
10
Reaction score
1
Hi Alex. I noticed the release of the XFtoWP 1.5 Beta 4 Patch 1. I believe you've made the patch for the issue. Which file was the patch made on? I did a lot of mod and intend to replace the affected file only.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,758
Reaction score
1,916
Hi Alex. I noticed the release of the XFtoWP 1.5 Beta 4 Patch 1. I believe you've made the patch for the issue. Which file was the patch made on? I did a lot of mod and intend to replace the affected file only.
I will private message you about this.

I did a lot of mod and intend to replace the affected file only.
Out of curiosity, what mods have you made to the plugin? I am always interested in anything development related to the plugin.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,758
Reaction score
1,916
The mods are all on the frontend appearance. I want to make the posts look like directory listings.
Sounds cool. If you need to make frontend template edits, you can copy the file contents to: /wp-content/themes/your-child-theme-name/XFWP/$template-name.php into your child theme and keep your edits there so you can keep updating the core plugin as normal.
 
Comment

Techsense

Member
Messages
10
Reaction score
1
I looked into the behavior and see that the new option is being ignored on the AJAX request after the time interval you set has passed. I have corrected the logic to always hide the first post if the new option is enabled and will send out a patch shortly.

I've been actually waiting for this patch.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,758
Reaction score
1,916
I've been actually waiting for this patch.
My apologies, I didn't follow my usual protocol for implementing this patch so it did get lost. However, I have committed it to the latest release and the patch is as a simple as:

Open XFWP/requests/comments.php

Find on line 33:

PHP:
if ( empty( $disable_first ) || ( ! empty( $disable_first ) && $posts_count <= 0 ) )

Replace with:

PHP:
$disable_pinned = xf_option( array( 'comments', 'disable', 'pinned' ) );
if ( empty( $disable_pinned ) && ( empty( $disable_first ) || ( ! empty( $disable_first ) && $posts_count <= 0 ) ) )
 
Comment
Top