SMF Support > SMF 2.0.x Support

Custom Profile Fields Permissions

(1/1)

IvaliceAlliance:
I'm trying to figure out how I can make my custom profile fields invisible to guests. I want the fields to be visible in Topic View only to members logged in, similar to how the AIM/MSN/ICQ/YIM fields work. I tried to use php code to do it in the "Show Enclosed Within Text (Optional)" field, but it does not let me run php code.

This would do exactly what I want, but it won't run. Instead when I look at the HTML source, the php code is in there and the server did not run it.

--- Code: ---<?php
if (allowedTo('profile_view_any'))
               echo "{INPUT}";
?>
--- End code ---

Is there any way I can achieve this?

Kermit:
There is actually privacy option on new field creation 

+

when you would restrict guests to view the profiles on your site,they would not be able to see it

Illori:
the default fields dont have the privacy option and the advanced profile fields dont have an option to hide them from guests anyway.

yourtheme[or default]/profile.template.php

--- Code: (find) --- <li class="custom_field">', $field['output_html'], '</li>';
}
--- End code ---


--- Code: (add after) ---if (!$context['user']['is_guest'])
--- End code ---

yourtheme[or default]/display.template.php


--- Code: (find) --- if ($message['member']['has_messenger'] && $message['member']['can_view_profile'])
--- End code ---


--- Code: (replace with) ---if ($message['member']['has_messenger'] && $message['member']['can_view_profile'] &&( !$context['user']['is_guest']))
--- End code ---

if you have other custom fields you would need to apply that to those areas in those templates as well.

i believe that code should work, i am not 100% sure.

IvaliceAlliance:
I was really hoping there could be a more simple way. I don't really like editing the default template (which is what I use) because I assume I'll lose my changes when I update SMF. I'll try it out though. I should be able to figure it out based on your guidance. I hope something like this gets improved in 2.1 or 3.0.

Thanks.

Navigation

[0] Message Index

Go to full version