How to output user fields from Community Builder in JReviews themes

From JReviews Documentation
Jump to: navigation, search

JReviews stores all Community Builder data in $listing['Community'] array for listings and $review['Community'] array for reviews.


To output a certain CB field value in listings, use this code:

<?php echo $listing['Community']['cb_fieldname'];?>


This code can be used in the:

  • theme file of the listing detail page:
    • /com_jreviews/jreviews/views/themes/{theme_name}/listings/detail.thtml
  • theme file of the listings module:
    • /com_jreviews/jreviews/views/themes/{theme_name}/modules/listings.thtml
  • theme files of the category/search list pages:
    • /com_jreviews/jreviews/views/themes/{theme_name}/listings/listings_blogview.thtml
    • /com_jreviews/jreviews/views/themes/{theme_name}/listings/listings_tableview.thtml
    • /com_jreviews/jreviews/views/themes/{theme_name}/listings/listings_thumbview.thtml


To output a certain CB field value in reviews, use this code:

<?php echo $review['Community']['cb_fieldname'];?>


This code can be used in the theme file of user and editor reviews:

  • /com_jreviews/jreviews/views/themes/{theme_name}/reviews/review_layout.thtml


Replace cb_fieldname with the name of the CB field you want to output. The names of the fields can be checked in CB Field Manager:


CBFields.png


If you want to output something based on a CB field value, you can create a conditional like this:

<?php if($listing['Community']['cb_fieldname'] == 'somevalue'):?>
    // this code will output if cb_fieldname value is equal to 'somevalue'
<?php endif;?>