Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function fanAddActivity($id) {
- global $wpdb, $bp;
- if(function_exists('bp_activity_add')) {
- if(($image = $wpdb->get_row("SELECT * FROM ".$this->fanimages["table"]." LEFT JOIN ".$this->reqentity["table"]." ON ".$this->reqentity["id"]." = ".$this->fanimages["id"]." LEFT JOIN fanart_types ON image_type = type_id WHERE image_id = '".$id."'")) !== NULL) {
- $type = $wpdb->get_row("SELECT * FROM fanart_sections WHERE section_id = '".$this->reqentity["type"]."'");
- $searchname = $type->section_searchfield;
- $altsearchname = $type->section_altsearchfield;
- $showname = (trim($image->$searchname !== "")) ? $image->$searchname : $image->$altsearchname;
- $post_permalink = '/'.$type->section_detailpage.'/'.$image->{$this->fanimages["id"]}.'/'.$this->seoUrl($showname).'/';
- $user_id = $image->image_author;
- $activity_action = sprintf( __( '%1$s had an image approved for the %2$s %3$s', 'buddypress' ), bp_core_get_userlink( $user_id ), $type->section_detailpage, '<a href="' . $post_permalink . '">' . apply_filters( 'the_title', $showname ) . '</a>' );
- $args = array(
- 'id' => false, // Pass an existing activity ID to update an existing entry.
- 'action' => $activity_action, // The activity action - e.g. "Jon Doe posted an update"
- 'content' => '<img src="/thumb.php?src=/fanart/'.$this->fanimages["folder"].'/'.$image->{$this->fanimages["id"]}.'/'.$image->type_var.'/'.$image->image_url.'&w=190">', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
- 'component' => 'profile', // The name/ID of the component e.g. groups, profile, mycomponent
- 'type' => 'activity_update', // The activity type e.g. activity_update, profile_updated
- 'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
- 'user_id' => $user_id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
- 'item_id' => $this->reqentity["type"], // Optional: The ID of the specific item being recorded, e.g. a blog_id
- 'secondary_item_id' => $id, // Optional: A second ID used to further filter e.g. a comment_id
- 'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded
- 'hide_sitewide' => false // Should this be hidden on the sitewide activity stream?
- );
- bp_activity_add($args);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement