Skip to:
Content
Pages
Categories
Search
Top
Bottom

Edit activity content


  • gisellewc
    Participant

    @gisellewc

    Hi! I need to add information to activities content because I need to show some information based on activity type, but I can’t make it work

    
    function mmAddLocationCategory($activity_content) {
    
        $activity_id = bp_get_activity_id();
        $activities = bp_activity_get_specific('activity_ids=' . $activity_id);
        $activity = $activities['activities'][0];
    
        if ($activity->type){
            switch($activity->type){ 
                case "bbp_topic_create": 
                    $activity_content = $activity_content . "<p class='activity-action'>" . $activity->action . "</p>";
                    break;
                case "updated_profile":
                    $activity_content = $activity_content . '<div class="activity-inner">
                        <a href="' . bp_activity_user_link() . '">"' . $activity->display_name . '</a> &nbsp updated profile details.</div>';
                    break;
                case "joined_group":
                    $activity_content = $activity_content . '<div class="activity-inner">
                        <p class="activity-action">' . $activity->action . '</p>
                    </div>';
                    break;
                default:
                    $activity_content = $activity_content . "<div class='activity-inner'>" . $activity->action . "</div>";
                    break;
            }
        }    
        
        return $activity_content;
    
    }
    add_filter('bp_activity_new_update_content', 'mmAddLocationCategory', 10, 2 );
    
Viewing 1 replies (of 1 total)

  • gisellewc
    Participant

    @gisellewc

    I also tried this, but it isn’t working either

    function mmAddLocationCategory($content, $activity_id) {
    
        $activities = bp_activity_get_specific('activity_ids=' . $activity_id);
        $activity = $activities['activities'][0];
    
        if ($activity->type){
            switch($activity->type){ 
                case "bbp_topic_create": 
                    $content = $content . "<p class='activity-action'>" . $activity->action . "</p>";
                    break;
                case "updated_profile":
                    $content = $content . '<div class="activity-inner">
                        <a href="' . bp_activity_user_link() . '">"' . $activity->display_name . '</a> &nbsp updated profile details.</div>';
                    break;
                case "joined_group":
                    $content = $content . '<div class="activity-inner">
                        <p class="activity-action">' . $activity->action . '</p>
                    </div>';
                    break;
                default:
                    $content = $content . "<div class='activity-inner'>" . $activity->action . "</div>";
                    break;
            }
        }    
        
        return $content;
    
    }
    add_action( 'bp_activity_posted_update', 'mmAddLocationCategory', 10, 3 );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar