Skip to:
Content
Pages
Categories
Search
Top
Bottom

Solved: set a character limit on activity content?

  • @nit3watch

    Participant

    Iv’e build a plugin that returns the activity ( set it to scope=groups ) similar to twitters homepage vertical scrolling feed.

    The problem is it is displayed in some what of a small area and I would like them to be uniform in size; because if there’s a large activity post, it takes up the entire ‘widget space’. Also the js assigns the height to all elements based on the ‘tallest’ one, so there’s a lot of white space ( if there is a large post in the stream ).

    I had a look at the codex though couldn’t find anything relative to what I need, and ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • @nit3watch

    Participant

    well this is what I came up with, though it doesn’t work. Help would greatly be appreciated.
    `function bp_limit_group_activity_content() {

    $g_activity_desc = bp_activity_content_body();

    $limit_desc = substr($g_activity_desc,0,10);

    return $limit_desc;
    }
    `

    @nit3watch

    Participant

    Found a solution, just cleaning up the function and adding ‘read more’ and so on, will post it when im done.

    @nit3watch

    Participant

    working nicely, just need to filter out ‘joined the group.. and created group.. and remove ‘view’ and delete’.

    Once im done using it for what i need ill turn it into a widget for the community :D

    `function bp_limit_group_activity_content() {

    $group_activity_length = 100; //character limit

    $group_excerpt = substr(bp_get_activity_content_body(), 0, $group_activity_length); //truncate excerpt according to lenngth
    if(strlen($group_excerpt) < strlen(bp_get_activity_content_body())) {
    $group_excerpt = $group_excerpt.’..’ ;
    }

    echo “

    “.$group_excerpt.”

    “; //finally display excerpt
    }`

    and then calling it by
    `

      <li class="” id=”activity-“>

      <a href="”>

    `

    @nit3watch

    Participant

    one thing I over-looked is limiting the line height, Im going to look into this tomorrow though if anyone knows of a solution please don’t be shy :P

    Also is there a filter specific to group updates only, thus excluding ‘joined group’ and ‘created group’?

    @tonydbaker

    Member

    Did you ever create a wordpress/buddypress plugin for this? I need to limit characters on activity, but I’m not a programmer. I can activate a plugin though! Also, I need to limit characters on a couple of custom profile fields. Thanks and Let me know!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Solved: set a character limit on activity content?’ is closed to new replies.
Skip to toolbar