Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Insert @username in activity comment replies.


  • giulietta
    Participant

    @giulietta

    Dear support/community I’d like to insert the @username of the activity author in the relative activity comment reply (as done in Twitter). I insert an echo bp_core_get_username(bp_get_activity_user_id()); in the file entry.php and it works well for the first reply level. I tried an echo bp_core_get_username(bp_get_activity_comment_user_id()); for the second reply level but it does not work. If I put this commant in comment.php using a $GLOBALS variable but when I read such variable in the entry.pho I get the wrong username (the last one of the loop. Can someone help me. please?
    Thanks in advance!
    Giulietta

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

  • giulietta
    Participant

    @giulietta

    Hi, perhaps I didn’t explain well… What I need is to pass the comment user id from the file comment.php (the file that creates the reply button) to the file entry.php (the file that creates the comment post form). Can someone help me please? Form me it’s too difficult to implement but for you should be very easy.
    Thanks in advance!
    Giulietta


    giulietta
    Participant

    @giulietta

    Alternatively the comment username could be taken direcly from current displayed comment. But I don’t know how to do it. Probably with a little js script using closest find command. But I don’t know js 🙁 Any help, please?
    Giulietta


    David Cavins
    Keymaster

    @dcavins

    I’m not sure I’m understanding what you’re trying to do. Can you share an image or similar showing the desired result?


    giulietta
    Participant

    @giulietta

    Thank you very much for your reply!!!
    What I want to do is to echo in the reply comment form textarea “@username” (where username is the username author of the comment I’m going to reply.

    Add the “@username” for activity update relpy is very easy. I edited the file /plugins/buddypress/bp-templates/bp-legacy/buddypress/activity/entry.php

    from:
    <textarea id=”ac-input-<?php bp_activity_id(); ?>” class=”ac-input bp-suggestions” name=”ac_input_<?php bp_activity_id(); ?>”></textarea>

    to:
    <?php $userid” = ‘@’ . bp_core_get_username(bp_get_activity_user_id()); ?>

    <textarea id=”ac-input-<?php bp_activity_id(); ?>” class=”ac-input bp-suggestions” name=”ac_input_<?php bp_activity_id(); ?>”> <?php echo $userid; ?> </textarea>

    and it work!

    On the contrary, when I reply to an activity comment (acomment) I can get the author username by bp_core_get_username(bp_get_activity_comment_user_id()); editing the file: /plugins/buddypress/bp-templates/bp-legacy/buddypress/activity/comment.php
    but the button “reply” created by comment.php open the form created by edit.php and within this file I can get only the activity root user_id and I can’t get the comment user_id 🙁
    I tried also with the GLOBALS variables but noway 🙁

    So what I need is to pass bp_core_get_username(bp_get_activity_comment_user_id()) executed by comment.php to the file edit.php

    If this is not possible or to difficult to perform there is a second possibility.

    When I reply to a comment the post form is opened attached to the right comment. So it is enought to get the username from the <div class=”acomment-meta”&gt in the comment area itself. I tried to do that by a little js inside entry.php but I’m too basic to do that 🙁

    If you need I can give you credentials to work on my test site. But it is a normal wordpress site with only buddypress plugin and the Minimal theme.

    I hope to have been more clear now. If not, I can do another try 😉 but I think that images are not useful for a better explanation of the problem 🙁

    It would be fantastic if you could help me as I can’t solve it by myself 🙁
    Kisses!
    Giuly


    giulietta
    Participant

    @giulietta

    Dear @dcavins,
    are you still there? If you have no time for write the code, could you please give me at least some suggestions?
    Kisses!
    Giuly

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