22 replies · 1,179 views · started 17 years ago · 1 min read
TL;DR · summary of 22 replies
- The code provided in the thread does not work as intended, as it is not functioning correctly for enabling/disabling profiles.
- A new user named bijaybd suggests a solution using a field called viewpro in the users table to enable or disable profile visibility. This solution involves checking if the value of viewpro is 0 (disabled) or 1 (enable...
- The suggestion includes creating a query to fetch this value and displaying different messages based on whether the profile is enabled or disabled.
- Pablo is instructed by bijaybd to implement this solution in his own code.
Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.
in your users table create a field, something like active_profile, it can be a tinyint(1) and where only gonna store int flags in there representing 1 or 0
now in your users control panel where they edit their stuff you need to add a part for them to enable/disable profile. if they choose to enabled profile then you set the "active_profile" field or whatever u wanna call it to 1, otherwise you set it to 0 to disable it
now all you need to do is go to the script that shows the profile (profile.php for arguments sake). and in there under the query that selects all the users info for display you just put
if($user['active_profile'] == 1)
{
//normal page
}
else
echo "This user has hidden their profile";
very basic way of doing it and doesnt account for allowing buddies to view and staff to view, but its the basics and you should be able to make ur own from their if you can program basic php and understand ur site script to a basic/intermediate level
i aint providing copy and paste code so dont ask 🙂
USER_TABLE THE USER DATA STORED IN THE SLQ -
make a new row :
viewproint(1) NOT NULL default '0',
then put this in your profile page -
$wtf = mysql_fetch_array(mysql_query("SELECT viewpro FROM USER_TABLE WHERE id='".$who."'"));
if($wtf[0]=="1")
{
echo "Profile is Disabled by the user
";
}
else
if($wtf[0]=="0")
{
[YOUR PROFILE CODE]
}
i checked this code and working fine if you still have problem tell me !