Using activity as wire in Buddypress 1.2 themes

I have updated this tutorial for BuddyPress 1.6 & BuddyPress 1.7. Please read the updated tutorial here

Do you miss the wire of buddypress 1.x era. Yes, you can use the activity as wire. You might have seen it on buddypress.org profile.

Here is a screenshot from my dev btw

Thanks to Andrew for asking this question and here is the way to use activity as wire.

How to do it:

You will need to edit at 3 places.

  • We will edit members/single/activity.php
  • activity/post-form.php and
  • functions.php

Step 1: Showing the form on other user’s profile

Let us start with members/single/activity.php

Since we want the post forum to appear on all the users profile, we will change a line in the members/single/activity.php

on line 39-41 in bp-default theme(or find the relevant line in your theme)’s activity file you will see something like this

[sourcecode language=”php”]

<?php if ( is_user_logged_in() &&bp_is_my_profile()&&( ” == bp_current_action() || ‘just-me’ == bp_current_action() ) ) : ?>
<?php locate_template( array( ‘activity/post-form.php’), true ) ?>
<?php endif; ?>


Now we need the form on other users profile, so change it to

[sourcecode language=”php”]

<?php if ( is_user_logged_in()&&( ” == bp_current_action() || ‘just-me’ == bp_current_action() ) ) : ?>
<?php locate_template( array( ‘activity/post-form.php’), true ) ?>
<?php endif; ?>


So, we have taken out the condition bp_is_myprofile() and now the form will be displayed on other users profile too.

But wait, did you notice that silly drop down below the form which will appear on other users profile as shown above.

No problem, let us tweak the form slightly.

Step2: Customizing the activity post form

Open bp-default(or your theme)/activity/post-form.php

on line no. 36 of the file(or please check the condition in your theme) you will see something like this

[sourcecode language=”php”]

<?php if ( function_exists(‘bp_has_groups’) &&!bp_is_my_profile() &&!bp_is_group() ) : ?>


Let us change it to

[sourcecode language=”php”]

<?php if ( function_exists(‘bp_has_groups’) &&!bp_is_member() &&!bp_is_group() ) : ?>


We have simply changed the conditional from bp_is_myprofile() to bp_is_member(), so the dropdown will not show on any user’s page. It should look as shown below.

If you have completed the above steps, you should pat on your back, ohh yes, you are 30% done πŸ˜€

ok, ok, let us give the final touch.

Step 3: Handling the posting of message

What we need more is we need to handle the special case of using activity form to post on other users profile.

That’s easy. We will remove the ajax action which comes by default in bp-default theme and add our own to handle the update.

Add the following lines to your functions.php

[sourcecode language=”php”]

/** all the credit to @apeatling, the code below is a modified version of apeatling’s code for function bp_dtheme_post_update in bp-default/_inc/ajax.php */

//let us remove the default handler for activity posting

remove_action( ‘wp_ajax_post_update’, ‘bp_dtheme_post_update’ );
//add our own handler for activity posting

add_action( ‘wp_ajax_post_update’, ‘bp_mytheme_post_update’ );

/* AJAX update posting */
function bp_mytheme_post_update() {
global $bp;

/* Check the nonce */
check_admin_referer( ‘post_update’, ‘_wpnonce_post_update’ );

if ( !is_user_logged_in() ) {
echo ‘-1’;
return false;

if ( empty( $_POST[‘content’] ) ) {
echo ‘-1<div id="message"><p>’ . __( ‘Please enter some content to post.’, ‘buddypress’ ) . ‘</p></div>’;
return false;

if ( empty( $_POST[‘object’] )&& function_exists( ‘bp_activity_post_update’ ) ) {

//this is what I have changed

$content="@". bp_get_displayed_user_username()." ".$_POST[‘content’];

$activity_id = bp_activity_post_update( array( ‘content’ => $content ) );

//end of my changes
} elseif ( $_POST[‘object’] == ‘groups’ ) {
if ( !empty( $_POST[‘item_id’] )&&function_exists( ‘groups_post_update’ ) )
$activity_id = groups_post_update( array( ‘content’ => $_POST[‘content’], ‘group_id’ => $_POST[‘item_id’] ) );
} else
$activity_id = apply_filters( ‘bp_activity_custom_update’, $_POST[‘object’], $_POST[‘item_id’], $_POST[‘content’] );

if ( !$activity_id ) {
echo ‘-1<div id="message"><p>’ . __( ‘There was a problem posting your update, please try again.’, ‘buddypress’ ) . ‘</p></div>’;
return false;

if ( bp_has_activities ( ‘include=’ . $activity_id ) ) : ?>
<?php while ( bp_activities() ) : bp_the_activity(); ?>
<?php locate_template( array( ‘activity/entry.php’ ), true ) ?>
<?php endwhile; ?>
<?php endif;


Now go, check others profile and write some message, check their @mention tab and feel good about the wire.

If you take a look closely, there is a catch still there, when you are on other users profile it still asks you what’s new mr. awesome ?, well awesome should be your first name, we need to change it to displayed user’s name, should not we.

So, we need to modify the activity/post-form.php again.

This time, we will modify the following lines(for bp-default, it starts on line no. 17)

[sourcecode language=”php”]

<?php if ( bp_is_group() ) : ?>
<?php printf( __( "What’s new in %s, %s?", ‘buddypress’ ), bp_get_group_name(), bp_get_user_firstname() ) ?>
<?php else : ?>
<?php printf( __( "What’s new %s?", ‘buddypress’ ), bp_get_user_firstname() ) ?>
<?php endif; ?>


Change it to

[sourcecode language=”php”]

<?php if ( bp_is_group() ) : ?>
<?php printf( __( "What’s new in %s, %s?", ‘buddypress’ ), bp_get_group_name(), bp_get_user_firstname() ); ?>
<?php elseif(!bp_is_home()&&bp_is_member()): ?>
<?php printf( __( "Write something to %s?", ‘buddypress’ ), bp_get_displayed_user_fullname() ) ;?>
<?php else : ?>
<?php printf( __( "What’s new %s?", ‘buddypress’ ), bp_get_user_firstname() ) ; ?>
<?php endif; ?>



And here is the screen shot again

Now your freaking awesome activity as wire setup is ready. Enjoy and feel free to leave your comments/suggestions for further improvement of this already awesome technique πŸ˜€

For those of you, who want my modified codes/pages of default theme, I have bundled them as a child theme of bp-default here. You may want to use this wired Child Theme or just move individual files to their respective folders in bp-default(or the child theme for better future updates). Try The wired Child and experiment for more πŸ™‚

Download Link:-https://buddydev.com/http//buddydev.com/public-download/wired-child.zip

118 Responses to Using activity as wire in Buddypress 1.2 themes

  • Great tutorial! Think this should move into core (maybe it will :-))

    • i have a custom theme and want to add a “ask a question” box on each persons page w/comment capability, etc; would i use the same code or can you assist me in creating code by any chance?

      • email me or replay asap in regard to my pots, thanks.

        • sorry Chris, I missed your comment. I hope you got a solution to you need.

  • wow very detailed Brajesh…thanks for this tutorial..appreciate it as always thanks!!


  • Great tutorial Brajesh!

    I need to adjust 2 things though:

    1 – How to prevent this type of update from being added to the Activity Stream? I’m thinking users will likely tend to think of this feature as a “semi-private” means of communication.

    2 – How to hide the Gallery Updates on this form? Members can now add media to other members’ galleries – not good πŸ™


    • PCWriter:

      I had the same problem. I found a fix that worked (for me at least).

      I had originally posted the new code for ‘functions.php’ in the child theme instead of the parent theme’s functions.php file.

      I tried moving the code from the child theme to the parent. Success! It fixed the double post problem!

      • Hi Doug,
        Thanks for posting it.
        I am sure It will help others.

        • Was the double post thing you were seeing that the post goes on your own wall twice, as a post and as a mention? I’m seeing this, but moving the code to a parent theme is not an option. Any idea why this is happening and what difference the location of the code would make?

  • hi Patrick
    Thanks for the comment.
    Well, The problem is if I use activity to not to be part of the sitewide activity stream, It will become as a private wire, i.e. the post will be visible to the one who posted and the one to which it was posted. Other users will not be able to see the message?Is it ok.
    If yes, please check the function.php code from here

    Replace the code of functions.php of the wired-child theme with this one and It will make the activities private. there is a bug with private activity though, the poster of the activity will only be able to see it on his own profile not on the @mention tab of the one whom he posted. I am going to report it on track.

    For the second issue, that is related to bp-gallery, It should not allow other user to add media to displayed user(until you are logged in as admin), but showing the option is bad, so we can remove it by putting the following code in functions.php


    Hope that helps.

    • @Brajesh

      Sorry for not replying for a while, I got a bit sidetracked by my Dad’s declining health.

      Thanks for the above, it worked fine. But I now have issues with updates appearing twice in the activity stream (on both profile and home pages).

      Any ideas?

  • Hey!
    It looks very nice!
    At the moment I use your BP-Wire Plugin.
    Should I change to this method?


    • I will not advise to switch bp-wire to this one, bp-wire provides a little better option(not adding the updates to public).

  • First thanks for your useful articles and lessons it’s Wonderful , my question is when i write some thing on another one page it’s appear on my activity and appear on his mentions tab, i want when i write some thing on his wall or activity page it appears on his activity page not on mentions tab how can i do that ?

    and how can i use activity_meta table if there is any article talk about that

    Thanks & Regards

    • Hi Ahmed,
      Thanks for the comment.
      You are right about the appearance of the message.
      Basically we are using mention feature to act as the wire/wall.

      When you write something, It can not appear on someone else’s activity(because buddypress will list only those activities done by a user in his activity stream).

      If you want to manipulate activity yourself, use the following 3 functions to manipulate them

      bp_activity_update_meta( $activity_id, $meta_key, $meta_value )
      bp_activity_delete_meta( $activity_id, $meta_key = false, $meta_value = false )

      hope that helps.


  • Hi Brajesh,

    Thank you very much for your replay.

    Can i use activity_meta to do that ? for example i’ll save the id for the user that some one wrote on his wall and update the activity with new activity type like “wall_comment ” and get the activity with this meta to display the activity on his wall ?

    or i can’t made this feature

    because i’m making Facebook like wall and i finished every thing only display the other users comments on the wall remains


  • Hi Brajesh ,

    Any help about my previous question ?

    • You can make that feature but it will require 3 things.
      1.familiarity with jQuery
      2. you will need to edit bp-default/_inc/ajax.php
      3. you will need to edit bp-default/_inc/global.js

      and lastly the activity template members/single/activity.php and activity/entry.php to make it happen.

      Btw, your assumption is absolutely correct. you can store the person who writes the comment in activity meta and it will appear on other persons activity.

  • Hi Brajesh ,

    Again thank you very very much for your help and replay

    i’ll try to do it as you explain to me.

    Best Regards


  • I would like to do a little something different with this.

    1. I would like the post-form to also appear on the profile page.

    2. I would like to remove the @mentions links and place those posts on the profile page.

    This will allow members to leave messages for each other on their profile page.

    Thanks, Jesse

  • Howdy Brajesh! Thanks for the article.
    However when I perform the changes to the functions php, I try to load the site and I get an erro because of an unexpected T_EndIf
    I’m adding the 55 lines of code you provided at the end of the functions.php

    Is that where I should paste the code?

    Thank you so much in advance!

  • Howdy Brajesh. I followed each step carefully, but the coded added to the functions.php gives an error when trying to load the website…. Unexpected T_endif…

    Hope you can help me.



  • Hi Brajesh.

    Great tutorial! However, there is a glitch in the replacement code of the last step.

    It appears that when you typed a colon and then tried to type the PHP exit code, you failed to put a space between the colon and the question mark of the exit code. Then the site interpreted that as a smiley. The code thus now has the full markup to produce the smiley, instead of simply the colon and the question mark. Thus, this:

    <?php else >

    …should have been this.

  • Umm, I tried to post the code inside back ticks, but the site did not like it. But you get the idea.

  • Brajesh

    Just as PCWriter posted back in June, I also am having an issue where the post is appearing twice. For instance, it shows up twice in the site wide activity stream, once with the @username, and once with out it. I suspect it’s something in the code added to the ‘functions.php’ file. Any ideas?

  • If we could get rid of one and keep the other, the one with @user would be the one to keep, because the site wide activity stream has no other way for the readers to know to whom the comment was directed.

  • I should add that I am using a child-theme of bp-default (Fishbook Buddypress Buddypack), and I added the code for ‘functions.php’ to the child-theme’s ‘functions.php’, not the parent’s. Since the child theme did not have the other files present, the rest of the code changes were done in the parent.

    I can switch the code to the parent’s ‘functions.php’ and see if it makes any difference, but I don’t see how it would. Worth a try I suppose.

  • Success! Moving the new functions.php code from the child theme to the parent, fixed the double post problem! πŸ™‚ I am so pleased. Thanks again for such a great tutorial!

    • Hi Doug,
      Thanks for the comments. I am sorry, I could not help you but glad to know it worked for you πŸ™‚


    • Joseph – thanks a lot – solution works!

  • Hey Brajesh πŸ™‚

    Thanks a lot for this easy to follow tutorial, everything worked fine for me until the last step. I end up with this error when i visit a member’s profile:

    “Parse error: syntax error, unexpected ‘<', expecting ':' in /home/********/public_html/wp-content/themes/bp-social/activity/post-form.php on line 22"

    Does this mean i need to replace the "<" with ":" ? i haven't tried that, as am not that good when it comes to php codding πŸ™‚

    Thanks again.


    • Hey again πŸ™‚

      I got it working by removing the smiley line…the error is gone now! but something weird is happening…not sure if this how its suppose to function, but when i post an update on a member’s profile! instead of appearing there, it doesn’t…instead, it appears as a mention :S is this how it function?

      • Thanks Daniel.
        I just removed that smiley. It was parsed by the code highlighter plugin wrongly.

  • hi, this is a great addition for a site, i have one problem, i get an error which says

    Parse error: syntax error, unexpected ‘;’ in /home/thepinoy/public_html/wp-content/themes/simple-wp-community-theme/functions.php on line 91

    when adding the 55 ines of code up there, does anyone know what could fix this?

  • its this line it is refferring to

    if ( empty( $_POST[‘object’] ) &amp;&amp; function_exists( ‘bp_activity_post_update’ ) ) {

    • Hi Blair,
      It may be because of the code you have copied from here.
      Please download the wired child theme and copy the code from functions.php, that should solve the issue.

    • Thats because some code got translated when posted here.. you have to change the “& &” etc to 2 ampersigns… (&&) <- im not sure it will show it.. theres another line of code that does that also, so change that too.

      • it got messed up.. I meant, change the & amp & amp & amp & amp to &&

  • Thanks for this great and understandable tutorial! It helped me a lot.

  • Brajesh! I just found this on your site.. prior to this, Ive been using the wire plugin but I felt buddypress was kind of confusing since there was now a way to post on activity and on wire.. (and how to explain that to members – I get it of course, but lots of people get confused easily, or they dont even try) but this method you have here is very nice! i just finished it at 5am and can go to sleep happy. lol πŸ™‚ I really like this alot. I think this should be a part of buddypress core also. πŸ™‚ Thanks Brajesh! You’re always very helpful.

    • Hi Shane,
      Thanks for the comment.
      I am glad, you found it helpful πŸ™‚

  • Pingback:BuddyPress Tutorial Roundup: 15 Useful Hacks and Customizations - WordPress, Multisite and BuddyPress plugins, themes, news and help – WPMU.org

  • To show all @mentions on each profile add this hack on bp-activity/bp-activity-classes.php on function get_filter_sql on line 599 the code is the following:

    if ( !empty( $filter_array['user_id'] ) ) {
    $user_filter = explode( ',', $filter_array['user_id'] );
    $user_sql = ' ( a.user_id IN ( ' . $filter_array['user_id'] . ' ) )';
    $filter_sql[] = $user_sql;

    change to:

    if ( !empty( $filter_array['user_id'] ) ) {
    $user_filter = explode( ',', $filter_array['user_id'] );
    $user_sql = " ( a.user_id IN ( " . $filter_array['user_id'] . " ) ";
    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;

    • Hi Sergio ,
      Thanks for taking time to post the hack. Much appreciated.

    • i cant find bp-activity-classes.php

    • Thanks Sergio, I did you.. You guyz totally Rock!!

    • when i post a comment on anothers profile… it shows up right then and there… but the moment i refresh my page… it’s gone. Well, its gone from the “personal” activity feed… but it remains in the “@mentions” feed… so, this hack by sergio will enable the system to keep your posted comment on the main “personal” feeditself… because it gets all those @mentions and puts it out on the personal feed..

      @sergio… this is such an awesome hack! thank you so much…


    • thanks a lot Sergio!!! works well!!

  • When I put functions into functions.php I get:

    Parse error: syntax error, unexpected ‘;’ in /home/content/47/6114047/html/wp-content/themes/arras-theme/functions.php on line 89

    • Hi SVC,
      Please use the attached zip file and copy the code from that. Make sure to check you have correctly put the beginning and ending php tags in your functions.php

  • God! You are the best! Thanks for all these!

    • Thanks for the comment Dia. I am glad, these posts helped you πŸ™‚

      • As always, Thank you so much Brajesh! Yeah it worked!

        • Opps, that’s my reply in your other post! Sorry!

  • Thanks for this, great tutorial Brajesh as well as everyones useful comments. Every question I had turned up in comments except this one. I’ve followed a lot of the advice here and have it set up where @mentions are showing up on profile.

    The problem is it is creating a duplicate content issue for me in the activity stream. The problem comes from the “User posted a new activity comment” in reply to (xxxx)

    The information here is duplicate and already on the profile in the “posted a update” and replies under it.

    How do I fix this, thanks much

  • I cant seem to get the functions.php code to work?

    I get the following error?

    Parse error: syntax error, unexpected ‘;’ in /home/scooduc/public_html/wp-content/plugins/buddypress/bp-themes/bp-default/functions.php on line 386

    Please help!

  • tim #

    I might be missing something, but I don’t understand how this differs from activity in 1.2.8?

    What does wire have that activity doesn’t please?

    • Hi Tim,
      The wire gives a feel of public message system. The activity comments will get mixed with other activity items while wire will show the comments but not other activity stream entries(say joining groups/adding friends etc). Overall, it is just a matter of feelings and comfortability.

  • Does this work with the newest version of Buddypress? If so I am having a problem finding the files you mention needs to be edited. I don’t see a members file?

    • Hi James,
      yes it works with Bp 1.2.8. The “members” is not a file but directory. you can see it inside the buddypress/bp-themes/bp-default directory.

      • This does not still work.

  • Sam #

    This tutorial is out dated now and the code you are suppose to add to your functions file will break your entire site.

    • Hi Sam,
      The code is not outdated.The code is causing trouble of my highlighter plugin and I am updating it soon. For the time being, you/anyone else interested can use the code from the attached theme’s functions.php. that will work.

  • What a great tutorial. This is pretty much exactly what I was looking for. I wish I could figure out how to make all users comments appear to all users even when it’s on the personal activity feed though. Kind of like posting wall to wall on facebook.

  • Just copying and pasting the functions code to your functions file of a freshly installed Buddypress with the default theme with not plugins or anything else at all, it will crash the entire site.

  • Actually, copying and pasting the functions code from the “wire-child” theme will work, but something in the functions code above is screwed up.

    • Thanks for the comment Alan. I am glad it finally worked for you. yes, the codes on this site needs to be checked for proper accuracy as some of them have been garbled by the highlighter plugin. Will be doing a review on all the codes in coming week.

  • This is great!
    really awesome. I used it straight away.

  • @brajesh am having a problem with the code u asked me to paste in functions.php … it pulls the site down… am using bp-default with bp1.2.8 and wp3.1.3 … could u PLEASE help… i’d love to use this hack on my site.

    • actually.. never mind, i used the code from the functions.php of the attached theme (like u suggested in a previous comment)… and it worked like a charm!! you’re a genius man!! awesome!

      • when i write an update on a friends activity stream after i enable the method you mentioned above.. it posts fine. But why is it that an “@username” symbol comes before every comment i write… is it possible to remove this? please… if u have an answer would much appreciate it.

        • Hi Siddharth,
          That is the essence of this method. It uses @mention to emulate wire for the user.

        • actually the answers pretty simple: in your code of functions.php, there is a certain line:
          $content=”@”. bp_get_displayed_user_username().” “.$_POST[‘content’];

          well… you need to replace it with:
          $content=”@”. bp_get_displayed_user_username().””.$_POST[‘content’];

          and further in my theme css … i defined class=”hide”… as display:none…

          thanks brajesh for some awesome work…

  • Is the tutorial still good with the current version of buddypress? i tried using it but gives me an error.

    • Hi Eyal,
      yes it works with bp 1,2,8.
      Please make sure to copy the code from attached theme’s functions.php. The code in the above example is garbled by syntax hilighter but if you copy it from attached theme’s function.php that will work.

  • thank you. so i open the functions.php in the attached theme and copy the entire code and paste it in my functions.php at the bottom. is that how i suppose to do it? cause now i don’t get an error but when i write something on other member wall it is still posting it in my wall.

  • ok. so i see that i actually post it on the member’s mentions but no on his activity page. (it is showing on activity after posting but disappears when reloading the page). but also now i get lots of errors when i try to log out or to login. (something as to do with the functions.php.

    • Hi Eyal,
      If you are getting error like “header already sent”, please check your functions.php and make sure there is no space before/after the php opening tag

      let me know if that helps or not?

      • yeah, yeah….. it was that space that gave me the error :). thank you. and now after reading the comments people left i understand that it is not suppose to show in the activity only in the mentions. however, would it be difficult to work it around so it will show in activity? cause now we have mentions , wire and activity and it can cause confusion.

        • Hi Eyal,
          Glad it is fixed.
          Regarding showing it in the activity stream, Isn’t wire supposed to be visible on profile only. what would be tghe difference between wire and activity in that case?

  • @sbrajesh… just to improve the functionality a lil bit further.. i wrapped up your code within a condition… so that only friends can post on the wall! and if you’re not a friend.. you dont get to see nothing!

  • ok. so after playing some more with buddypress i think i understand better the mentions and activity (i hope i do). what i have right now after changing some codes is that friend can mention on other friend page (using your code above) and it will also show on activity (using other code). this way friends can post videos images and links on each other activity (using the buddypress activity plus plugin) and everyone will see it(kinda facebook style). what i really trying to do is that all friends @mentions will show only under “friends” activity and not global activity. i want to leave the global activity for the home page so any one can post there and everyone will be able to see even guests. and then under friends activity friends will see each other activities and mentions. i need global activity as a global wall and friends activity as an inside (firends )wall. do i make any sense ?
    thank you

  • What would be the easiest way to display a message after the ‘status’ has been posted? Im using it in my sidebar, thus the user is not necessarily on the activity stream to see their message was posted. The functionality is 100%, i just need to show a message after it was done.

    • Hi Francois,
      I am not sure how you got it working in the sidebar. In case it is working properly, you can just edit the javascript a little bit to put the notification of a successfully publishing.

  • THank you SO much for this!! It took me a bit to get it working properly, but now that I’ve got it I’m very very happy! I do have one small question, is there a way to make it so when you post on someone’s wall it doesnt come up as your “status update” FOr ex. I have “hope everyone has a great weekened” as my status, but then when i post on someone’s profile that goes away and it will say @user and whatever I posted to them. Thanks for all your help and hard work!!

  • Unfortunately I cannot get this to work on my site.

    I copied the code from the zip file you have and I do not get any errors.

    I see the form on another members activity page, but when I write something, nothing shows up in there @mentions page. And on my activity page it says that I “posted and update”. So essentially it us updating my status, instead of writing something to the other other member.

    Any suggestions?

  • This is one of greatest tutorial for buddypress!
    dunno why isn’t this core?

  • I managed to get this working on bp 1.5 beta 3
    every bp_is_member hast to be changed to bp_is_user

    also chunk of code located in functions.php in child theme has to be moved to child theme folder (it is funny thing because in previous version of BP when function was in child theme posts were doubled as @Doug_Joseph wrote before and moving functions to child theme solved the issue but NOW when left in child theme – posting doesn’t work at all – when moved to child theme – posts double:/)

    finally for the hack written by @Sergio
    rhis lines

    if ( !empty( $filter_array['user_id'] ) ) {
    $user_sql = BP_Activity_Activity::get_in_operator_sql( 'a.user_id', $filter_array['user_id'] );
    if ( !empty( $user_sql ) )
    $filter_sql[] = $user_sql;

    have to be swaped to

    if ( !empty( $filter_array['user_id'] ) ) {
    $user_filter_my = explode( ',', $filter_array['user_id'] );
    $user_sql = BP_Activity_Activity::get_in_operator_sql( 'a.user_id', $filter_array['user_id'] );
    if ( !empty( $user_sql ) )
    $filter_sql[] = $user_sql;

    foreach ( $user_filter_my as $user_id ) {
    $search_terms = '@' . bp_core_get_username( $user_id ) . '<';
    $user_sql .= "OR ( a.content LIKE '%%".like_escape($search_terms)."%%' ) ";

    $filter_sql[] = $user_sql;


    hope this will be useful for anybody -i’m still dealing with double posts

    • Thank you Michael for posting.
      I will update this tutorial when Bp 1.5 is finally released.

  • @all,
    I am sorry If I could not reply you earlier. I will be testing it with BuddyPress trunk and posting about the issues/solution as pointed in most of the comment here(regarding double posting).


  • Brajesh is there any chance you could submit this to buddypress?? in order to make it core??this would be so good as core functionality

  • Hi, first of all thank you very much for this great hack. Is it possible on post-form to display only the first name of the user (Write something to FIRSTNAME not FIRST+LASTNAME)?

    Thank you,

  • -Can we know now what its the code that works on the 1.5 this feature its a must actually!

  • Thanks for this fix. I’m not too sure I understood the fix for the double posting? I have to move the functions.php file to the child theme?

    @michal “also chunk of code located in functions.php in child theme has to be moved to child theme folder (it is funny thing because in previous version of BP when function was in child theme posts were doubled as @Doug_Joseph wrote before and moving functions to child theme solved the issue but NOW when left in child theme – posting doesn’t work at all – when moved to child theme – posts double:/)”

    • I fixed the double posting by adding exit(); at the end of function bp_mytheme_post_update() !

  • tim #

    has this tute been updated for 1.5 yet?

    • Hi Tim,
      Sorry, I haven’t yet tested it with Bp 1.5. will be doing so this week.

    • Thanks for the solution Stephen

  • Hello! I want to change the name of the wire from Activity to something like “Wall.” Please reply ASAP

    • Please use the buddypress languages folder in buddypress/bp-languages to translate.

  • I tried getting this working on Newest version of buddypress but can’t seem to get it right.

    • Forget it, Michal fixes work brilliantly!!

  • This is my favorite change to my site. I, however, just ran into a problem and I’m not sure how or if it can be fixed. I have everything setup properly with buddypress 1.2.1 and came across a new plugin Buddypress MyMood which is working well however now I cannot post on someone’s profile. When I do it comes up as a regular status update (with now @member) and does not stick on the person’s page. Any thoughts?

  • very nice indeed. But I cannot restrict it to friends. I tried the is_user_friends_activity, but I could not get it to work. How anybody have any idea?

  • Hi there. Firstly…GREAT tutorial/hack! You rock!
    The site I’ve implemented this on is chefkey.com. It is a members (free) only site, very FaceBook’esque.

    The site is built on BP 1.5.5 using the Parallelus Mingle Theme 1.5.3 <<(is a BP ready theme) on WP 3.3.2

    I've followed the step-by-step outlined above and have the basic function working…however. Yes I know, there is always a "BUT" involved…LOL

    ISSUE: I still don't understand how to have the wire/wall message show on both send and recipient's walls? I'm not certain where in the function file I need to modify and how to modify it appropriately.

    I have added the following to the function file in Mingle Theme:
    /* AJAX update posting */
    function bp_mytheme_post_update() {
    global $bp;

    /* Check the nonce */
    check_admin_referer( 'post_update', '_wpnonce_post_update' );

    if ( !is_user_logged_in() ) {
    echo '-1';
    return false;

    if ( empty( $_POST['content'] ) ) {
    echo '-1′ . __( ‘Please enter some content to post.’, ‘buddypress’ ) . ”;
    return false;

    if ( empty( $_POST[‘object’] ) && function_exists( ‘bp_activity_post_update’ ) ) {

    $content=”@”. bp_get_displayed_user_username().””.$_POST[‘content’];
    $activity_id = bp_activity_post_update( array( ‘content’ => $content ) );
    } elseif ( $_POST[‘object’] == ‘groups’ ) {
    if ( !empty( $_POST[‘item_id’] ) && function_exists( ‘groups_post_update’ ) )
    $activity_id = groups_post_update( array( ‘content’ => $_POST[‘content’], ‘group_id’ => $_POST[‘item_id’] ) );
    } else
    $activity_id = apply_filters( ‘bp_activity_custom_update’, $_POST[‘object’], $_POST[‘item_id’], $_POST[‘content’] );

    if ( !$activity_id ) {
    echo ‘-1’ . __( ‘There was a problem posting your update, please try again.’, ‘buddypress’ ) . ”;
    return false;

    if ( bp_has_activities ( ‘include=’ . $activity_id ) ) : ?>

    <?php endif;
    add_action( 'wp_ajax_post_update', 'bp_mytheme_post_update' );

    function mytheme_remove_original_update_func(){
    remove_action( 'wp_ajax_post_update', 'bp_dtheme_post_update' );

  • Hey Brajesh….I am getting this error:
    Parse error: syntax error, unexpected ‘;’ in /home/******/public_html/wp-content/themes/******/functions.php on line 28

    when adding the code to functions.php file….What can I do to fix this?
    I am using a child theme and the only code I have in my functions.php file is what you said to put in…How can I fix this…..is it not compatible with latest wp and bp versions?

  • Hi Brajesh,

    Thanks for your remarkable tutorials, it’s very useful…

    I followed your instructions and now it works just fine but I have an issue, I’m using buddypress activity plus plugin to be able to post media on my activity stream. I can now also post media to my friends activity stream but the mention symbol doesn’t appear, the posted media appears on my friend’s wall but on my wall; it appears as if I posted it to my wall (without the mention symbol).. How could this be fixed?

    Thanks in advance

  • Hey Brajesh, love this plugin. Just noticed something odd though, on the global activity, the status update is posted twice. But on the user’s profile, it is posted once. Could you help me out a bit? Cheers.

  • Actually, just an update, I realized that the status update posts once on the page where the form is, and twice everywhere else. For example, when I posted a status on the global activity stream, it posted once on that page, but it posted twice in my profile, and on my friend’s activity streams (under the tab “Friends”), and vise-versa.

    Can you help Brajesh?

  • Hey Brajesh, I really enjoy this plugin, I think it should be core for buddypress for sure. Now really quick, I have a few things not working quite right with this plugin.

    First, let me tell you what I have:
    1. I copied the code from above, except for the funcitons.php. For the functions.php code, I copied the code that you posted in a comment in May 17th, 2010 to hide the status/comment from being on the Activity Stream, and only appear in a profile and the @ person’s mentions.

    2. I have copied the code that Michael posted on September 1st, 2011 (its a hack that goes into bp-activity, bp-activity-classes.php to let the @ mention comment show up in the person’s profile who was mentioned)

    Now, that being said, I have faced a few issues:
    1. When I @ mention a person, from their profile, it does not show up on their activity or mentions, but will appear in my profile. If I @ mention them from the Activity Stream, it shows up on both their activity and mentions plus my profile.

    2. Is there a way to not have a person’s status change when I @ mention them?

    Thank you.

    • Hi Katya,
      Here is the code that you need in your functions.php or bp-custom.php (do not use the code in the post as It won’t work with Bp 1.6+)


      This code will do both the things you wanted.

      • Thank you very much. It still shows up in the global activity stream though, but everything else seems to be fixed.

  • Hi All,
    I have updated this tutorial for BuddyPress 1.6 and BuddyPress 1.7 trunk. Please read the updated tutorial here.

    The updated tutorial fixes the double activity bug and also the status update issue.