In my dating agency website, named Matrimo, i want to make phone numbers public on the profile page, BUT if user is not admin, then the phone number should not be imported from database.
Now, for privacy reasons data_phone ( a text field) is set to not show up on public page. So Admin have to go on Control Panel to see it each time.
The fields are imported on public page using:
<? view::load('users/elements/profile', array('name' => false, 'fields' => $fields, 'user' => $user, 'overview' => config::item('user_profile_full', 'users') ? 0 : 1)); ?>
While: 'users/elements/profile' contains the next code:
<? if ( $user['verified'] && $user['active'] == 1 ): ?>
<? view::load('system/elements/field/grid', array('skip' => array(config::item('usertypes', 'core', 'fields', $user['type_id'], 1), config::item('usertypes', 'core', 'fields', $user['type_id'], 2)), 'fields' => $fields, 'data' => $user, 'map' => false, 'overview' => isset($overview) ? $overview : false)); ?>
<? endif; ?>
Question:
How to edit this code in order to not import data_phone fields from database, unless user is Admin ? Simply adding 'data_field' => false , before ‘map’ ?
I intend to use if condition as:
<? if (session::item('group_id') == 5): ?>
....
<? else; ?>
....
<? endif; ?>
Where 5 is the Admin group_id.
Thank you very much.
Aucun commentaire:
Enregistrer un commentaire