phpBB SnippetsHide Age in profiles

Post Reply
User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

Hide Age in profiles

#1

Post by Restless Rancor » October 15th, 2018, 6:58 pm

This snippet allows you to let members hide their age in their profiles.
If they do, it can only be viewed in the ACP.
It works by reading a boolean yes/no custom profile field ("CPF") and can work in conjunction with phpBB Birthday Control

Noted Contributors: GanstaZ
Note: If you use phpBB Birthday Control you must disable the bc_show_bday CPF it automatically creates and use your own.



Tested On:

[Link]
Open root/styles/prosilver/template/memberlist_view.html

Find:

Code: Select all

<!-- IF AGE !== '' --><dt>{L_AGE}{L_COLON}</dt> <dd>{AGE}</dd><!-- ENDIF -->
Add Before:

Code: Select all

{% if S_PROFILE_TEST and PROFILE_TEST_VALUE_RAW == 1 %}
Add After:

Code: Select all

{% endif %}
Find:

Code: Select all

<!-- IF not custom_fields.S_PROFILE_CONTACT -->
In-Line Find:

Code: Select all

PROFILE_CONTACT
In-Line Add After:

Code: Select all

 and custom_fields.PROFILE_FIELD_NAME != PROFILE_TEST_NAME 
Replace TEST with CPF field identification (three to replace), must be in CAPS.

Open root/styles/prosilver/template/viewtopic_body.html

Find:

Code: Select all

<dl class="postprofile" id="profile{postrow.POST_ID}"
Add anywhere after:

Code: Select all

{% if postrow.POSTER_AGE and postrow.PROFILE_TEST_VALUE_RAW == 1 %}<dd class="profile-age"><strong>{{ lang('AGE') ~ lang('COLON') }}</strong> {{ postrow.POSTER_AGE }}</dd>{% endif %}
But Before:

Code: Select all

</dl>
For example, after:

Code: Select all

<!-- IF postrow.POSTER_POSTS != '' --><dd class="profile-posts"><strong>{L_POSTS}{L_COLON}</strong> <!-- IF postrow.U_SEARCH !== '' --><a href="{postrow.U_SEARCH}"><!-- ENDIF -->{postrow.POSTER_POSTS}<!-- IF postrow.U_SEARCH !== '' --></a><!-- ENDIF --></dd><!-- ENDIF -->
Find:

Code: Select all

<!-- IF not postrow.custom_fields.S_PROFILE_CONTACT -->
In-Line Find:

Code: Select all

PROFILE_CONTACT
In-Line Add After:

Code: Select all

 and postrow.custom_fields.PROFILE_FIELD_NAME != postrow.PROFILE_TEST_NAME 
Replace TEST with CPF field identification (two to replace), must be in CAPS.
CPF must be toggled to Display on viewtopic screen.
Changelog:
► Show Spoiler


These aren't the droids you're looking for.

Post Reply

Topic Subscribers

1 user subscribed to this topic: Restless Rancor