Esempio n. 1
0
 function post_review($args = '')
 {
     global $bp;
     $defaults = array('content' => false, 'rating' => false, 'user_id' => $bp->loggedin_user->id, 'group_id' => $bp->groups->current_group->id);
     $r = wp_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     if (empty($content) || !strlen(trim($content)) || empty($user_id) || empty($group_id)) {
         return false;
     }
     // Be sure the user is a member of the group before posting.
     if (!is_super_admin() && !groups_is_user_member($user_id, $group_id)) {
         return false;
     }
     // Record this in activity streams
     $activity_action = sprintf(__('%s reviewed %s:', 'bpgr'), bp_core_get_userlink($user_id), '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_html($bp->groups->current_group->name) . '</a>');
     $rating_content = false;
     if (!empty($rating)) {
         $rating_content = '<span class="p-rating">' . bpgr_get_review_rating_html($rating) . '</span>';
     }
     $activity_content = $rating_content . $content;
     $activity_id = groups_record_activity(array('user_id' => $user_id, 'action' => $activity_action, 'content' => $activity_content, 'type' => 'review', 'item_id' => $group_id));
     $this->add_rating(array('score' => $rating, 'activity_id' => $activity_id, 'group_id' => $group_id));
     groups_update_groupmeta($group_id, 'last_activity', gmdate("Y-m-d H:i:s"));
     do_action('bpgr_posted_review', $args, $activity_id);
     return $activity_id;
 }
Esempio n. 2
0
 
	
	<div class="already-rated">	
		<h5><?php 
            printf(__("You rated %s on %s.", 'bpgr'), bp_get_group_name(), bpgr_get_activity_date_recorded());
            ?>
</h5>
		
		<blockquote>
			<?php 
            echo bp_get_activity_content_body();
            ?>
			
			<div class="rest-stars">
				<?php 
            echo bpgr_get_review_rating_html(bpgr_get_review_rating());
            ?>
 
			</div>
		</blockquote>
		
		<p><?php 
            _e("To leave another review, you must delete your existing review.", 'bpgr');
            ?>
 <?php 
            bp_activity_delete_link();
            ?>
</p>
	</div>
	
	<?php 
Esempio n. 3
0
	<div class="activity-avatar">
		<a href="<?php 
bp_activity_user_link();
?>
">
			<?php 
bp_activity_avatar('type=thumb&width=30&height=30');
?>
		</a>
	</div>

	<div class="activity-content">

		<div class="activity-header">
			<?php 
echo bpgr_get_review_rating_html(bp_activity_get_meta(bp_get_activity_id(), 'bpgr_rating'));
?>
 <?php 
printf(__('By %s', 'bpgr'), bp_core_get_userlink(bp_get_activity_user_id()));
?>
 (<?php 
printf(__('%s ago', 'bpgr'), bp_core_time_since(bp_get_activity_date_recorded()));
?>
) <a href="<?php 
echo site_url(BP_ACTIVITY_SLUG . '/p/' . bp_get_activity_id() . '/');
?>
"><?php 
_e('#', 'bpgr');
?>
</a>
		</div>