Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Add UserPro Activity
- * Adds a new activity entry for a user in UserPro when gaining / losing
- * points.
- * @version 1.0
- */
- add_filter( 'mycred_add_finished', 'mycred_pro_add_userpro_activity', 10, 3 );
- function mycred_pro_add_userpro_activity( $result, $request, $mycred ) {
- if ( $result === false ) return $result;
- extract( $request );
- global $userpro;
- $activity = (array) get_option( 'userpro_activity' );
- $timestamp = current_time( 'timestamp' );
- // Construct a log entry so we can use $mycred->parse_template_tags()
- $log_entry = new stdClass();
- $log_entry->ref = $ref;
- $log_entry->user_id = absint( $user_id );
- $log_entry->creds = $mycred->number( $amount );
- $log_entry->ref_id = $ref_id;
- $log_entry->entry = $entry;
- $log_entry->data = $data;
- $log_entry->ctype = $type;
- $template = $mycred->parse_template_tags( $entry, $log_entry );
- $status = '<div class="userpro-sc-img" data-key="profilepicture"><a href="' . $userpro->permalink( $user_id ) . '">' . get_avatar( $user_id, '50' ) . '</a></div><div class="userpro-sc-i"><div class="userpro-sc-i-name"><a href="' . $userpro->permalink( $user_id ) . '" title="View Profile">'. userpro_profile_data( 'display_name', $user_id ) . '</a><span class="userpro-sc-i-info">' . $template . '</span></div><div class="userpro-sc-i-time">{timestamp}</div></div><div class="userpro-clear"></div>';
- $activity[ $user_id ][ $timestamp ] = array(
- 'user_id' => $user_id,
- 'status' => $status,
- 'timestamp' => $timestamp
- );
- update_option( 'userpro_activity', $activity );
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement