User selectable private/public profile

15 years 3 months ago #14881 by mikko
Replied by mikko on topic Re:User selectable private/public profile
Privacy policy plugin that I have been developing solves the issue with tab level access control. It is till alpha, though.

-mikko

Please Log in to join the conversation.

15 years 3 months ago #14895 by ffaabbss
Replied by ffaabbss on topic Re:User selectable private/public profile
I need that reeeeeaaly really! As some users don't want to show their profile.. I want them all in the userlist though. I really like what nant did for his plugin to achieve access control. can't something like that be transferred to the entire profile somehow?

you'll get my karma vote once that privacy thingy is working. wanted to give now, but have spent my Karma elsewhere before reading up on this, sorry;)

what do you think when will it be second or third beta to give it a shot on a live site?

cheers
fabs

Please Log in to join the conversation.

15 years 3 weeks ago #19410 by planetkarl.com
Replied by planetkarl.com on topic Re:User selectable private/public profile- SOLVED!
OK, I needed this, so I implemented it.
Step 1: add a field to the user profile cb_publicprofile (checkbox)

Step 2: Find the userProfile function in comprofiler.php and change the code to match this:


[code:1]function userProfile( $option, $uid, $submitvalue) {
global $database, $_REQUEST, $ueConfig,$my;

if (isset($_REQUEST)) {
$database->setQuery( "SELECT cb_publicprofile FROM #__comprofiler WHERE user_id=".$_REQUEST);
$publicprofile = $database->loadResult();
if ($publicprofile ==1){

}
else{
if (!allowAccess( $ueConfig,'RECURSE', userGID($my->id))) {
echo _UE_NOT_AUTHORIZED;
return;
}
}
} else {
if ($uid==0) {
echo _UE_REGISTERFORPROFILE;
return;
}
}
$users=array();
if (setUserDBrequest($uid)) {
$users = $database->loadObjectList();
}
if (count($users)==0) {
echo _UE_NOSUCHPROFILE;
return;
}

$user = $users[0];

HTML_comprofiler::userProfile( $user, $option, $submitvalue);
}[/code:1]

The code is a bit rough, but it works 100% for me and it was quick.


Works like a dream and took me just 15 mins. I have the cb_publicprofile checkbox not visible on the profile and not user editable, so I can select who is public and private. You can set it any way you like though, it all works.

Enjoy!

Post edited by: planetkarl.com, at: 2006/08/22 19:32

Please Log in to join the conversation.

15 years 3 weeks ago #19411 by planetkarl.com
Replied by planetkarl.com on topic Re:User selectable private/public profile- SOLVED!
I realize this is not exactly what everyone was going for, but it should be easy to modify this code to make the profile "hidden" completely.

I just wanted the ability to make some users visible to non registered users and others not.

Please Log in to join the conversation.

15 years 3 weeks ago #19413 by planetkarl.com
Replied by planetkarl.com on topic Re:User selectable private/public profile- SOLVED!
Hmm, thinking about it, modifying this to make the profile hidden, simply use this code:

[code:1]
function userProfile( $option, $uid, $submitvalue) {
global $database, $_REQUEST, $ueConfig,$my;

if (isset($_REQUEST)) {
$database->setQuery( "SELECT cb_publicprofile FROM #__comprofiler WHERE user_id=".$_REQUEST);
$publicprofile = $database->loadResult();
if (!allowAccess( $ueConfig,'RECURSE', userGID($my->id)) || $publicprofile == 0) {
echo _UE_NOT_AUTHORIZED;
return;
}
} else {
if ($uid==0) {
echo _UE_REGISTERFORPROFILE;
return;
}
}
$users=array();
if (setUserDBrequest($uid)) {
$users = $database->loadObjectList();
}
if (count($users)==0) {
echo _UE_NOSUCHPROFILE;
return;
}

$user = $users[0];

HTML_comprofiler::userProfile( $user, $option, $submitvalue);
}
[/code:1]

Hmm, that is even simpler code!
I have not tested this, but it's just a little help to anyone who needs it.

Please Log in to join the conversation.

15 years 3 weeks ago #19416 by planetkarl.com
Replied by planetkarl.com on topic Re:User selectable private/public profile- SOLVED!
So basically:

Change this:

[code:1]if (!allowAccess( $ueConfig,'RECURSE', userGID($my->id)))[/code:1]

Into this:

[code:1]$database->setQuery( "SELECT cb_publicprofile FROM #__comprofiler WHERE user_id=".$_REQUEST);
$publicprofile = $database->loadResult();
if (!allowAccess( $ueConfig,'RECURSE', userGID($my->id)) || $publicprofile == 0) {[/code:1]

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.180 seconds

Facebook Twitter LinkedIn