Enable And Disable Profile

Started on the old forum in May 2009 · view the original in the archive · old links redirect here

22 replies · 1,179 views · started 17 years ago · 1 min read

9 participants
djlee Developer · 224 posts #21

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 🙂

bijaybd Developer · 178 posts #22

what script r u using ???

USER_TABLE THE USER DATA STORED IN THE SLQ - make a new row : viewpro int(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 !

Pablo Developer · 164 posts #23

ok bro am gonna do that

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close