';
$output = sprintf($output, awpcp_menu_items());
}
if (!$isadmin && !$is_ad_owner && !$preview && $ad->disabled == 1) {
$message = __('The Ad you are trying to view is pending approval. Once the Administrator approves it, it will be active and visible.', 'AWPCP');
return sprintf($output, awpcp_print_error($message));
}
if ($isadmin && $ad->disabled == 1) {
$message = __('This Ad is currently disabled until the Administrator approves it. Only you (the Administrator) and the author can see it.', 'AWPCP');
$messages[] = awpcp_print_error($message);
} else if ($is_ad_owner && $ad->disabled == 1) {
$message = __('This Ad is currently disabled until the Administrator approves it. Only you (the author) can see it.', 'AWPCP');
$messages[] = awpcp_print_error($message);
}
$layout = get_awpcp_option('awpcpshowtheadlayout');
if (empty($layout)) {
$layout = awpcp()->settings->get_option_default_value('awpcpshowtheadlayout');
}
$layout = apply_filters('awpcp-single-ad-layout', $layout, $ad);
$layout = awpcp_do_placeholders( $ad, $layout, 'single' );
$output = sprintf($output, join('', $messages) . $layout);
$output = apply_filters('awpcp-show-ad', $output, $adid);
$ad->visit();
$ad->save();
}
} else {
$output = awpcp_display_ads( '', '', '', get_awpcp_option( 'groupbrowseadsby' ), '' );
}
return $output;
}