How to show a custom field only for certain plans even when the field exists in all plans

From JReviews Documentation
Jump to: navigation, search

There may be times when you want to request certain fields to be added to all listings, but display the information only for certain plans. For example, you could have a website custom field that you want to be filled out for free plans. But the field will only appear in detail pages once the listing is upgraded.

Below you can find an example of how to do this by adding code to the PHP Format setting of your website custom field. The example can also be applied to other field types. You need to check your Paid Plan IDs and then make the corresponding changes to the $paidPlanIDs array. You can include one or more plan IDs for which you want to display the custom field. In this example we chose plan IDs 1 and 2.

// If it's not a paid listing we process normally
if (!isset($entry['Paid'])) {
    return $output;
// Array of plan IDs for which you want to display this custom field
$paidPlanIDs = array(1,2);
// Only show the field if the listing has an order for any of the given plan IDs
if (array_intersect($paidPlanIDs, $entry['Paid']['plan_ids'])) {
    return $output;
return false;