Advertisement
KodeStar

Untitled

Jun 26th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.53 KB | None | 0 0
  1.     public function fanAddActivity($id) {
  2.         global $wpdb, $bp;
  3.         if(function_exists('bp_activity_add')) {
  4.            
  5.             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) {
  6.                
  7.                 $type = $wpdb->get_row("SELECT * FROM fanart_sections WHERE section_id = '".$this->reqentity["type"]."'");
  8.                
  9.                
  10.                 $searchname = $type->section_searchfield;
  11.                 $altsearchname = $type->section_altsearchfield;
  12.                 $showname = (trim($image->$searchname !== "")) ? $image->$searchname : $image->$altsearchname;
  13.                 $post_permalink = '/'.$type->section_detailpage.'/'.$image->{$this->fanimages["id"]}.'/'.$this->seoUrl($showname).'/';
  14.                
  15.                
  16.                
  17.                 $user_id = $image->image_author;
  18.                 $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>' );
  19.                 $args = array(
  20.                     'id'                => false, // Pass an existing activity ID to update an existing entry.
  21.                     'action'            => $activity_action,    // The activity action - e.g. "Jon Doe posted an update"
  22.                     'content'           => '<img src="/thumb.php?src=/fanart/'.$this->fanimages["folder"].'/'.$image->{$this->fanimages["id"]}.'/'.$image->type_var.'/'.$image->image_url.'&amp;w=190">',    // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
  23.            
  24.                     'component'         => 'profile', // The name/ID of the component e.g. groups, profile, mycomponent
  25.                     'type'              => 'activity_update', // The activity type e.g. activity_update, profile_updated
  26.                     'primary_link'      => '',    // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
  27.            
  28.                     'user_id'           => $user_id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
  29.                     'item_id'           => $this->reqentity["type"], // Optional: The ID of the specific item being recorded, e.g. a blog_id
  30.                     'secondary_item_id' => $id, // Optional: A second ID used to further filter e.g. a comment_id
  31.                     'recorded_time'     => bp_core_current_time(), // The GMT time that this activity was recorded
  32.                     'hide_sitewide'     => false  // Should this be hidden on the sitewide activity stream?
  33.                 );
  34.                 bp_activity_add($args);
  35.             }
  36.         }
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement