This topic has 3 replies, 2 voices, and was last updated 11 years by mrmalmgren.
-
Author
-
March 10, 2014 at 22:32 #12471
mrmalmgren
ParticipantHow can the limit of 18 years old be changed to 13 when register?
thanks 🙂
March 13, 2014 at 00:04 #12587Abe
KeymasterHi, 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.March 17, 2014 at 23:28 #12878mrmalmgren
ParticipantHi,
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;
} -
AuthorPosts
The topic ‘Register if younger than 18’ is closed to new replies.