Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

[Resolved] How to edit items in bp_activity_action (9 posts)

Started 1 year, 2 months ago by: embergermedia

  • Hello Buddy Press World!

    I have had 2 weeks of sleepless nights prepping our Buddypress child theme. And I have hit a road block that has me stumped after several hours of googling. Hope there is help

    I am changing all links attached to user avatars and displayed user names to a custom link. So far I have been able to do this across most of the theme. The area that has me stumped is the comment section with in the activity loop.

    I see that the info I need to change is controlled by bp_activity_action(). However, I can’t seem to find where this is function is defined.

    So basically I need to change the link structure for the avatar and user name as it is created with in bp_activity_action.

    My child is based on the Default theme.

    Thank you all so much for you help.

    Peace.- Paul

  • Profile picture of Chouf1 Chouf1 said 1 year, 2 months ago:

    Here are all the related to bp_activity_action in BP 1.2.8
    the function is defined in bp-activity-templatetags.php line 515
    Not sure you’researching in the right direction…;-)

    wp-contentpluginsbuddypress 1.2.8bp-activity.php]
    Line 305 : function bp_activity_action_permalink_router() {
    Line 340 : add_action( ‘wp’, ‘bp_activity_action_permalink_router’, 3 );
    Line 342 : function bp_activity_action_delete_activity() {
    Line 362 : do_action( ‘bp_activity_action_delete_activity’, $activity_id, $activity->user_id );
    Line 372 : add_action( ‘wp’, ‘bp_activity_action_delete_activity’, 3 );
    Line 374 : function bp_activity_action_post_update() {
    Line 409 : add_action( ‘wp’, ‘bp_activity_action_post_update’, 3 );
    Line 411 : function bp_activity_action_post_comment() {
    Line 441 : add_action( ‘wp’, ‘bp_activity_action_post_comment’, 3 );
    Line 443 : function bp_activity_action_mark_favorite() {
    Line 459 : add_action( ‘wp’, ‘bp_activity_action_mark_favorite’, 3 );
    Line 461 : function bp_activity_action_remove_favorite() {
    Line 477 : add_action( ‘wp’, ‘bp_activity_action_remove_favorite’, 3 );
    Line 479 : function bp_activity_action_sitewide_feed() {
    Line 491 : add_action( ‘wp’, ‘bp_activity_action_sitewide_feed’, 3 );
    Line 493 : function bp_activity_action_personal_feed() {
    Line 505 : add_action( ‘wp’, ‘bp_activity_action_personal_feed’, 3 );
    Line 507 : function bp_activity_action_friends_feed() {
    Line 519 : add_action( ‘wp’, ‘bp_activity_action_friends_feed’, 3 );
    Line 521 : function bp_activity_action_my_groups_feed() {
    Line 533 : add_action( ‘wp’, ‘bp_activity_action_my_groups_feed’, 3 );
    Line 535 : function bp_activity_action_mentions_feed() {
    Line 547 : add_action( ‘wp’, ‘bp_activity_action_mentions_feed’, 3 );
    Line 549 : function bp_activity_action_favorites_feed() {
    Line 561 : add_action( ‘wp’, ‘bp_activity_action_favorites_feed’, 3 );
    wp-contentpluginsbuddypress 1.2.8bp-themesbp-default_incajax.php]
    Line 226 : do_action( ‘bp_activity_action_delete_activity’, $_POST['id'], $activity->user_id );
    Line 259 : do_action( ‘bp_activity_action_delete_activity’, $_POST['id'], $comment->user_id );
    wp-contentpluginsbuddypress 1.2.8bp-themesbp-defaultactivityentry.php]
    Line 15 :
    wp-contentpluginsbuddypress 1.2.8bp-blogsbp-blogs-widgets.php]
    Line 42 :
    wp-contentpluginsbuddypress 1.2.8bp-activitybp-activity-classes.php]
    Line 58 : $this->action = apply_filters( ‘bp_activity_action_before_save’, $this->action, &$this );
    wp-contentpluginsbuddypress 1.2.8bp-activitybp-activity-filters.php]
    Line 12 : add_filter( ‘bp_activity_action_before_save’, ‘bp_activity_filter_kses’, 1 );
    Line 21 : add_filter( ‘bp_activity_action_before_save’, ‘force_balance_tags’ );
    wp-contentpluginsbuddypress 1.2.8bp-activitybp-activity-templatetags.php]
    Line 377 : function bp_activity_action_name() { echo bp_activity_type(); }
    Line 515 : function bp_activity_action() {

  • Profile picture of Boone Gorges Boone Gorges said 1 year, 2 months ago:

    Hi Paul,

    If I understand your question correctly, you should be able to find some help in the function bp_activity_new_comment(), in bp-activity.php. Look especially around line 752. That’s where the action is put together for activity comments. In a plugin, you can filter ‘bp_activity_comment_action’ something like this:

    function bbg_comment_reply_action( $action, $userlink ) {
       // Do whatever you want to $action, and then:
       return $action;
    }
    add_filter( 'bp_activity_comment_action', 'bbg_comment_reply_action', 10, 2 );

    Good luck!

  • Thank you, both!

    @Chouf1: Thanks, but I don’t think that is what I am looking for. Here is an example of what I have already done across most of the site:

    <a href="<?php bp_user_link() ?>profile/">
    		<?php bp_displayed_user_avatar( 'type=full' ) ?>
    	</a>
    
    <a href="<?php bp_member_permalink() ?>profile/"><?php bp_member_name() ?></a>

    I want to do this to the avatars and displayed user names for every status update and comment post.

    @Boone: As I alluded to, I haven’t had much sleep lately. So I’ll see if I can wrap my head around this with out asking any more questions. But I may be back!

    I do have one more for now though: I also realized that to fully implement this feature I will need to affect: acomment-meta and acomment avatar as well.

    Edit: I just re read what you wrote. It looks like you, Boone, are already referring to this part. If I understand you correctly, then I also need to affect the activity header for status updates.

    Thanks again!

  • Profile picture of @mercime @mercime said 1 year, 2 months ago:

    @embergermedia added backticks before and after your codes so they show up in forum pages.

  • @mercime Thanks!

    Was too tired, my eyes missed that line just below the comment box :)

  • I think I can be happy for now. This is what I did:

    Added

    define( ‘BP_DEFAULT_COMPONENT’, ‘profile’ );

    to wp-config.php

    So now every instance of the users name, or avatar, links to their profile instead of the wall. Would the experts here say this is a good, upgrade proof, solution?

    Thanks again.

  • Profile picture of @mercime @mercime said 1 year, 2 months ago:

    That’s the way to do it :-)

  • Thanks again @mercime !