News:

Wondering if this will always be free?  See why free is better.

Main Menu

disable Birthdate in profile

Started by danielrichter, February 03, 2023, 03:10:25 AM

Previous topic - Next topic

danielrichter

Dear smf devs,

is there an easy way to disable the "Birthdate" feature in SMF?
My idea was to:

  • disable calendar
  • remove birthdate inside forumprofile (so no user can edit their own birthdate)
  • remove "Age" from profile page (when user profile is viewed by someone)

Are these all occurrences of the "Birthdate" / "age" feature?

Thank you for reply.

danielrichter

Bump, still looking for some hints / ideas.

Sir Osis of Liver

Quote from: danielrichter on February 03, 2023, 03:10:25 AMremove birthdate inside forumprofile (so no user can edit their own birthdate)

Profile.template.php


function template_profile_birthdate()
{
/*    global $txt, $context;

    // Just show the pretty box!
    echo '
                            <dt>
                                <strong>', $txt['dob'], '</strong><br>
                                <span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
                            </dt>
                            <dd>
                                <input type="text" name="bday3" size="4" maxlength="4" value="', $context['member']['birth_date']['year'], '"> -
                                <input type="text" name="bday1" size="2" maxlength="2" value="', $context['member']['birth_date']['month'], '"> -
                                <input type="text" name="bday2" size="2" maxlength="2" value="', $context['member']['birth_date']['day'], '">
                            </dd>';
*/
}


Quoteremove "Age" from profile page (when user profile is viewed by someone)

Profile.template.php


/*    echo '
                <dt>', $txt['age'], ':</dt>
                <dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' &nbsp; <img src="' . $settings['images_url'] . '/cake.png" alt="">' : ''), '</dd>';
*/


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

danielrichter

@Sir Osis of Liver any path to the controller itself? So I can disable the POST part too, so a user won't be able to perform POST requests and update the birthdate in the database, even if he is not able to see it anymore.

Arantor

Best route, disable the definition in Profile-Modify.PHP where all the fields are defined. Don't just blindly comment it out, or remove it - add a enabled = false line to them (see some of the other fields that are conditionally enabled for guidance)

danielrichter

@Arantor

I've edited the following lines in Profile-Modify.php:

bday1' => array(
'type' => 'callback',
'enabled' => false,
...
// Setting the birthdate the old style way?
'birthdate' => array(
'type' => 'hidden',
'enabled' => false,

is this all which is required to disable POST part too?
After these edits the birthdate fields disappeared from the profile view.

Arantor

Yes, this disables it from the POST part.

Advertisement: