Skip to:
Content
Pages
Categories
Search
Top
Bottom

activity streams example

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

  • belogical
    Participant

    @belogical

    anyone else done this?

    Gah, as you can tell, not an easy thing to answer. You can really figure it out from the custom component template plugin.

    You need the following in your setup_globals:

    $bp->achievements->format_activity_function = 'dpa_format_activity';

    and this function

    <br />
    function dpa_format_activity( $item_id, $user_id, $action, $secondary_item_id = false, $for_secondary_user = false ) {<br />
    global $bp;</p>
    <p> switch( $action ) {<br />
    case 'new_achievement':<br />
    $user_link = bp_core_get_userlink( $user_id );<br />
    $achievement_name = apply_filters( 'dpa_filter_achievement_nice_name', dpa_get( 'nice_name', array( array( 'type' => 'd', 'key' => 'id', 'value' => $item_id ) ), 1 ) );</p>
    <p> return array(<br />
    'primary_link' => $user_link,<br />
    'content' => apply_filters( 'dpa_new_achievement_activity', sprintf( __( '%s unlocked achievement: %s', 'dpa-achievement' ), $user_link, $achievement_name ) . __( ' <span class="time-since">%s</span>', 'dpa-achievement' ), $user_id, $item_id )<br />
    );<br />
    break;<br />
    }</p>
    <p> do_action( 'dpa_format_activity', $action, $item_id, $user_id, $action, $secondary_item_id, $for_secondary_user );</p>
    <p> return false;<br />
    }<br />

    And to record activity:

    <br />
    dpa_record_activity(<br />
    array(<br />
    'item_id' => $achievement_id,<br />
    'user_id' => $this->user_id,<br />
    'component_name' => $bp->achievements->slug,<br />
    'component_action' => 'new_achievement',<br />
    'is_private' => 0<br />
    )<br />
    );<br />

    edit: stupid forum has ate code. Download my Achievements plugin, look up those functions, copy + paste.


    belogical
    Participant

    @belogical

    OK, all these functions are already present (similar) in my component since I am using the skeleton component. I guess what I don’t understand is what “starts the ball rolling”. what are those functions looking for from my component in order to start the chain reaction of logging the site wide activity?

    that make sense?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘activity streams example’ is closed to new replies.
Skip to toolbar