Skip to:

Modifying @mention link output and adding @mention to post-form.php’s $content before $_post

  • Ok, so this has turned into a two part question.

    1. In my users activity feed (modified to show both @mentions, status updates, photos from bp-gallery etc) it shows guest posts as follows “ @marty hey hows it going” — My Goal is to elinimate the @username and I’ve successfully done this with css by adding “Display: none;” on my “div.activity_data p a:first-child” style selector.

    As you can see this has obvious flaws, it hides any first link in the activity feed data, and its hiding my 1st photo on activity updates made by BP-Gallery.

    So, what I am trying to do, is add a (id=”remove_mention”) to the link that is generated by buddypress for the @mention so I can hide it.

    The closest thing I could find was in (bp-activitybp-activity-filters.php) but had no luck modifying it to include this “id=remove_mention” I could only get it to add the id to all posts.

    2. I have the post-form.php working correctly on profiles that are not the logged in users and am able to leave @mentions but having to manually type in the @mention before the message then post.

    I would like to include the displayed users mention id to the forms data before being posted, (e.g what I’m doing now “ @marty hey hows it going?” would like to type “hey hows it going” and have the @marty attached before posting much like on this site here.

    Any help would be greatly appreciated, these are the last two major things I need to overcome before finishing up this site.

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

  • embergermedia


    @msullens88 How did you combine @mentions, status updates, photos from bp-gallery into one activity feed? I have been looking for the answer to this for weeks. I have an activity feed on a users profile, but can’t get @mentions to show.

    Your help would be greatly appreciated!





    Oh, I have an answer to your question number 2 above:

    I duplicated the post-form, renamed it and call the new form just above their activity. Below is the code for the new form php file


    <form action="” method=”post” id=”whats-new-form” name=”whats-new-form”>

    <a href="”>

    <textarea name="whatsnew" id="whats-new" cols="50" rows="10" onClick="ta(); this.form.whatsnew.value= '@ ‘;” title=”Do not Erase "@"”>@

    This is a PUBLIC message

    <input type="submit" name="aw-whats-new-submit" onClick="at();"id="aw-whats-new-submit" value="” />


    and here is the js for the function calls:

    `function ta() {
    document.getElementById(“whats-new”).style.height = “60px”;
    function at() {
    document.getElementById(“whats-new”).style.height = “20px”;


    This is how I got the mentions in the profile activity feed.

    Edit the file bp-activity-classes.php in the buddypress plugin folder.

    `function get_filter_sql( $filter_array ) {
    global $wpdb;

    if ( !empty( $filter_array ) ) {
    $user_filter = explode( ‘,’, $filter_array );
    $user_sql = ” ( a.user_id IN ( ” . $filter_array . ” ) “;
    foreach ( $user_filter as $user_id ) {
    $search_terms = ‘@’ . bp_core_get_username( $user_id ) . ‘<';
    $user_sql .= “OR ( a.content LIKE ‘%%”.like_escape($search_terms).”%%’ ) “;
    $user_sql .= ” ) “;
    $filter_sql[] = $user_sql;

    and replace this first top half of the function, No need to edit past the first “if” part of that function.

    Hope this helps!




    Thanks- I stumbled across that the other day. I wish it weren’t a core change. Guess we can’t have it all.

    Be well

    Where should I add the js functions ? I think the modifications are working without them anyway :)

    I had to change some variables in order to get the right nicenames ( @username). Thanks for the code !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Modifying @mention link output and adding @mention to post-form.php’s $content before $_post’ is closed to new replies.
Skip to toolbar