This topic has 3 replies, 2 voices, and was last updated 10 years by mrmalmgren.

  • Author
  • #12471
     mrmalmgren
    Participant

    How can the limit of 18 years old be changed to 13 when register?

    thanks 🙂

    #12587
     Abe
    Keymaster

    Hi, Please see this topic that limits it to 14 years old: https://archived.seventhqueen.com/forums/topic/change-min-age-year-profile-fields-should-be-updated-automatically/#post-2043

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #12878
     mrmalmgren
    Participant

    Hi,

    Added the code to the child, (see below), but it seems that the code is not accepted (it shows in the top of the admin area of wordpress)

    What am I doing wrong?

    Thanks

    <?php
    /**
    * @package WordPress
    * @subpackage Sweetdate
    * @author SeventhQueen <themesupport@seventhqueen.com>
    * @since Sweetdate 1.0
    */

    /**
    * Sweetdate Child Theme Functions
    * Add extra code or replace existing functions
    */

    ?>

    add_action(‘after_setup_theme’,’kleo_my_age’);
    function kleo_my_age()
    {
    remove_filter( ‘bp_get_the_profile_field_datebox’, ‘custom_bp_datebox’,10,7);
    add_filter( ‘bp_get_the_profile_field_datebox’, ‘my_age_range’,10,7);
    }

    /**
    * Filter year field only to allow minimum 18 year old members
    */
    function my_age_range($html, $type, $day, $month, $year, $field_id, $date) {
    $current_year = date(“Y”);
    $allowed_year = $current_year – 14;
    if($type == ‘year’){

    $html = ‘<option value=””‘ . selected( $year, ”, false ) . ‘>—-</option>’;

    for ( $i = $allowed_year; $i >= 1920; $i– ) {
    $html .= ‘<option value=”‘ . $i .'”‘ . selected( $year, $i, false ) . ‘>’ . $i . ‘</option>’;
    }
    }
    return $html;
    }

    #12892
     mrmalmgren
    Participant

    sorry! Got it!

    Thanks for your help :)!

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Register if younger than 18’ is closed to new replies.

Log in with your credentials

Forgot your details?