Template Overrides

Get Started

Template Overrides

BuddyPress Member Reviews uses a template hierarchy system that allows you to override plugin templates in your theme without modifying plugin files.

Template Hierarchy

The plugin searches for templates in this order:

  1. your-theme/buddypress-member-review/template-name.php (your override)
  2. your-theme/template-name.php (alternative location)
  3. plugin/includes/templates/template-name.php (default)

This ensures your customizations are preserved during plugin updates.


Available Templates

TemplatePurpose
bupr-reviews-tab-template.phpReviews tab content on member profile (review list)
bupr-single-review-template.phpIndividual review display
bupr-edit-review-form.phpEdit review modal form

Overriding Templates

Step 1: Create Directory

Create the template directory in your theme:

your-theme/
└── buddypress-member-review/

Or use the root theme directory:

your-theme/

Step 2: Copy Template

Copy the template from the plugin to your theme:

wp-content/plugins/buddypress-member-review/includes/templates/bupr-reviews-tab-template.php

To:

wp-content/themes/your-theme/buddypress-member-review/bupr-reviews-tab-template.php

Step 3: Customize

Edit the copied template. Your changes will be used instead of the plugin default.

Step 4: Test

Clear any caching plugins and visit a member profile to see your changes.


Template Variables

Templates have access to these global variables and functions:

Global Variables

global $bupr_review;        // Current review post object
global $bupr_member_id;     // Reviewed member ID
global $bupr_reviewer_id;   // Reviewer user ID
global $bupr;               // Plugin settings array

Template Functions

FunctionDescription
buprgetreviewrating( $reviewid )Get review rating array
buprgetaggregaterating( $userid )Get user’s aggregate rating
buprcanuserreview( $userid, $member_id )Check if user can review member
bupruserhasreviewed( $userid, $member_id )Check if user already reviewed
buprgetreviewcount( $userid )Get member’s review count
buprgetrating_criteria()Get rating criteria array
buprrenderstars( $rating, $criteria )Output star HTML

Example: Custom Review Template

Override bupr-single-review-template.php:

post_author;
$reviewer    = get_userdata( $reviewer_id );
$is_anonymous = get_post_meta( $bupr_review->ID, 'bupr_anonymous_review_post', true );
$rating      = get_post_meta( $bupr_review->ID, 'profile_star_rating', true );
?>

ID ); ?>">

"> display_name ); ?>

post_date ), current_time( 'timestamp' ) ); ?> ago

Anonymous Reviewer

post_date ), current_time( 'timestamp' ) ); ?> ago
$value ) { echo '
'; echo '' . esc_html( ucfirst( $criteria ) ) . ':'; echo bupr_render_stars( $value, $criteria ); echo '
'; } } ?>
post_content ) ); ?>
ID ); ?>
ID, 'bupr_owner_reply', true ); if ( $owner_reply ) : $reply_date = get_post_meta( $bupr_review->ID, 'bupr_owner_reply_date', true ); ?>
Owner Response:

ago

CSS Classes Reference

Use these classes to style review elements:

Container Classes

.bupr-reviews-wrapper          /* Main wrapper */
.bupr-review-item              /* Single review */
.bupr-review-list              /* Review list container */
.bupr-review-form              /* Review form */
.bupr-aggregate-rating         /* Aggregate rating display */

Component Classes

.bupr-reviewer-avatar          /* Reviewer avatar */
.bupr-reviewer-name            /* Reviewer name */
.bupr-review-date              /* Review date */
.bupr-review-content           /* Review text content */
.bupr-star-rating              /* Star rating container */
.bupr-star-filled              /* Filled star */
.bupr-star-empty               /* Empty star */
.bupr-criteria-label           /* Rating criteria label */
.bupr-owner-reply              /* Owner's reply */

State Classes

.bupr-review-pending           /* Pending review */
.bupr-review-anonymous         /* Anonymous review */
.bupr-review-flagged           /* Flagged review */
.bupr-review-verified          /* Verified review (Pro) */

Action Classes

.bupr-edit-review              /* Edit button */
.bupr-delete-review            /* Delete button */
.bupr-reply-review             /* Reply button */
.bupr-flag-review              /* Flag button */

Template Hooks

Add custom content to templates without overriding:

// Before review list
add_action( 'bupr_before_member_review_list', function() {
    echo '
Custom content here
'; } ); // After review content add_action( 'bupr_after_review_content', function() { global $bupr_review; // Add custom fields display } ); // After review date add_action( 'bupr_after_review_date', function() { // Add custom badges } );

Best Practices

  1. Never modify plugin files directly – Always use theme overrides
  2. Test after plugin updates – Verify your customizations still work
  3. Use child themes – Protect overrides from theme updates
  4. Keep it semantic – Use appropriate HTML5 elements
  5. Check for Pro features – Use function_exists() for Pro-specific functions
  6. Escape output – Use eschtml(), escattr(), wpksespost()
  7. Cache-friendly – Avoid expensive queries in templates

Debugging Templates

Enable WordPress debug mode to see which template is being used:

// Add to wp-config.php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

Add debug output to your template:

// At top of template file
error_log( 'Using template: ' . __FILE__ );

Related Documentation

Last updated: February 13, 2026