This topic has 0 replies, 1 voice, and was last updated 8 years by sunny0704.

  • Author

    Tagged: 

  • #69049
     sunny0704
    Participant

    Hi,

    I added your supplying code written on post# 4075

    but it’s not working. I add below code on functions.php in the sweetdate-child.

    As I mentioned topic title, I want to change age range 5 to 19 or 5 to 80.

    Would check below code and fix it up?

    Thank you.

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

    add_action(‘after_setup_theme’,’kleo_my_custom_tabs’);
    function kleo_my_custom_tabs()
    {
    global $bp_tabs;
    $bp_tabs = array();
    /* This is the code you need to use as a base for each profile tab, the display changes if you use
    Regular type or Cite tab, cite is a quote, bigger style for a lot of text, while regular is small
    When wanting to change the style, change it at type and class , citetab , regulartab
    You can start to copy the custom code from here */
    $bp_tabs[‘CUSTOMGROUP’] = array(
    ‘type’ => ‘regular’,
    ‘name’ => __(‘CUSTOMGROUP’, ‘kleo_framework’),
    ‘group’ => ‘CUSTOMGROUP’,
    ‘class’ => ‘regulartab’
    );
    /* To here, the above code is what you need to copy and paste to make new tabs.
    The order of the tabs changes as it is in the code. */

    $bp_tabs[‘Beskriv dig selv’] = array(
    ‘type’ => ‘regular’,
    ‘name’ => __(‘Beskriv dig selv’, ‘kleo_framework’),
    ‘group’ => ‘Beskriv dig selv’,
    ‘class’ => ‘regulartab’
    );

    /* rtMedia tab – only if plugin installed */
    if (class_exists(‘RTMedia’))
    {
    $bp_tabs[‘rtmedia’] = array(
    ‘type’ => ‘rt_media’,
    ‘name’ => __(‘Photos’, ‘kleo_framework’),
    ‘class’ => ‘mySlider’
    );
    }

    /* Bp-Album tab – only if plugin installed */
    elseif (function_exists(‘bpa_init’)) {
    $bp_tabs[‘bp-album’] = array(
    ‘type’ => ‘bp_album’,
    ‘name’ => __(‘My photos’, ‘kleo_framework’),
    ‘class’ => ‘mySlider’
    );
    }

    }

    /** adding in 12 June
    */

    function bp_restrict_email_domains_validate_user_signup( $result ) {

    if ( bp_restrict_email_domains_is_email_address_safe( $result[‘user_email’] ) )
    $result[‘errors’]->add(‘user_email’, __(‘You cannot use that email address to signup.’, ‘kleo_framework’ ) );

    return $result;

    }
    add_filter( ‘bp_core_validate_user_signup’, ‘bp_restrict_email_domains_validate_user_signup’ );

    function bp_restrict_email_domains_is_email_address_safe( $user_email ) {

    $allowed_names = array(
    ‘.co.uk’,
    ‘gmail.com’
    );

    if ( is_array( $allowed_names )) {

    $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, ‘@’ ) ) );

    foreach ( (array) $allowed_names as $allowed_domain ) {

    if ( strstr( $email_domain, $allowed_domain ) ||
    (
    strstr( $allowed_domain, ‘/’ ) AND
    preg_match( $allowed_domain, $email_domain )
    )
    )
    return false;
    }

    }
    return true;
    }

    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 – 13;
    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;
    }

    //remove_filter( ‘bp_get_the_profile_field_datebox’, ‘custom_bp_datebox’,10,7);

    /* 나이 제한에 대한 내용 푸는 code

    function my_custom_bp_datebox($html, $type, $day, $month, $year, $field_id, $date) {
    $current_year = date(“Y”);
    $allowed_year = $current_year – 6;
    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;
    }*/

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

    ?>
    //send a welcome email when a user account is activated
    add_action(‘bp_core_activated_user’,’kleo_welcome_user_notification’,10,3);
    function kleo_welcome_user_notification($user_id,$key=false,$user=false) {
    if(is_multisite())
    return ;// we don’t need it for multisite
    //send the welcome mail to user
    //welcome message
    $welcome_email = __( ‘Dear USER_DISPLAY_NAME,

    Your new account is set up.

    You can log in with the following information:
    Username: USERNAME
    LOGINLINK

    Thanks!

    SITE_NAME’ );
    //get user details
    $user = get_userdata( $user_id );
    //get site name
    $site_name = get_bloginfo(‘name’);
    //update the details in the welcome email
    $welcome_email = str_replace( ‘USER_DISPLAY_NAME’, $user->first_name, $welcome_email );
    $welcome_email = str_replace( ‘SITE_NAME’, $site_name, $welcome_email );
    $welcome_email = str_replace( ‘USERNAME’, $user->user_login, $welcome_email );
    $welcome_email = str_replace( ‘LOGINLINK’, wp_login_url(), $welcome_email );

    //from email
    $admin_email = get_site_option( ‘admin_email’ );

    if ( empty($admin_email) )
    $admin_email = ‘support@’ . $_SERVER[‘SERVER_NAME’];

    $from_name = $site_name;//from
    $message_headers = “From: \”{$from_name}\” \n” . “Content-Type: text/plain; charset=\”” . get_option(‘blog_charset’) . “\”\n”;

    //EMAIL SUBJECT
    $subject = sprintf(__(‘Welcome to %1$s ‘), $site_name) ;
    //SEND THE EMAIL
    wp_mail($user->user_email, $subject, $welcome_email, $message_headers);

    return true;
    }

Viewing 1 post (of 1 total)

The forum ‘Feature requests’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?