I'm working with a membership based site where I need to restrict contact information. I need to insert this content inside opening and closing shortcode :
[level-accountant][/level-accountant]
The content I need to restrict is this :
<?php $order = array('billing_company', 'billing_address_1', 'billing_address_2', 'billing_city', 'billing_postcode', 'billing_state', 'country');
$result = array();
foreach($order as $elem){
if($user_meta[$elem][0] != "")
$result[] = $user_meta[$elem][0];
}
echo implode(', ', $result);
?>
I have followed this answer here : How to put php code inside opening and closing shortcodes
and tried this code :
<?php echo do_shortcode('[level-accountant]'.$order = array('billing_company', 'billing_address_1', 'billing_address_2', 'billing_city', 'billing_postcode', 'billing_state', 'country');
$result = array();
foreach($order as $elem){
if($user_meta[$elem][0] != "")
$result[] = $user_meta[$elem][0];
}
echo implode(', ', $result);.'[/level-accountant]'); ?>
But just can't figure out how to place my content inside. This code is giving me errors.