Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using the permalink for an activity “View” link

  • So, I’m creating custom activity types using the `bp_activity_add` function. Currently installed: Buddypress 1.2.4.1. This question is about the “View” link next to an activity in a user’s activity stream. I don’t want it to link to the activity detail page – instead, I want it to link to my custom component. Instead of linking to http://localhost/activity/p/id it should link to http://localhost/mycomponent/id

    I see in the `bp_activity_get_permalink` that several activity types are hardcoded as returning the permalink (new_blog_post, new_blog_comment, etc). while the rest link to /activity/p/id. I *could* add my activity type to this hardcoded list. But I’d rather not. How can I instruct Buddypress to use the permalinks for my custom activities without hacking the `bp_activity_get_permalink` function?

Viewing 1 replies (of 1 total)

  • Roger Coathup
    Participant

    @rogercoathup

    @powers1

    Yes, the display of the activity entries is one of the most annoying / difficult things about theming BuddyPress – too much UI information is embedded and fixed in the core.

    The best approach I can see for your issue is to hook a function onto the bp_activity_permalink filter.

    Your function would have to check if the activity was your new component type, and if so, strip out the permalink info from the string (PHP string hacking), and insert a revised permalink based on your requirement.

Viewing 1 replies (of 1 total)
  • The topic ‘Using the permalink for an activity “View” link’ is closed to new replies.
Skip to toolbar