[DEV] Private profiles. friends only option.

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

[DEV] Private profiles. friends only option.

Post by superj707 » Mon Jan 03, 2011 2:41 am

This mod will give your users the option to have their entire profile private.

ONLY friends, admins and moderators will be able to view their profile.

MUST ALSO DO THIS http://www.phpbb.com/community/viewtopi ... #p12930080 & http://www.phpbb.com/community/viewtopi ... #p12928200


find in memberlist.php

Code: Select all

'SIGNATURE'        => $member['user_sig'],
add after:

Code: Select all

'PRIVATEPROFILE'     => trim(addslashes($member['privateprofile'])),
find in includes/ucp/ucp_prefs.php

Code: Select all

'S_HIDE_ONLINE'		=> $data['hideonline'],
add after

Code: Select all

'S_PRIVATEPROFILE' => $data['privateprofile'],


find in styles/prosilver/template/ucp_prefs_personal.html

Code: Select all

    <dl>
        <dt><label for="dateformat">{L_BOARD_DATE_FORMAT}:</label><br /><span>{L_BOARD_DATE_FORMAT_EXPLAIN}</span></dt>
        <dd>
            <select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){dE('custom_date',1);}else{dE('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }">
                {S_DATEFORMAT_OPTIONS}
            </select>
        </dd>
        <dd id="custom_date" style="display:none;"><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="inputbox narrow" style="margin-top: 3px;" /></dd>
    </dl>


add after

Code: Select all

    <dl>
        <dt><label for="privateprofile0">Private Profile:</label><br /><span>Allow only your friends to view your LTC profile. </span></dt>
        <dd>
            <label for="privateprofile1"><input type="radio" name="privateprofile" id="privateprofile1" value="1"<!-- IF S_PRIVATEPROFILE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> 
            <label for="privateprofile0"><input type="radio" name="privateprofile" id="allow_friend_view0" value="0"<!-- IF not S_PRIVATEPROFILE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
        </dd>
    </dl>



find in styles/prosilver/template/memberlist_view.html

Code: Select all

<!-- INCLUDE overall_header.html -->
add after:

Code: Select all

<!-- IF ((PRIVATEPROFILE == 1 and S_ZEBRA and U_ADD_FRIEND and U_ADD_FOE) or (PRIVATEPROFILE == 1 and S_ZEBRA and U_REMOVE_FOE)) and not (U_MCP or U_ACP)  -->

<h2>{USERNAME} has a private profile. You must be {USERNAME}'s friend in order to view this profile. </h2>

	<!-- IF U_ADD_FRIEND and U_ADD_FOE-->
				<dt>&nbsp;</dt> <dd> <img src="{T_THEME_PATH}/images/addcross.gif"/> <a href="{U_ADD_FRIEND}"><strong>{L_ADD_FRIEND}</strong></a>&nbsp;&nbsp;&nbsp;<img src="{T_THEME_PATH}/images/addfoes.png"/> <a href="{U_ADD_FOE}"><strong>{L_ADD_FOE}</strong></a></dd>
			<!-- ELSE -->
				<!-- IF U_REMOVE_FRIEND -->
					<dt>&nbsp;</dt> <dd><a href="{U_REMOVE_FRIEND}"><strong>{L_REMOVE_FRIEND}</strong></a></dd>
				<!-- ELSE -->
					<dt>&nbsp;</dt> <dd><a href="{U_REMOVE_FOE}"><strong>{L_REMOVE_FOE}</strong></a></dd>
				<!-- ENDIF --><!-- ENDIF -->

<!-- ELSE -->


find

Code: Select all

<!-- INCLUDE overall_footer.html -->
add BEFORE <----

Code: Select all

<!-- ENDIF -->

Run SQL

Code: Select all

ALTER TABLE phpbb_users ADD privateprofile TINYINT unsigned DEFAULT 0;
Last edited by superj707 on Sat Jan 08, 2011 7:10 pm, edited 5 times in total.

Gino
Registered User
Posts: 124
Joined: Sun Mar 21, 2010 2:39 pm
Contact:

Re: [DEV] Private profiles. friends only option.

Post by Gino » Mon Jan 03, 2011 1:30 pm

wow
nice MOD
thaaaaanks :oops: :oops:

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Private profiles. friends only option.

Post by 4_seven » Mon Jan 03, 2011 2:41 pm

very nice addon :geek:

only a little boob:

Code: Select all

ALTER TABLE phpbb_users ADD priavteprofile TINYINT unsigned DEFAULT 0;
have to be

Code: Select all

ALTER TABLE phpbb_users ADD privateprofile TINYINT unsigned DEFAULT 0;
also important:
change phpbb_ to your prefix
Current Mods | Mod Base | php(BB) programming | No help via PM


superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

Re: [DEV] Private profiles. friends only option.

Post by superj707 » Mon Jan 03, 2011 8:03 pm

4_seven wrote:very nice addon :geek:

only a little boob:

Code: Select all

ALTER TABLE phpbb_users ADD priavteprofile TINYINT unsigned DEFAULT 0;
have to be

Code: Select all

ALTER TABLE phpbb_users ADD privateprofile TINYINT unsigned DEFAULT 0;
also important:
change phpbb_ to your prefix
thank you 4seven.
I will correct in the original post. thanks again.

plasmino
Registered User
Posts: 261
Joined: Sat Jul 25, 2009 11:12 am

Re: [DEV] Private profiles. friends only option.

Post by plasmino » Tue Jan 04, 2011 12:08 pm

Nice superj707 but I have error debug in ucp.php?i=167

Code: Select all

phpBB Debug] PHP Notice: in file /includes/ucp/ucp_prefs.php on line 178: Undefined index: privateprofile
line from 177 to 179

Code: Select all

'S_HIDE_ONLINE'		=> $data['hideonline'],
'S_PRIVATEPROFILE' => $data['privateprofile'],
'S_NOTIFY_PM'		=> $data['notifypm'],
and YES also by setting my options remains to NO

EDIT: solved

includes/ucp/ucp_prefs.php

find

Code: Select all

'hideonline'	=> request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
add after:

Code: Select all

'privateprofile'		=> request_var('privateprofile', (bool) $user->data['privateprofile']),
find

Code: Select all

'user_allow_viewonline'	=> ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'],
add after:

Code: Select all

'privateprofile'		=> $data['privateprofile'],

superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

Re: [DEV] Private profiles. friends only option.

Post by superj707 » Tue Jan 04, 2011 11:12 pm

EDIT: solved

includes/ucp/ucp_prefs.php

find

Code: Select all

'hideonline'	=> request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
add after:

Code: Select all

'privateprofile'		=> request_var('privateprofile', (bool) $user->data['privateprofile']),
find

Code: Select all

'user_allow_viewonline'	=> ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'],
add after:

Code: Select all

'privateprofile'		=> $data['privateprofile'],



oppps forgot that little step when I was adding this to the post. Thank you for pointing that out and sharing.

superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

Re: [DEV] Private profiles. friends only option.

Post by superj707 » Fri Jan 07, 2011 7:51 pm

another MAJOR bug.
This mod stops new registration unless you go into your pma and in the users table set the privateprofile field to have a default value of 0

plasmino
Registered User
Posts: 261
Joined: Sat Jul 25, 2009 11:12 am

Re: [DEV] Private profiles. friends only option.

Post by plasmino » Sat Jan 08, 2011 8:15 am

thanks :D

User avatar
Wolverien
Registered User
Posts: 51
Joined: Wed Feb 14, 2007 4:01 pm
Location: Lutjebroek, North-Holland, Netherlands, Europe, Earth, Galaxy
Contact:

Re: [DEV] Private profiles. friends only option.

Post by Wolverien » Sat Jan 22, 2011 4:41 pm


superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

Re: [DEV] Private profiles. friends only option.

Post by superj707 » Sat Jan 22, 2011 4:50 pm

Wolverien wrote:Isn't this the same as this?

http://www.phpbb.com/customise/db/mod/profile_privacy/

nope his is totally different.

His makes people completely vanish. They are removed from the memberlist and posts are hidden.

This one simple replaces the current profile with a private profile that says you must add this person to see their profile. "add friend" ?

It's more like the way facebook works. His is more like a block hide all ... this is just a private profile.

Actually I made this because his wasn't doing for me what I wanted. This is more simple and exactly what I wanted.

thanks for asking.

mattconley2011
Registered User
Posts: 114
Joined: Sat Jan 16, 2010 6:49 am

Re: [DEV] Private profiles. friends only option.

Post by mattconley2011 » Mon Apr 11, 2011 6:14 pm

What about users being able to turn this on or off?

superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

Re: [DEV] Private profiles. friends only option.

Post by superj707 » Mon Apr 11, 2011 8:17 pm

mattconley2011 wrote:What about users being able to turn this on or off?
they can in the user control panel.
It's all in the code. :D

mattconley2011
Registered User
Posts: 114
Joined: Sat Jan 16, 2010 6:49 am

Re: [DEV] Private profiles. friends only option.

Post by mattconley2011 » Tue Apr 12, 2011 1:47 am

superj707 wrote:
mattconley2011 wrote:What about users being able to turn this on or off?
they can in the user control panel.
It's all in the code. :D
sweet will put it on my board then. Got a feature request. May do it myself.

The option of hiding on certain things?

superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

Re: [DEV] Private profiles. friends only option.

Post by superj707 » Tue Apr 12, 2011 5:00 am

mattconley2011 wrote:
superj707 wrote:
mattconley2011 wrote:What about users being able to turn this on or off?
they can in the user control panel.
It's all in the code. :D
sweet will put it on my board then. Got a feature request. May do it myself.

The option of hiding on certain things?

in memberlist_view add whatever you like to the following code. This stuff will not be hidden.

Code: Select all

    <!-- IF ((PRIVATEPROFILE == 1 and S_ZEBRA and U_ADD_FRIEND and U_ADD_FOE) or (PRIVATEPROFILE == 1 and S_ZEBRA and U_REMOVE_FOE)) and not (U_MCP or U_ACP)  -->

    <h2>{USERNAME} has a private profile. You must be {USERNAME}'s friend in order to view this profile. </h2>

       <!-- IF U_ADD_FRIEND and U_ADD_FOE-->
                <dt>&nbsp;</dt> <dd> <img src="{T_THEME_PATH}/images/addcross.gif"/> <a href="{U_ADD_FRIEND}"><strong>{L_ADD_FRIEND}</strong></a>&nbsp;&nbsp;&nbsp;<img src="{T_THEME_PATH}/images/addfoes.png"/> <a href="{U_ADD_FOE}"><strong>{L_ADD_FOE}</strong></a></dd>
             <!-- ELSE -->
                <!-- IF U_REMOVE_FRIEND -->
                   <dt>&nbsp;</dt> <dd><a href="{U_REMOVE_FRIEND}"><strong>{L_REMOVE_FRIEND}</strong></a></dd>
                <!-- ELSE -->
                   <dt>&nbsp;</dt> <dd><a href="{U_REMOVE_FOE}"><strong>{L_REMOVE_FOE}</strong></a></dd>
                <!-- ENDIF --><!-- ENDIF -->

    <!-- ELSE -->

Locked

Return to “[3.0.x] MODs in Development”