Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do I make the comment button read only in the activity stream?


  • naomibuch
    Participant

    @naomibuch

    Hello..

    The comment box and the reply box is over lapping each other in the Activity Stream. After I make an initial post update, that’s when the problem occurs and get really confusing.

    Ideally it should not be two input boxes to reply to a comment, currently when I tested this functionality I can reply to a friends post by either clicking on the “comment button” or “reply button”.

    I don’t want the users to be able to click the “comment button” after someone creates a new post. Because it’s buggy and overlaps the reply button.

    Thank you very much.

    Naomi

Viewing 17 replies - 1 through 17 (of 17 total)

  • Boone Gorges
    Keymaster

    @boonebgorges

    What theme are you using? It’s possible that this problem is specific to the theme. Try on a default WordPress theme like Twenty Sixteen to be sure.

    Can you share a screenshot of the “comment box” and the “reply box”? It’s unclear from your questions whether you’re talking about textareas or about buttons. Also, BP doesn’t have separate Comment and Reply functionality for activity items, which makes me think that this may be a conflict with another plugin.


    naomibuch
    Participant

    @naomibuch

    Comments Overlapping


    naomibuch
    Participant

    @naomibuch

    Hi Boone,

    Thanks for getting back to me.

    I was unable to provide a screenshot of the issue, because there is no way to upload a screen shot of the image from my computer and the IMG link only shows a blank.

    Ideally, this is how I want the logic to work:

    If the comment button counter is set to 0, read only = false, I want the comment button to be editable for the user to make the first comment on a post.

    After the first comment is made, make the comment button read only = true. Not editable. Where users can only reply to replies on a post.

    Hope that makes more sense.

    Thanks,

    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Boone,

    BTW: I am using Newspaper – Theme version: 8.1
    WP version 4.8.3
    Buddypress Version 2.9.2

    I always do my code editing in the Newspaper child theme (
    Newspaper 7 Child theme: Theme Functions (functions.php)

    Thanks,

    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Boone,

    For some reason it’s not allowing me to edit my post, the changes are not appearing, so I am having to create separate posts!

    I always do my code editing in the Newspaper child theme (
    Newspaper 7 Child theme: Theme Functions (functions.php)

    The only other option I have is the edit Twenty Seventeen theme? But I have never used this theme for updating code, I always had success using the Newspaper child theme.

    Thanks,

    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Boone,

    I deactivated all plugins like you suggested and the problem is still occurring with the comment input box overlaying the the reply area.

    It only happens when I have 1 comment or more, ideally once a user makes a comment, in a muti user web environment they can’t make any more comments. Only a new user who hasn’t made a comment can comment on a new post, think facebook type posts.

    See example below:

    User A = Josh
    User B = Nancy
    User C = Carol

    User A starts a post.
    User B make the first comment on User A post , User C replies to User B comment on User A post.

    Only 1 unique User can comment on a post one at at time, but they can reply multiple times within a post.

    Currently the Activity Stream (BuddyPress) doesn’t have this functionality built in, or is there is plugin that performs this functionality?

    The problem I am currently experiencing is that each unique user can make multiple comments on a single post. They should only have the capability to make 1 comment to each post.

    And when a user makes a second comment (which they are not allowed to do) that’s when the malfunction occurs and the input box overlaps the reply box.

    Thanks so much for your help in this matter.

    P.S. I am so thankful for you Boone and the original developers of BuddyPress for being here to support the community.

    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Again,

    This is a list of all my plugins:

    WP Mail SMTP
    WP Crontrol
    WP All Import Pro
    WordPress Mass Email to users
    WordPress Importer
    W3 Total Cache
    tagDiv Social Counter
    tagDiv Composer
    SiteOrigin Widgets Bundle
    Shortcodes Ultimate
    rtMedia for WordPress, BuddyPress and bbPress
    RSS Importer
    Remove Dashboard Access
    PushLive – Staging Site to Live Site in One Click
    Page Builder by SiteOrigin
    Newsletter
    Knowledge Base for Documents and FAQs
    Invite Anyone, by Boones 🙂
    iframe
    Hide This
    Hide Admin Bar
    Easy Affiliate Links
    Contact Form 7
    Buddypress Shortcodes
    Buddypress Friend of a Friend (FOAF)
    BuddyPress Follow
    BuddyPress Extended Friendship Request
    BuddyPress Edit Activity
    BuddyPress Block Activity Stream Types
    BuddyPress Activity ShortCode
    BuddyPress Activity Privacy
    BuddyPress Activity Filter
    BuddyPress Activity Autoloader
    BuddyPress
    BP Show Friends
    Amazon Auto Links
    All In One SEO Pack Pro
    Akismet Anti-Spam
    Advanced Profiles Plugin 2.0 for BuddyPress
    Activity Reactions For Buddypress


    Boone Gorges
    Keymaster

    @boonebgorges

    Hi Naomi – Thanks for the additional details.

    I’m afraid I still don’t understand what you mean by “the comment input box” and “the reply area”. Here’s what the activity commenting area looks like on Twenty Sixteen: https://postimg.org/image/yzra0j1h3/ I assume that “the comment input box” is the field at the bottom, just above the ‘post’ and ‘cancel’ buttons. But I’m unsure what in this screenshot represents “the reply area”, and I don’t see any overlap at a glance. If possible, perhaps you could upload a screenshot to a third-party service like https://postimg.org/ and drop the URL here, so that we could better understand the display problem.

    The problem I am currently experiencing is that each unique user can make multiple comments on a single post. They should only have the capability to make 1 comment to each post.

    And when a user makes a second comment (which they are not allowed to do) that’s when the malfunction occurs and the input box overlaps the reply box.

    I’m unclear on what’s happening here. You say that users “are not allowed to” leave a second comment on a post, but I guess what you mean is that you don’t *want* them to be able to do it?

    I don’t know of a ready-made plugin that would allow you to limit commenting in the way you’ve described. It would probably be possible to write a small bit of code that would make it work, but I’d need a clearer understanding of what you’re trying to accomplish. If I understand https://buddypress.org/support/topic/how-do-i-make-the-comment-button-read-only-in-the-activity-stream/#post-269197 correctly, you mean that users ought to be able to leave a single *top-level* reply to a given activity item, but they should be able to leave as many replies-to-comments as they want. Is that correct?


    naomibuch
    Participant

    @naomibuch

    Hi Boone,

    I uploaded an image to the link you provided, the file is called “Comment_Overlap”. I took a peek at the Twenty Sixteen theme this is exactly how I want my Activity Stream to flow and function.

    Please advise on what you think I am doing wrong.

    Thanks,
    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Boone,

    You said:

    I’m unclear on what’s happening here. You say that users “are not allowed to” leave a second comment on a post, but I guess what you mean is that you don’t *want* them to be able to do it?

    Correct, I am sorry if I were not clear, no I don’t *want* them to be able to make multiple comments to 1 post, only multiple replies.

    Thanks,

    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Again,

    If I understand https://buddypress.org/support/topic/how-do-i-make-the-comment-button-read-only-in-the-activity-stream/#post-269197 correctly, you mean that users ought to be able to leave a single *top-level* reply to a given activity item, but they should be able to leave as many replies-to-comments as they want. Is that correct?

    Correct. That’s exactly what I want. Similar to Facebook.

    Thanks,

    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Again,

    Should I give you access to my website? Or do you have a better understanding of the problem now?


    Boone Gorges
    Keymaster

    @boonebgorges

    > Should I give you access to my website? Or do you have a better understanding of the problem now?

    Hi Naomi – I and other members of the site post here as volunteers, so please understand that there may not always be immediate feedback to your posts.

    > I uploaded an image to the link you provided, the file is called “Comment_Overlap”

    Can you please share a URL?

    The following snippet, in your theme’s functions.php or your bp-custom.php file, will prevent users from leaving more than one top-level comment on a given activity item:

    
    add_filter( 'bp_activity_can_comment', function( $can ) {
    	global $activities_template;
    
    	// Users who are already forbidden from commenting should still be forbidden.
    	if ( ! $can ) {
    		return $can;
    	}
    
    	// If the user has already posted to this activity item, disallow more posts.
    	$activity_id = $activities_template->activity->id;
    	$children = BP_Activity_Activity::get_child_comments( $activity_id );
    	foreach ( $children as $child ) {
    		$activity = new BP_Activity_Activity( $child->id );
    		if ( bp_loggedin_user_id() == $activity->user_id ) {
    			return false;
    		}
    	}
    
    	return $can;
    } );
    

    naomibuch
    Participant

    @naomibuch

    Hi Again,

    That code snippet worked almost perfectly!!! But the comments button disappeared, after I posted a comment.

    I still want to see the comment button. After a user comment to a post, I want that comment button to be “Read Only” after update.

    Can you modify the code to where it’s read only after each unique user makes a comment, because the comment button counts the number of comments to each post, and I want the users to be able to view how many comments to each post, is that doable?

    Thanks a bunch.
    Naomi


    naomibuch
    Participant

    @naomibuch

    Hi Again,

    Disregard the previous post, I got it to work perfectly!! 🙂

    Thanks for all your help, is there a way that I can donate to you guys, for your hard work?


    Boone Gorges
    Keymaster

    @boonebgorges

    Glad you got it working!

    You can pay us back by coming back occasionally and answering a support question or two 🙂


    naomibuch
    Participant

    @naomibuch

    You are too kind 🙂

Viewing 17 replies - 1 through 17 (of 17 total)
  • You must be logged in to reply to this topic.
Skip to toolbar