Thursday, July 8, 2010

Mark blog post as favorite in BuddyPress

«1 Comment»

The current version of BuddyPress for WordPress a key feature is missing that I think the core BP - plugin - should be a part the ability for members of blog posts to highlight, as favorite sein.stattdessen everyone can currently do is brand, the other members activity stream as favorite of posts.

Although it a few plugins that try to do what I describe you are either not supported and cumbersome (BP Favorites), or pretty much the same as the current "favorite" BuddyPress feature (BP-like, I'm talking about you).

I wanted a button on an individual blog posts that says, "Add to Favorites" and allow members to highlight my blog posts, as your Favorites - I also wanted to integrate these favorites in the existing BuddyPress activity stream for future updates to accommodate, who can take care of these things - rather then to create my own tables (as BP Favorites does).

So I did a little research and encodes this function.

Here is how I did it.

(1) Which was first thing I did find out as BuddyPress adds activities in core code, when I found out that this method of bp blogs.php erfolgt.Innerhalb of this method found in Bp_blogs_record_activity published a blog posts I that I can actually get an activity ID of a single blog post by calling the method bp_activity_get_activity_id().Wenn I an activity ID have, can I simply add it anywhere on my site as my favorite.

2. With the above know in hand, I went to my single.php theme template file and added the following in my The_post loop:

Global $ bp;
$ activity_id



View the Original article

No comments:

Post a Comment