BuddyDev

Search

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

  • Participant
    Level: Initiated
    Posts: 16
    Naomi Bollinger on #11842

    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

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #11850

    Hi Naomi,
    before I assist you with the code I will like to explain these two buttons.

    Comment Button:- Allows you to comment on activity

    Reply Button:- Allows you to comment on comment.

    Do you still want to disable reply button?
    You can use this code.

    
    
    add_filter( 'bp_activity_can_comment_reply', '__return_false' );
    
    

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 16
    Naomi Bollinger on #11855

    Hi Brajesh,

    After giving it some thought I actually need both buttons, but I don’t know how to apply the logic in php.

    The logic would go like this:

    After a user post an update, any user can make a comment by clicking on the comment button.

    This is where the logic gets tricky.

    This is an example of a post with no comments below, with the comment button counter set to zero:

    Erik B posted an update 3 days ago ·

    I am having pizza for dinner
    Comment 0 Show/Hide Comments Like

    This is an example of a post with 1 comment, with user nanab replying to Erik B post.

    Erik B posted an update a day ago ·

    I am so tired
    Comment 1 Show/Hide Comments Like
    nanab replied a day ago

    Me too!
    Reply

    So this my problem, the comment button is still clickable and so is the reply button.

    I can click both the comment and the reply button, and when I click on the comment button when a user has made a comment, the comment box over lapse the reply box.

    After thinking about it, I just want the comment button to be “Read Only”, to only show the number of comments made to a post. I don’t want the users to be able to click on comments and a box open for them to edit.

    I just want the users to be able to reply and edit to a comment. I only want the reply button to be editable, not the comment button in a muti-level post.

    Thanks,

    Naomi

  • Participant
    Level: Initiated
    Posts: 16
    Naomi Bollinger on #11857

    Hi Brajesh,

    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.

    Hope that makes more sense.

    Thanks,

    Naomi

You must be logged in to reply to this topic.

This topic is: not resolved