News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Making custom profile fields non-editable?

Started by Efrain Ruiz, December 21, 2005, 01:03:41 AM

Previous topic - Next topic

Efrain Ruiz

Hello all,

I am usinf SMF RC1 and I created some custom profile fields which are being displayed on the Profile Page and also appear as input boxes on the Forum Profile Information Page. My question is: How can I make these profile pages  NON-EDITABLE for all members where only members with permission to edit any profile, may be able to edit these custom profile fields?

Here is an example of one of my fields, so perhaps anyone can show me what changes need to be made to them to get this accomplished.


<tr>
<td width="40%"><b>Occupation: </b><div class="smalltext">What you do for a living.</div></td>
<td><input type="text" name="default_options[profile_occupation]" maxlength="30" size="25" value="', $context['member']['options']['profile_occupation'], '" /></td>
</tr>


I was thinking that perhaps something like an IF statement, which would check if the member has rights to edit would show this code and if not, then it would just display the data for that field without the option to edit it. Am I on the right track?

Efrain Ruiz

Ok, the following code worked perfectly:


<tr>
<td width="40%"><b>Flight 9: </b><div class="smalltext">Ninth leg of current bid.</div></td>';
if ($context['user']['is_admin'])
{ echo '
<td><input type="text" name="default_options[profile_flight_9]" size="25" value="', @$context['member']['options']['profile_flight_9'], '" /></td>';
} else {
echo '
<td>', $context['member']['options']['profile_flight_9'], '</td>';
}
echo '
</tr>


But there is one problem with this code. Members who I give permission to modify any profile field, CANNOT access this field. Only the admin can access it. I know it has to do with the 'is_admin' variable. What else would I need to add to this code, in order to allow users with rights to modify any profile, be able to do so.

Thanks in advance.

-Efrain

Advertisement: