gradebook_update_message( $data, true ); $subject = $this->gradebook_update_message( $data, false, true ); $recipients = $data['grade']['uid']; } elseif( isset( $data['response'] ) ) { $content = $this->response_added_message( $data, true ); $subject = $this->response_added_message( $data, false, true ); $recipients = $data['assignment']->post_author; } // Hack: ob_*() - to get rid of nasy warnings on messages_new_message() ob_start(); messages_new_message( array( 'recipients' => $recipients, 'subject' => $subject, 'content' => $content ) ); ob_clean(); } /** * gradebook_update_message( $data, $body = false, $subject = false ) * * Generated content for new request messages. * * @param Mixed $data, contains the student id, teacher id, assignment id etc. * @param bool $body if true generates the message body content * @param bool $subject if true generates the message subject content * @return String $content the generated message content */ function gradebook_update_message( $data, $body = false, $subject = false ) { $content = null; if( $subject ) $content = __( 'Your assignment was graded.', 'bpsp' ); if( $body ) { $content = $data['teacher']->user_nicename; $content.= __( " graded your assignment: ", 'bpsp' ); $content.= "\n"; $content.= '' . attribute_escape( $data['assignment']->post_title ) . ''; $content.= "\n"; $content.= __( "Follow the link above to see the grade.", 'bpsp' ); } return $content; } /** * response_added_message( $data, $body = false, $subject = false ) * * Generated content for new request messages. * * @param Mixed $data, contains the student id, teacher id, response id etc. * @param bool $body if true generates the message body content * @param bool $subject if true generates the message subject content * @return String $content the generated message content */ function response_added_message( $data, $body = false, $subject = false ) { $content = null; if( $subject ) $content = __( 'Student replied to your assignment.', 'bpsp' ); if( $body ) { $content = bp_core_get_user_displayname( $data['response']->post_author ); $content.= __( " added a response to: ", 'bpsp' ); $content.= "\n"; $content.= '' . attribute_escape( $data['assignment']->post_title ) . ''; $content.= "\n"; $content.= __( "Follow the link above to see it.", 'bpsp' ); } return $content; } } ?>