Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Hide Admin'

Viewing 25 results - 401 through 425 (of 915 total)
  • Author
    Search Results
  • #179434

    In reply to: Stop BuddyPress SPAM

    contrasupport
    Participant

    Most of wordpress plugins mentions above work like

    Attacker > HTTP server > PHP > WordPress > PLUGINS

    We all need to have something before WordPress that’s why I recommend

    NinjaFirewall (I do not have any relation with the plugin creator)

    https://wordpress.org/plugins/ninjafirewall/

    Block the attacker before the WordPress

    Attacker > HTTP server > PHP > NinjaFirewall > WordPress > PLUGINS

    As always in installing any plugins that possibly can block your admin access you have to read the Installation note and have access to the FTP.

    NinjaFirewall will work as another layer to protect your site.

    In addition if you have not done it:

    1. Change your “Admin” username to something dificult and at least 10 characters (+) but easily to remember (+ for you – for security) or you have to read a note (-) safely secured in your safe locker (+)
    2. Make your password at least 25 COMBINATION of characters (+) but easily to remember (+ for you – for security) or you have to read a note (-) safely secured in your safe locker (+)

    NinjaFirewall:

    • Web Application Firewall
    • Full standalone web application firewall
    • Multi-site support
    • Compatible with shared hosting accounts
    • Protects against RFI, LFI, XSS, code execution, SQL injections, brute
    • force scanners, shell scripts, backdoors and many other threats
    • Scans and/or sanitises GET / POST requests, HTTP / HTTPS traffic, cookies, server variables (HTTP_USER_AGENT, HTTP_REFERER, PHP_SELF, PATH_TRANSLATED, PATH_INFO)
    • Sanitises variables names and values
    • Advanced filtering options (ASCII control characters, NULL byte, PHP built
    • in wrappers, base64 decoder)
    • Blocks username enumeration scanning attempts through the author archives and the login page
    • Blocks/allows uploads, sanitises uploaded file names
    • Blocks suspicious bots and scanners
    • Hides PHP error and notice messages
    • Blocks direct access to PHP scripts located inside specific directories
    • Whitelist option for WordPress administrator(s), localhost and private IP address spaces
    • Configurable HTTP return code and message
    • Rules editor to enable/disable built-in security rules
    • Activity log and statistics
    • Debugging mode
    Doremdou
    Participant

    Hi ๐Ÿ™‚

    I am using Groups but as we can’t create a Group without and Admin, I still want to hide the Group Admin from the Group member list, how could I do that? ๐Ÿ™‚

    thank you very much ๐Ÿ™‚
    Dorem

    Nino
    Participant

    Hello,

    is there no option to hide the members-page, when they are not logged in?

    I tried it with roles (page only visible for admins and subscribers), but it didnยดt work.

    Greetings

    Nino

    #179033
    SubstreamAI
    Participant

    Just thought I’d update for anyone else with a similar problem. It has turned out that my Possible Solution #1 above has solved this for me completely. It does behave differently for Administrators (as it should) which caused me some confusion.

    Other Plugins I would recommend people look at if they have similar needs to mine:
    Theme My Login by Jeff Farthing: integrates user login screens into you Wordpres site/theme.
    Plugin: https://wordpress.org/plugins/theme-my-login/
    Website: http://www.jfarthing.com/extend/wordpress-plugins/theme-my-login/

    Global Hide/Remove Admin Bar Plugin bye Don Fischer: hides the WordPress Toolbar/admin bar
    Plugin: https://wordpress.org/plugins/global-admin-bar-hide-or-remove/
    Website: http://www.fischercreativemedia.com/plugins/global-hideremove-toolbar-plugin//

    Finally bbPress WP Tweaks: so popular I’m not going to leave links.

    All these plugins are essential to my gaming clan site: http://ducesoforion.com

    #179032
    SubstreamAI
    Participant

    Just thought I’d update for anyone else with a similar problem. It has turned out that my Possible Solution #1 above has solved this for me completely. It does behave differently for Administrators (as it should) which caused me some confusion.

    Other Plugins I would recommend people look at if they have similar needs to mine:
    Theme My Login by Jeff Farthing: integrates user login screens into you Wordpres site/theme.
    Plugin: https://wordpress.org/plugins/theme-my-login/
    Website: http://www.jfarthing.com/extend/wordpress-plugins/theme-my-login/

    Global Hide/Remove Admin Bar Plugin bye Don Fischer: hides the WordPress Toolbar/admin bar
    Plugin: https://wordpress.org/plugins/global-admin-bar-hide-or-remove/
    Website: http://www.fischercreativemedia.com/plugins/global-hideremove-toolbar-plugin//

    Finally bbPress WP Tweaks: so popular I’m not going to leave links.

    All these plugins are essential to my gaming clan site: http://ducesoforion.com

    #179031
    SubstreamAI
    Participant

    Just thought I’d update for anyone else with a similar problem. It has turned out that my Possible Solution #1 above has solved this for me completely. It does behave differently for Administrators (as it should) which caused me some confusion.

    Other Plugins I would recommend people look at if they have similar needs to mine:
    Theme My Login by Jeff Farthing: integrates user login screens into you Wordpres site/theme.
    Plugin: https://wordpress.org/plugins/theme-my-login/
    Website: http://www.jfarthing.com/extend/wordpress-plugins/theme-my-login/

    Global Hide/Remove Admin Bar Plugin bye Don Fischer: hides the WordPress Toolbar/admin bar
    Plugin: https://wordpress.org/plugins/global-admin-bar-hide-or-remove/
    Website: http://www.fischercreativemedia.com/plugins/global-hideremove-toolbar-plugin//

    Finally bbPress WP Tweaks: so popular I’m not going to leave links.

    All these plugins are essential to my gaming clan site: http://ducesoforion.com

    #178858
    DJsix
    Participant

    Is there an easy way to hide the admin’s activity?

    I have tried BuddyPress Ninja, and it’s outdated and doesn’t work.
    I have tried putting the stealth mode code into bp-custom.php:

    Stealth Mode for BuddyPress Site Admin Plugin


    …and that doesn’t work.

    I have searched and found many “solutions”, but in the comments for the codes, are nothing but negative reports.

    Thanks.

    BackpackersUnion
    Participant

    I’m trying to remove the section of the registration page that allows new users to create a blog during registration. I know you can remove the option through the admin network settings, but I still want users to have the option to create a blog after registration.

    The website uses WordPress Multisite and BuddyPress along with a “Secure Invite” plugin that requires new users to be invited by existing users. If I understand correctly, the BuddyPress Registration page is responsible for serving up the registration options from other components of the site, which currently include,

    WordPress (Username and Password)
    *Multi Site (New Blog Registration “Blog Details”)
    BuddyPress (Username + Profile Field)

    Is there a way using a child theme to have the BuddyPress’s registration page hide the Multisite Registration options (i.e. “Blog Details”) or just not serve them up?

    Here’s a screen shot of the options I’m looking to remove, Screen Shot
    The site address is, http://backpackersjournal.com/

    I’m completely stumped by this one so any help would be amazing!

    WordPress 3.8.1, BuddyPress 1.9.2

    Thanks in advance!

    Suzan Jasmin O.
    Participant

    Hi
    I have the latest Wp and latest BuddyPress 1.9.2
    On the new user registration form it has FULL NAME box
    But I need FIRST NAME and LAST NAME boxes. So I can in admin panel and users on frontend can register new users can fill their names with 2 boxes. And on search page users can search other users by first name or last name. And I can hide last names for some users etc.. Its always convenient to have first and last names in separate DB columns. So please help me out, how can I have the BuddyPress plugged site of mine to function like above?
    Thanks

    #178706
    Suzan Jasmin O.
    Participant

    Hi
    I have the latest Wp and latest BuddyPress 1.9.2
    On the new user registration form it has FULL NAME box
    But I need FIRST NAME and LAST NAME boxes. So I can in admin panel and users on frontend can register new users can fill their names with 2 boxes. And on search page users can search other users by first name or last name. And I can hide last names for some users etc.. Its always convenient to have first and last names in separate DB columns. So please help me out, how can I have the BuddyPress plugged site of mine to function like above?
    Thanks

    #178705
    Suzan Jasmin O.
    Participant

    Hi
    I have the latest Wp and latest BuddyPress 1.9.2
    On the new user registration form it has FULL NAME box
    But I need FIRST NAME and LAST NAME boxes. So I can in admin panel and users on frontend can register new users can fill their names with 2 boxes. And on search page users can search other users by first name or last name. And I can hide last names for some users etc.. Its always convenient to have first and last names in separate DB columns. So please help me out, how can I have the BuddyPress plugged site of mine to function like above?
    Thanks

    #178703
    Suzan Jasmin O.
    Participant

    Hi
    I have the latest Wp and latest BuddyPress 1.9.2
    On the new user registration form it has FULL NAME box
    But I need FIRST NAME and LAST NAME boxes. So I can in admin panel and users on frontend can register new users can fill their names with 2 boxes. And on search page users can search other users by first name or last name. And I can hide last names for some users etc.. Its always convenient to have first and last names in separate DB columns. So please help me out, how can I have the BuddyPress plugged site of mine to function like above?
    Thanks

    #178702
    Suzan Jasmin O.
    Participant

    Hi truthmedia
    I have the latest Wp and latest BuddyPress 1.9.2
    On the new user registration form it has FULL NAME box
    But I need FIRST NAME and LAST NAME boxes. So I can in admin panel and users on frontend can register new users can fill their names with 2 boxes. And on search page users can search other users by first name or last name. And I can hide last names for some users etc.. Its always convenient to have first and last names in separate DB columns. So please help me out, how can I have the BuddyPress plugged site of mine to function like above?
    Thanks

    #178513
    agundabbo
    Participant

    Hi.
    I Would like to hide the “edit profile” buttons (in profiles and in bar) for non-admin user.
    How can I do it.
    Which CSS I have to modify and how?
    Thanks.

    #177164
    shallowjeff
    Participant

    Hi,
    I need help. I’ve managed to get rid of the auto linking default function within the profile section of my members page, but am unable to place anything that has java and/or button qualities. I have a place for “profile widgets” but instead of the actual widget, I get an H-ref ugly link. http://www.poetsatwork.com

    For example:
    I paste this,

    <SCRIPT charset=โ€utf-8โ€ณ type=โ€text/javascriptโ€ src=โ€http://ws-na.amazon-adsystem.com/widgets/q?rt=tf_cw&ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Flovecourses-20%2F8010%2F5a411cc7-5346-4d91-86c2-9808086e235e&Operation=GetScriptTemplateโ€> </SCRIPT> <NOSCRIPT>Amazon.com Widgets</NOSCRIPT>

    On the page it shows this,

    <a-HREF=โ€http://ws-na.amazon-adsystem.com/widgets/q?rt=tf_cw&ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Flovecourses-20%2F8010%2F5a411cc7-5346-4d91-86c2-9808086e235e&Operation=NoScript=โ€ Amazon.com Widgets

    This is the same for all link type images/widgets I place within BP. The stuff I put on the sidebars within wordpress works fine.

    Why? I’m sure it’s a filter/function, but not sure where/what to change.

    Here is my code:buddypress-xprofile-custom-fields-type/bp-xprofile-custom-fields-type.php
    THE CODE I USED TO GET RID OF AUTO LINKING IS ON THE VERY BOTTOM, THANKS http://www.poetsatwork.com

    
    /*
    Plugin Name: Buddypress Xprofile Custom Fields Type
    Plugin URI: https://github.com/donmik/buddypress-xprofile-custom-fields-type/
    Description: Buddypress installation required!! Add more custom fields type to extended profiles in buddypress: Birthdate, Email, Web, Datepicker. If you need more fields type, you are free to add them yourself or request us at miguel@donmik.com.
    Version: 1.5.8.4
    Author: donmik
    Author URI: http://donmik.com
    */
    //load text domain
    function bxcft_load_textdomain() {
    $locale = apply_filters( 'bxcft_load_load_textdomain_get_locale', get_locale() );
    // if load .mo file
    if ( !empty( $locale ) ) {
    $mofile_default = sprintf( '%slang/%s.mo', plugin_dir_path(__FILE__), $locale );
    $mofile = apply_filters( 'bxcft_load_textdomain_mofile', $mofile_default );
    
    if ( file_exists( $mofile ) )
    load_textdomain( โ€œbxcftโ€, $mofile );
    }
    }
    add_action ( 'bp_init', 'bxcft_load_textdomain', 2 );
    
    function bxcft_add_new_xprofile_field_type($field_types){
    $new_field_types = array('birthdate', 'email', 'web', 'datepicker',
    'select_custom_post_type', 'multiselect_custom_post_type',
    'checkbox_acceptance', 'image', 'file', 'color', 'number');
    $field_types = array_merge($field_types, $new_field_types);
    return $field_types;
    }
    add_filter( 'xprofile_field_types', 'bxcft_add_new_xprofile_field_type' );
    
    function bxcft_admin_render_new_xprofile_field_type($field, $echo = true) {
    $html = โ€;
    switch ( $field->type ) {
    case 'number':
    $html .= '<input type=โ€numberโ€ name=โ€field_'.$field->id.'โ€ id=โ€'.$field->id.'โ€ class=โ€input-numberโ€ />';
    break;
    
    case 'color':
    $html .= '<input type=โ€colorโ€ name=โ€field_'.$field->id.'โ€ id=โ€'.$field->id.'โ€ class=โ€input-colorโ€ />';
    break;
    
    case 'image':
    case 'file':
    $html .= '<input type=โ€fileโ€ name=โ€field_'.$field->id.'โ€ id=โ€'.$field->id.'โ€ class=โ€input-fileโ€ /> ';
    break;
    
    case 'checkbox_acceptance':
    $html .= '<input type=โ€checkboxโ€ name=โ€field_'.$field->id.'โ€ id=โ€'.$field->id.'โ€ class=โ€input-checkboxโ€ value=โ€โ€ /> ';
    $html .= $field->description;
    $field->description = โ€;
    break;
    
    case 'select_custom_post_type':
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    }
    $select_custom_post_type = BP_XProfile_ProfileData::get_value_byid( $field->id );
    $html .= '<select name=โ€field_'.$field->id.'โ€ id=โ€field_'.$field->id.'โ€>';
    if (isset($loop)) {
    foreach ($loop->posts as $post) {
    $html .= '<option value=โ€'.$post->ID.'โ€>'.$post->post_title.'</option>';
    }
    }
    $html .= '</select>';
    break;
    
    case โ€œmultiselect_custom_post_typeโ€:
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    }
    $select_custom_post_type = BP_XProfile_ProfileData::get_value_byid( $field->id );
    $html .= '<select name=โ€field_'.$field->id.'โ€ id=โ€field_'.$field->id.'โ€ multiple=โ€multipleโ€>';
    if (isset($loop)) {
    foreach ($loop->posts as $post) {
    $html .= '<option value=โ€'.$post->ID.'โ€>'.$post->post_title.'</option>';
    }
    }
    $html .= '</select>';
    break;
    
    case โ€œdatepickerโ€:
    $html .= '<input type=โ€dateโ€ name=โ€field_'.$field->id.'โ€ id=โ€'.$field->id.'โ€ class=โ€inputโ€ value=โ€โ€ />';
    break;
    
    case โ€œwebโ€:
    $html .= '<input type=โ€urlโ€ name=โ€field_'.$field->id.'โ€ id=โ€'.$field->id.'โ€ class=โ€inputโ€ placeholder=โ€'.__('yourwebsite.com', 'bxcft').'โ€ value=โ€โ€ />';
    break;
    
    case โ€œemailโ€:
    $html .= '<input type=โ€emailโ€ name=โ€field_'.$field->id.'โ€ id=โ€'.$field->id.'โ€ class=โ€inputโ€ placeholder=โ€'.__('example@mail.com', 'bxcft').'โ€ value=โ€โ€ />';
    break;
    
    case โ€œbirthdateโ€:
    $date = BP_XProfile_ProfileData::get_value_byid( $field->id );
    
    // Set day, month, year defaults
    $day = โ€;
    $month = โ€;
    $year = โ€;
    
    if ( !empty( $date ) ) {
    
    // If Unix timestamp
    if ( is_numeric( $date ) ) {
    $day = date( 'j', $date );
    $month = date( 'F', $date );
    $year = date( 'Y', $date );
    
    // If MySQL timestamp
    } else {
    $day = mysql2date( 'j', $date );
    $month = mysql2date( 'F', $date, false ); // Not localized, so that selected() works below
    $year = mysql2date( 'Y', $date );
    }
    }
    
    // Check for updated posted values, and errors preventing
    // them from being saved first time.
    if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
    if ( $day != $_POST['field_' . $field->id . '_day'] ) {
    $day = $_POST['field_' . $field->id . '_day'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_month'] ) ) {
    if ( $month != $_POST['field_' . $field->id . '_month'] ) {
    $month = $_POST['field_' . $field->id . '_month'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_year'] ) ) {
    if ( $year != date( โ€œjโ€, $_POST['field_' . $field->id . '_year'] ) ) {
    $year = $_POST['field_' . $field->id . '_year'];
    }
    }
    
    // Day.
    $html .= '<select name=โ€field_'.$field->id.'_dayโ€ id=โ€field_'.$field->id.'_dayโ€>';
    $html .= '<option value=โ€โ€' . selected( $day, โ€, false ) . '>โ€“</option>';
    for ( $i = 1; $i < 32; ++$i ) {
    $html .= '<option value=โ€' . $i .'โ€' . selected( $day, $i, false ) . '>' . $i . '</option>';
    }
    $html .= '</select>';
    
    // Month.
    $html .= '<select name=โ€field_'.$field->id.'_monthโ€ id=โ€field_'.$field->id.'_monthโ€>';
    $eng_months = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
    $months = array(
    __( 'January', 'buddypress' ),
    __( 'February', 'buddypress' ),
    __( 'March', 'buddypress' ),
    __( 'April', 'buddypress' ),
    __( 'May', 'buddypress' ),
    __( 'June', 'buddypress' ),
    __( 'July', 'buddypress' ),
    __( 'August', 'buddypress' ),
    __( 'September', 'buddypress' ),
    __( 'October', 'buddypress' ),
    __( 'November', 'buddypress' ),
    __( 'December', 'buddypress' )
    );
    $html .= '<option value=โ€โ€' . selected( $month, โ€, false ) . '>โ€”โ€”</option>';
    for ( $i = 0; $i < 12; ++$i ) {
    $html .= '<option value=โ€' . $eng_months[$i] . 'โ€' . selected( $month, $eng_months[$i], false ) . '>' . $months[$i] . '</option>';
    }
    $html .= '</select>';
    
    // Year.
    $html .= '<select name=โ€field_'.$field->id.'_yearโ€ id=โ€field_'.$field->id.'_yearโ€>';
    $html .= '<option value=โ€โ€' . selected( $year, โ€, false ) . '>โ€”-</option>';
    for ( $i = date('Y')-1; $i > 1901; $iโ€“ ) {
    $html .= '<option value=โ€' . $i .'โ€' . selected( $year, $i, false ) . '>' . $i . '</option>';
    }
    $html .= '</select>';
    break;
    
    default:
    // Field type unrecognized.
    // $html = โ€œ<p>โ€.__('Field type unrecognized', 'bxcft').โ€</p>โ€;
    break;
    }
    
    if ($echo){
    echo $html;
    return;
    } else {
    return $html;
    }
    
    }
    add_filter( 'xprofile_admin_field', 'bxcft_admin_render_new_xprofile_field_type' );
    
    function bxcft_edit_render_new_xprofile_field($echo = true) {
    global $field;
    if (!is_bool($echo)) {
    $echo = true;
    }
    
    $uploads = wp_upload_dir();
    
    ob_start();
    if ( bp_get_the_profile_field_type() == 'birthdate' ) {
    $date = BP_XProfile_ProfileData::get_value_byid( $field->id );
    // Set day, month, year defaults
    $day = โ€;
    $month = โ€;
    $year = โ€;
    
    if ( !empty( $date ) ) {
    
    // If Unix timestamp
    if ( is_numeric( $date ) ) {
    $day = date( 'j', $date );
    $month = date( 'F', $date );
    $year = date( 'Y', $date );
    
    // If MySQL timestamp
    } else {
    $day = mysql2date( 'j', $date );
    $month = mysql2date( 'F', $date, false ); // Not localized, so that selected() works below
    $year = mysql2date( 'Y', $date );
    }
    }
    
    // Check for updated posted values, and errors preventing
    // them from being saved first time.
    if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
    if ( $day != $_POST['field_' . $field->id . '_day'] ) {
    $day = $_POST['field_' . $field->id . '_day'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_month'] ) ) {
    if ( $month != $_POST['field_' . $field->id . '_month'] ) {
    $month = $_POST['field_' . $field->id . '_month'];
    }
    }
    
    if ( !empty( $_POST['field_' . $field->id . '_year'] ) ) {
    if ( $year != date( โ€œjโ€, $_POST['field_' . $field->id . '_year'] ) ) {
    $year = $_POST['field_' . $field->id . '_year'];
    }
    }
    ?>
    <div class=โ€dateboxโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%s_dayโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    // Dropdown => Day of month.
    $options_day = โ€;
    for ($i=1; $i<32; ++$i) {
    $options_day .= sprintf('<option value=โ€%sโ€%s>%s</option>',
    $i,
    selected($day, $i, false),
    $i);
    }
    $input = sprintf('<select name=โ€%s_dayโ€ id=โ€%s_dayโ€%s><option value=โ€โ€%s>โ€“</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?'aria-required=โ€trueโ€':โ€,
    selected($day, โ€, false),
    $options_day);
    
    // Dropdown => Month.
    $eng_months = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
    $months = array(
    __( 'January', 'buddypress' ),
    __( 'February', 'buddypress' ),
    __( 'March', 'buddypress' ),
    __( 'April', 'buddypress' ),
    __( 'May', 'buddypress' ),
    __( 'June', 'buddypress' ),
    __( 'July', 'buddypress' ),
    __( 'August', 'buddypress' ),
    __( 'September', 'buddypress' ),
    __( 'October', 'buddypress' ),
    __( 'November', 'buddypress' ),
    __( 'December', 'buddypress' )
    );
    $options_month = โ€;
    for ($i=0; $i<12; ++$i) {
    $options_month .= sprintf('<option value=โ€%sโ€%s>%s</option>',
    $eng_months[$i],
    selected( $month, $eng_months[$i], false ),
    $months[$i]);
    }
    $input .= sprintf('<select name=โ€%s_monthโ€ id=โ€%s_monthโ€%s><option value=โ€โ€%s>โ€”โ€”</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?'aria-required=โ€trueโ€':โ€,
    selected($month, โ€, false),
    $options_month);
    
    // Dropdown => Year.
    $birthdate_start_year = date('Y')-1;
    $options_year = โ€;
    for ($i=$birthdate_start_year; $i>1901; $iโ€“) {
    $options_year .= sprintf('<option value=โ€%sโ€%s>%s</option>',
    $i,
    selected($year, $i, false),
    $i);
    }
    $input .= sprintf('<select name=โ€%s_yearโ€ id=โ€%s_yearโ€%s><option value=โ€โ€%s>โ€”-</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?'aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    selected($year, โ€, false),
    $options_year);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'email' ) {
    ?>
    <div class=โ€input-emailโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $input = sprintf('<input type=โ€emailโ€ name=โ€%sโ€ id=โ€%sโ€%s class=โ€inputโ€ value=โ€%sโ€ placeholder=โ€%sโ€ />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    bp_get_the_profile_field_edit_value(),
    __('example@mail.com', 'bxcft'));
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'web' ) {
    ?>
    <div class=โ€input-webโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $input = sprintf('<input type=โ€urlโ€ name=โ€%sโ€ id=โ€%sโ€%s class=โ€inputโ€ value=โ€%sโ€ placeholder=โ€%sโ€ />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    bp_get_the_profile_field_edit_value(),
    __('http://yourwebsite.com', 'bxcft'));
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'datepicker' ) {
    ?>
    <div class=โ€input-datepickerโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $input = sprintf('<input type=โ€dateโ€ name=โ€%sโ€ id=โ€%sโ€%s class=โ€inputโ€ value=โ€%sโ€ />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    bp_get_the_profile_field_edit_value());
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'select_custom_post_type' ) {
    ?>
    <div class=โ€input-custom-post-typeโ€>
    <?php
    $custom_post_type_selected = BP_XProfile_ProfileData::get_value_byid( $field->id );
    if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != โ€ ) {
    if ( !empty( $_POST['field_' . $field->id] ) ) {
    $custom_post_type_selected = $_POST['field_' . $field->id];
    }
    }
    if (is_null($custom_post_type_selected)) {
    $custom_post_type_selected = array();
    }
    // Get field's data.
    $field_data = new BP_XProfile_Field($field->id);
    // Get the childs of field
    $childs = $field_data->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $options_posts = โ€;
    foreach ($loop->posts as $post) {
    $options_posts .= sprintf('<option value=โ€%sโ€%s>%s</option>',
    $post->ID,
    ($custom_post_type_selected==$post->ID)?' selected=โ€selectedโ€':โ€,
    $post->post_title);
    }
    $input = sprintf('<select name=โ€%sโ€ id=โ€%sโ€%s class=โ€selectโ€><option value=โ€โ€>%s</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    __('Selectโ€ฆ', 'bxcft'),
    $options_posts);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    } else {
    _e('There is no custom post type selected.', 'bxcft');
    }
    ?>
    </div>
    <?php
    }
    elseif ( bp_get_the_profile_field_type() == 'multiselect_custom_post_type' ) {
    ?>
    <div class=โ€input-custom-post-type-multiโ€>
    <?php
    $custom_post_type_selected = maybe_unserialize(BP_XProfile_ProfileData::get_value_byid( $field->id ));
    if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != โ€ ) {
    if ( !empty( $_POST['field_' . $field->id] ) ) {
    $custom_post_type_selected = $_POST['field_' . $field->id];
    }
    }
    // Get field's data.
    $field_data = new BP_XProfile_Field($field->id);
    // Get the childs of field
    $childs = $field_data->get_children();
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    // Get the posts of custom post type.
    $loop = new WP_Query(array('posts_per_page' => -1, 'post_type' => $custom_post_type, 'orderby' => 'title', 'order' => 'ASC' ));
    
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $options_posts = โ€;
    foreach ($loop->posts as $post) {
    $options_posts .= sprintf('<option value=โ€%sโ€%s>%s</option>',
    $post->ID,
    (!empty($custom_post_type_selected) &&in_array($post->ID, $custom_post_type_selected))?' selected=โ€selectedโ€':โ€,
    $post->post_title);
    }
    $input = sprintf('<select name=โ€%s[]โ€ id=โ€%sโ€%s class=โ€selectโ€ multiple=โ€multipleโ€><option value=โ€โ€>%s</option>%s</select>',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    __('Selectโ€ฆ', 'bxcft'),
    $options_posts);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    } else {
    _e('There is no custom post type selected.', 'bxcft');
    }
    ?>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'checkbox_acceptance') {
    ?>
    <div class=โ€checkbox-acceptanceโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $input = sprintf('<input type=โ€checkboxโ€ name=โ€%sโ€ id=โ€%sโ€%s class=โ€checkboxโ€ value=โ€1โ€ณ%s />%s',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    bp_get_the_profile_field_edit_value()?' checked=โ€checkedโ€':โ€,
    bp_get_the_profile_field_description());
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    $field_description = โ€;
    ?>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'image') {
    ?>
    <div class=โ€input-imageโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    if (bp_get_the_profile_field_edit_value() != โ€) {
    $actual_image = sprintf('%s<label for=โ€%s_deleteimgโ€><input type=โ€checkboxโ€ name=โ€%s_deleteimgโ€ id=โ€%s_deleteimgโ€ value=โ€1โ€ณ />%s</label><input type=โ€hiddenโ€ name=โ€%s_hiddenimgโ€ id=โ€%s_hiddenimgโ€ value=โ€%sโ€ />',
    $uploads['baseurl'].bp_get_the_profile_field_edit_value(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    __('Check this to delete this image', 'bxcft'),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_edit_value());
    } else {
    $actual_image = โ€;
    }
    $input = sprintf('<input type=โ€fileโ€ name=โ€%sโ€ id=โ€%sโ€%s />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    
    echo apply_filters('bxcft_field_actual_image', $actual_image, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value());
    ?>
    <script type=โ€text/javascriptโ€>
    jQuery('#profile-edit-form').attr('enctype', 'multipart/form-data');
    </script>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'file') {
    ?>
    <div class=โ€input-fileโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    if (bp_get_the_profile_field_edit_value() != โ€) {
    $actual_file = sprintf('%s<label for=โ€%s_deletefileโ€><input type=โ€checkboxโ€ name=โ€%s_deletefileโ€ id=โ€%s_deletefileโ€ value=โ€1โ€ณ />%s</label><input type=โ€hiddenโ€ name=โ€%s_hiddenfileโ€ id=โ€%s_hiddenfileโ€ value=โ€%sโ€ />',
    apply_filters('bxcft_show_download_file_link', '' . __('Download file', 'bxcft') . '', bp_get_the_profile_field_type(), bp_get_the_profile_field_id(), bp_get_the_profile_field_edit_value()),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    __('Check this to delete this file', 'bxcft'),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_edit_value());
    } else {
    $actual_file = โ€;
    }
    $input = sprintf('<input type=โ€fileโ€ name=โ€%sโ€ id=โ€%sโ€%s />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    
    echo apply_filters('bxcft_field_actual_file', $actual_file, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value());
    ?>
    <script type=โ€text/javascriptโ€>
    jQuery('#profile-edit-form').attr('enctype', 'multipart/form-data');
    </script>
    </div>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'color') {
    $color_selected = bp_get_the_profile_field_edit_value();
    if (strpos($color_selected, '#') === false) {
    $color_selected = '#'.$color_selected;
    }
    ?>
    <div class=โ€input-colorโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $input = sprintf('<input type=โ€colorโ€ name=โ€%sโ€ id=โ€%sโ€%s class=โ€inputโ€ value=โ€%sโ€ />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    $color_selected);
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <script>
    if (!Modernizr.inputtypes.color) {
    // No html5 field colorpicker => Calling jscolor.
    jQuery('input#<?php bp_the_profile_field_input_name() ?>').addClass('color');
    }
    </script>
    <?php
    }
    elseif (bp_get_the_profile_field_type() == 'number') {
    ?>
    <div class=โ€input-numberโ€>
    <?php
    $label = sprintf('<label class=โ€label-form%sโ€ for=โ€%sโ€>%s%s</label>',
    bp_get_the_profile_field_is_required()?' required':โ€,
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_name(),
    bp_get_the_profile_field_is_required()?' '.__('(required)', 'buddypress'):โ€);
    
    $input = sprintf('<input type=โ€numberโ€ name=โ€%sโ€ id=โ€%sโ€%s class=โ€inputโ€ value=โ€%sโ€ />',
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_input_name(),
    bp_get_the_profile_field_is_required()?' aria-required=โ€trueโ€ required=โ€requiredโ€':โ€,
    bp_get_the_profile_field_edit_value());
    
    echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
    
    do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' );
    
    echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
    ?>
    </div>
    <?php
    }
    
    $output = ob_get_contents();
    ob_end_clean();
    
    if ($echo) {
    echo $output;
    return;
    }
    return $output;
    }
    
    /*
    * Buddypress v1.7 has better hook bp_custom_profile_edit_fields_pre_visibility which shows fields before visibility settings.
    * In case buddypress previous version is installed, we use the other tag bp_custom_profile_edit_fields.
    */
    $version_bp = 0;
    $data = get_file_data(WP_PLUGIN_DIR . '/buddypress/bp-loader.php', array('Version'));
    if (isset($data) && count($data) > 0 && $data[0] != โ€)
    $version_bp = (float)$data[0];
    if ($version_bp >= 1.7)
    add_action( 'bp_custom_profile_edit_fields_pre_visibility', 'bxcft_edit_render_new_xprofile_field' );
    else
    add_action( 'bp_custom_profile_edit_fields', 'bxcft_edit_render_new_xprofile_field' );
    
    function bxcft_get_field_value( $value=โ€, $type=โ€, $id=โ€) {
    
    $value_to_return = $value;
    
    if ($value_to_return == โ€)
    return apply_filters('bxcft_show_field_value', $value_to_return, $type, $id, $value);
    
    $uploads = wp_upload_dir();
    
    if ($type == 'birthdate') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $field = new BP_XProfile_Field($id);
    // Get children.
    $childs = $field->get_children();
    $show_age = false;
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    if ($childs[0]->name == 'show_age')
    $show_age = true;
    }
    if ($value != โ€) {
    if ($show_age) {
    $value_to_return = '<p>'.floor((time() โ€“ strtotime($value))/31556926).'</p>';
    } else {
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    }
    }
    elseif ($type == 'datepicker') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    elseif ($type == 'email') {
    if (strpos($value, 'mailto') === false) {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($type == 'web') {
    if (strpos($value, 'href=') === false) {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($type == 'select_custom_post_type') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    // Get field's data.
    $field = new BP_XProfile_Field($id);
    // Get children.
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    }
    $post = get_post($value);
    if ($post->post_type == $custom_post_type) {
    $value_to_return = '<p>'.$post->post_title.'</p>';
    } else {
    // Custom post type is not the same.
    $value_to_return = '<p>โ€“</p>';
    }
    }
    elseif ($type == 'multiselect_custom_post_type') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    // Get field's data.
    $field = new BP_XProfile_Field($id);
    // Get children.
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0])) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    } else {
    $custom_post_type = โ€;
    }
    $values = explode(โ€œ,โ€, $value);
    $cad = โ€;
    foreach ($values as $v) {
    $post = get_post($v);
    if ($post->post_type == $custom_post_type) {
    if ($cad == โ€)
    $cad .= '<ul class=โ€list_custom_post_typeโ€>';
    $cad .= '
    '.$post->post_title.'
    
    ';
    }
    }
    if ($cad != โ€) {
    $cad .= '';
    $value_to_return = '<p>'.$cad.'</p>';
    } else {
    $value_to_return = '<p>โ€“</p>';
    }
    } elseif ($type == 'checkbox_acceptance') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.(($value==1)?__('yes', 'bxcft'):__('no', 'bxcft')).'</p>';
    } elseif ($type == 'image') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p></p>';
    } elseif ($type == 'file') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.__('Download file', 'bxcft').'</p>';
    } elseif ($type == 'color') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    if (strpos($value, '#') === false) {
    $value = '#'.$value;
    }
    $value_to_return = '<p>'.$value.'</p>';
    }
    // Number nothing to do.
    
    return apply_filters('bxcft_show_field_value', $value_to_return, $type, $id, $value);
    }
    add_filter( 'bp_get_the_profile_field_value', 'bxcft_get_field_value', 15, 3);
    
    /**
    * Filter for those who use xprofile_get_field_data instead of get_field_value.
    * @param type $value
    * @param type $field_id
    * @param type $user_id
    * @return string
    */
    function bxcft_get_field_data($value, $field_id) {
    
    $value_to_return = $value;
    $field = new BP_XProfile_Field($field_id);
    
    if ($value_to_return == โ€)
    return apply_filters('bxcft_show_field_value', $value_to_return, $field->type, $field_id, $value);
    
    $uploads = wp_upload_dir();
    if ($field->type == 'birthdate') {
    // Get children.
    $childs = $field->get_children();
    $show_age = false;
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0])) {
    if ($childs[0]->name == 'show_age')
    $show_age = true;
    }
    if ($value != โ€) {
    if ($show_age) {
    $value_to_return = '<p>'.floor((time() โ€“ strtotime($value))/31556926).'</p>';
    } else {
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    }
    }
    elseif ($field->type == 'datepicker') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.date_i18n(get_option('date_format') ,strtotime($value) ).'</p>';
    }
    elseif ($field->type == 'email') {
    if (strpos($value, 'mailto') === false) {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($field->type == 'web') {
    if (strpos($value, 'href=') === false) {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.$value.'</p>';
    }
    }
    elseif ($field->type == 'select_custom_post_type') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    // Get children.
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    }
    $post = get_post($value);
    if ($post->post_type == $custom_post_type) {
    $value_to_return = '<p>'.$post->post_title.'</p>';
    } else {
    // Custom post type is not the same.
    $value_to_return = '<p>โ€“</p>';
    }
    }
    elseif ($field->type == 'multiselect_custom_post_type') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    // Get children.
    $childs = $field->get_children();
    $values = explode(โ€œ,โ€, $value);
    $cad = โ€;
    if (isset($childs) && is_array($childs) && count($childs) > 0) {
    // Get the name of custom post type.
    $custom_post_type = $childs[0]->name;
    
    foreach ($values as $v) {
    $post = get_post($v);
    if ($post->post_type == $custom_post_type) {
    if ($cad == โ€)
    $cad .= '<ul class=โ€list_custom_post_typeโ€>';
    $cad .= '
    '.$post->post_title.'
    
    ';
    }
    }
    }
    if ($cad != โ€) {
    $cad .= '';
    $value_to_return = '<p>'.$cad.'</p>';
    } else {
    $value_to_return = '<p>โ€“</p>';
    }
    } elseif ($field->type == 'checkbox_acceptance') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.(($value==1)?__('yes', 'bxcft'):__('no', 'bxcft')).'</p>';
    } elseif ($field->type == 'image') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p></p>';
    } elseif ($field->type == 'file') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    $value_to_return = '<p>'.__('Download file', 'bxcft').'</p>';
    } elseif ($field->type == 'color') {
    $value = str_replace(โ€œ<p>โ€, โ€œโ€, $value);
    $value = str_replace(โ€œ</p>โ€, โ€œโ€, $value);
    if (strpos($value, '#') === false) {
    $value = '#'.$value;
    }
    $value_to_return = '<p>'.$value.'</p>';
    }
    // Number nothing to do.
    
    return apply_filters('bxcft_show_field_value', $value_to_return, $field->type, $field_id, $value);
    
    }
    add_filter( 'xprofile_get_field_data', 'bxcft_get_field_data', 15, 2);
    
    /**
    * Function replacing the original buddypress filter.
    * @param type $field_value
    * @param type $field_type
    * @return string
    */
    function bxcft_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
    if ( 'datebox' == $field_type || 'email' == $field_type || 'birthdate' == $field_type ||
    'datepicker' == $field_type || 'web' == $field_type || 'select_custom_post_type' == $field_type ||
    'multiselect_custom_post_type' == $field_type || 'image' == $field_type || 'file' == $field_type ||
    'color' == $field_type || 'number' == $field_type)
    return $field_value;
    
    if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
    return $field_value;
    
    $values = explode( ',', $field_value );
    
    if ( !empty( $values ) ) {
    foreach ( (array) $values as $value ) {
    $value = trim( $value );
    
    // If the value is a URL, skip it and just make it clickable.
    if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) {
    $new_values[] = make_clickable( $value );
    
    // Is not clickable
    } else {
    
    // More than 5 spaces
    if ( count( explode( ' ', $value ) ) > 5 ) {
    $new_values[] = $value;
    
    // Less than 5 spaces
    } else {
    $search_url = add_query_arg( array( 's' => urlencode( $value ) ), bp_get_members_directory_permalink() );
    $new_values[] = '' . $value . '';
    }
    }
    }
    
    $values = implode( ', ', $new_values );
    }
    
    return $values;
    }
    
    /**
    * Adding js for admin.
    * @param type $hook
    * @return type
    */
    function bxcft_add_js($hook) {
    if ('users_page_bp-profile-setup' != $hook && 'buddypress_page_bp-profile-setup' != $hook)
    return;
    
    wp_enqueue_script( 'bxcft-js', plugins_url('assets/js/addfields.js', __FILE__), array( 'jquery' ), '1.5.7โ€ฒ );
    $params = array(
    'birthdate' => __('Birthdate', 'bxcft'),
    'email' => __('Email', 'bxcft'),
    'web' => __('Website', 'bxcft'),
    'datepicker' => __('Datepicker', 'bxcft'),
    'select_custom_post_type' => __('Custom Post Type Selector', 'bxcft'),
    'multiselect_custom_post_type' => __('Custom Post Type Multiselector', 'bxcft'),
    'checkbox_acceptance' => __('Checkbox acceptance', 'bxcft'),
    'image' => __('Image', 'bxcft'),
    'file' => __('File', 'bxcft'),
    'color' => __('Color', 'bxcft'),
    'number' => __('Number', 'bxcft')
    );
    wp_localize_script('bxcft-js', 'params', $params);
    }
    add_action( 'admin_enqueue_scripts', 'bxcft_add_js');
    
    /**
    * Adding js for edit form.
    */
    function bxcft_add_js_public() {
    // Modernizr to test html5 fields.
    wp_enqueue_script( 'bxcft-modernizr', plugins_url('assets/js/modernizr.js', __FILE__), array( 'jquery' ), '2.6.2โ€ฒ );
    // Plugin jscolor fallback colorpicker.
    wp_enqueue_script( 'bxcft-jscolor', plugins_url('assets/js/jscolor/jscolor.js', __FILE__), array( 'bxcft-modernizr' ), '1.4.1โ€ฒ );
    }
    add_action( 'wp_enqueue_scripts', 'bxcft_add_js_public');
    
    function bxcft_save_custom_option($field) {
    global $bp, $wpdb;
    
    if ( 'select_custom_post_type' == $field->type ) {
    $post_option = !empty( $_POST['select_custom_post_type_option']) ? $_POST['select_custom_post_type_option'] : โ€;
    if ( โ€ != $post_option ) {
    if ( !empty( $field->id ) ) {
    $field_id = $field->id;
    } else {
    $field_id = $wpdb->insert_id;
    }
    if ( !$wpdb->query( $wpdb->prepare( โ€œINSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'custom_post_type_option', %s, โ€, 0, %d, %d)โ€, $field->group_id, $field_id, $post_option, 1, 1 ) ) ) {
    return false;
    }
    }
    }
    elseif ( 'multiselect_custom_post_type' == $field->type) {
    $post_option = !empty( $_POST['multiselect_custom_post_type_option']) ? $_POST['multiselect_custom_post_type_option'] : โ€;
    if ( โ€ != $post_option ) {
    if ( !empty( $field->id ) ) {
    $field_id = $field->id;
    } else {
    $field_id = $wpdb->insert_id;
    }
    if ( !$wpdb->query( $wpdb->prepare( โ€œINSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'multi_custom_post_type_option', %s, โ€, 0, %d, %d)โ€, $field->group_id, $field_id, $post_option, 1, 1 ) ) ) {
    return false;
    }
    }
    }
    elseif ( 'birthdate' == $field->type) {
    $post_option = !empty( $_POST['birthdate_option']) ? $_POST['birthdate_option'] : โ€;
    if ( โ€ != $post_option ) {
    if ( !empty( $field->id ) ) {
    $field_id = $field->id;
    } else {
    $field_id = $wpdb->insert_id;
    }
    if ( !$wpdb->query( $wpdb->prepare( โ€œINSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'birthdate_option', %s, โ€, 0, %d, %d)โ€, $field->group_id, $field_id, $post_option, 1, 1 ) ) ) {
    return false;
    }
    }
    }
    
    }
    add_action( 'xprofile_field_after_save', 'bxcft_save_custom_option');
    
    function bxcft_delete_field_custom($field) {
    if ($field->type == 'select_custom_post_type' || $field->type == 'multiselect_custom_post_type'
    || $field->type == 'birthdate') {
    $field->delete_children();
    }
    }
    add_action( 'xprofile_fields_deleted_field', 'bxcft_delete_field_custom');
    
    function bxcft_selected_field($field) {
    $childs = $field->get_children();
    if (isset($childs) && count($childs) > 0 && is_object($childs[0]) && $field->type == 'select_custom_post_type') {
    $selected_option = $childs[0]->name;
    } else {
    $selected_option = null;
    }
    
    if (!empty($_POST['select_custom_post_type_option'])) {
    $selected_option = $_POST['select_custom_post_type_option'];
    }
    ?>
    <div style=โ€display: none; margin-left: 15px;โ€ class=โ€options-boxโ€ id=โ€select_custom_post_typeโ€>
    <h4><?php _e('Please, select custom post type', 'bxcft'); ?></h4>
    <p>
    <?php _e('Custom Post Type:', 'bxcft'); ?>
    <select name=โ€select_custom_post_type_optionโ€ id=โ€select_custom_post_type_optionโ€>
    <?php
    $args = array(
    'public' => true,
    '_builtin' => false
    );
    $custom_post_types = get_post_types($args);
    foreach ($custom_post_types as $post_type) :
    ?>
    <option value=โ€<?php echo $post_type; ?>โ€ <?php if ($selected_option == $post_type): ?>selected=โ€selectedโ€<?php endif; ?>>
    <?php echo $post_type; ?>
    </option>
    <?php endforeach; ?>
    </select>
    </p>
    </div>
    <?php
    if (isset($childs) && count($childs) > 0 && is_object($childs[0]) && $field->type == 'multiselect_custom_post_type') {
    $selected_option = $childs[0]->name;
    } else {
    $selected_option = null;
    }
    
    if (!empty($_POST['multiselect_custom_post_type_option'])) {
    $selected_option = $_POST['multiselect_custom_post_type_option'];
    }
    ?>
    <div style=โ€display: none; margin-left: 15px;โ€ class=โ€options-boxโ€ id=โ€multiselect_custom_post_typeโ€>
    <h4><?php _e('Please, select custom post type', 'bxcft'); ?></h4>
    <p>
    <?php _e('Custom Post Type:', 'bxcft'); ?>
    <select name=โ€multiselect_custom_post_type_optionโ€ id=โ€multiselect_custom_post_type_optionโ€>
    <?php
    foreach ($custom_post_types as $post_type) :
    ?>
    <option value=โ€<?php echo $post_type; ?>โ€ <?php if ($selected_option == $post_type): ?>selected=โ€selectedโ€<?php endif; ?>>
    <?php echo $post_type; ?>
    </option>
    <?php endforeach; ?>
    </select>
    </p>
    </div>
    <?php
    if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0]) && $field->type == 'birthdate') {
    $selected_option = $childs[0]->name;
    } else {
    $selected_option = null;
    }
    
    if (!empty($_POST['birthdate_option'])) {
    $selected_option = $_POST['birthdate_option'];
    }
    ?>
    <div style=โ€display: none; margin-left: 15px;โ€ class=โ€options-boxโ€ id=โ€birthdateโ€>
    <h4><?php _e('Show age (hide birthdate)', 'bxcft'); ?></h4>
    <p>
    <?php _e('Check this if you want to show age instead of birthdate:', 'bxcft'); ?>
    <input type=โ€checkboxโ€ name=โ€birthdate_optionโ€ value=โ€show_ageโ€ id=โ€birthdate_optionโ€
    <?php if ($selected_option == 'show_age') : ?>checked=โ€checkedโ€<?php endif; ?>/>
    </p>
    </div>
    <?php if (!is_null($field->type)) : ?>
    <script type=โ€text/javascriptโ€>
    jQuery(document).ready(function() {
    bxcft.select('<?php echo $field->type; ?>');
    });
    </script>
    <?php
    endif;
    }
    add_action('xprofile_field_additional_options', 'bxcft_selected_field');
    
    /**
    * This filter add a new level of visibility. Hide this field for everyone. Nobody can see.
    * @param type $visibility_levels
    * @return type
    */
    function bxcft_xprofile_get_visibility_levels($visibility_levels) {
    $visibility_levels['nobody'] = array('id' => 'nobody', 'label' => __('Nobody', 'bxcft'));
    return $visibility_levels;
    }
    add_filter('bp_xprofile_get_visibility_levels', 'bxcft_xprofile_get_visibility_levels', 1);
    
    /**
    * This filter is necessary to hide fields when 'nobody' new visibility is selected.
    * @param type $hidden_fields
    * @param type $displayed_user_id
    * @param type $current_user_id
    * @return type
    */
    function bxcft_xprofile_get_hidden_fields_for_user($hidden_fields, $displayed_user_id=0, $current_user_id=0) {
    if ( !$displayed_user_id ) {
    $displayed_user_id = bp_displayed_user_id();
    }
    
    if ( !$displayed_user_id ) {
    return array();
    }
    
    if ( !$current_user_id ) {
    $current_user_id = bp_loggedin_user_id();
    }
    
    // @todo โ€“ This is where you'd swap out for current_user_can() checks
    $new_hidden_fields = array();
    
    if ( $current_user_id ) {
    // Current user is logged in
    if ( $displayed_user_id == $current_user_id ) {
    // If you're viewing your own profile, nothing's private
    
    } elseif ( bp_is_active( 'friends' ) && friends_check_friendship( $displayed_user_id, $current_user_id ) ) {
    // If the current user and displayed user are friends, so exclude nobody
    $hidden_levels[] = 'nobody';
    $new_hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
    
    } else {
    // current user is logged-in but not friends, so exclude friends-only
    $hidden_levels[] = 'nobody';
    
    $new_hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
    }
    
    } else {
    // Current user is not logged in, so exclude friends-only and loggedin
    $hidden_levels[] = 'nobody';
    
    $new_hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
    }
    
    if (is_array($new_hidden_fields))
    $hidden_fields = array_merge($hidden_fields, $new_hidden_fields);
    
    return $hidden_fields;
    }
    add_filter('bp_xprofile_get_hidden_fields_for_user', 'bxcft_xprofile_get_hidden_fields_for_user', 10, 3);
    
    /**
    * Update profile
    */
    function bxcft_updated_profile($bp_user_id, $posted_field_ids, $errors) {
    
    global $bp;
    
    // There are errors
    if ( empty( $errors ) ) {
    
    // Reset the errors var
    $errors = false;
    
    // Now we've checked for required fields, lets save the values.
    foreach ( (array) $posted_field_ids as $field_id ) {
    
    // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
    if ( empty( $_POST['field_' . $field_id] ) )
    $value = array();
    else
    $value = $_POST['field_' . $field_id];
    
    // Handles delete checkbox.
    $uploads = wp_upload_dir();
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image' && isset($_POST['field_'.$field_id.'_deleteimg']) && $_POST['field_'.$field_id.'_deleteimg']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg']);
    }
    $value = array();
    }
    if ($field->type == 'file' && isset($_POST['field_'.$field_id.'_deletefile']) && $_POST['field_'.$field_id.'_deletefile']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile']);
    }
    $value = array();
    }
    
    // Handles image field type saving.
    if (isset($_FILES['field_'.$field_id]) && $_FILES['field_'.$field_id]['size'] > 0) {
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image') {
    $ext_allowed = array('jpg','jpeg','gif','png');
    apply_filters('images_ext_allowed', $ext_allowed);
    } elseif ($field->type == 'file') {
    $ext_allowed = array('doc','docx','pdf');
    apply_filters('files_ext_allowed', $ext_allowed);
    }
    
    $ext = strtolower(substr($_FILES['field_'.$field_id]['name'], strrpos($_FILES['field_'.$field_id]['name'],'.')+1));
    if (!in_array($ext, $ext_allowed)) {
    $errors = true;
    } else {
    require_once( ABSPATH . '/wp-admin/includes/file.php' );
    add_filter( 'upload_dir', 'bxcft_profile_upload_dir', 10, 1 );
    $_POST['action'] = 'wp_handle_upload';
    $uploaded_file = wp_handle_upload( $_FILES['field_'.$field_id] );
    $uploads = wp_upload_dir();
    $value = str_replace($uploads['baseurl'], โ€, $uploaded_file['url']);
    }
    } else {
    if ($field->type == 'image' && (!isset($_POST['field_'.$field_id.'_deleteimg']) || !$_POST['field_'.$field_id.'_deleteimg']) && isset($_POST['field_'.$field_id.'_hiddenimg']) && $_POST['field_'.$field_id.'_hiddenimg'] != โ€) {
    $value = $_POST['field_'.$field_id.'_hiddenimg'];
    }
    elseif ($field->type == 'file' && (!isset($_POST['field_'.$field_id.'_deletefile']) || !$_POST['field_'.$field_id.'_deletefile']) && isset($_POST['field_'.$field_id.'_hiddenfile']) && $_POST['field_'.$field_id.'_hiddenfile'] != โ€) {
    $value = $_POST['field_'.$field_id.'_hiddenfile'];
    }
    }
    if ( !xprofile_set_field_data( $field_id, $bp_user_id, $value ) ) {
    $errors = true;
    } else {
    do_action( 'xprofile_profile_field_data_updated', $field_id, $value );
    }
    }
    }
    }
    add_action('xprofile_updated_profile', 'bxcft_updated_profile', 10, 3);
    
    function bxcft_signup_user($user_id, $user_login, $user_password, $user_email, $usermeta)
    {
    // Set any profile data
    if ( bp_is_active( 'xprofile' ) ) {
    if ( !empty( $usermeta['profile_field_ids'] ) ) {
    $profile_field_ids = explode( ',', $usermeta['profile_field_ids'] );
    
    foreach( (array) $profile_field_ids as $field_id ) {
    
    if (!empty($usermeta["field_{$field_id}"]))
    $value = $usermeta["field_{$field_id}"];
    else
    $value = array();
    
    // Handles delete checkbox.
    $uploads = wp_upload_dir();
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image' && isset($_POST['field_'.$field_id.'_deleteimg']) && $_POST['field_'.$field_id.'_deleteimg']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenimg']);
    }
    $value = array();
    }
    if ($field->type == 'file' && isset($_POST['field_'.$field_id.'_deletefile']) && $_POST['field_'.$field_id.'_deletefile']) {
    if (file_exists($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile'])) {
    unlink($uploads['basedir'] . $_POST['field_'.$field_id.'_hiddenfile']);
    }
    $value = array();
    }
    
    // Handles image field type saving.
    if (isset($_FILES['field_'.$field_id]) && $_FILES['field_'.$field_id]['size'] > 0) {
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == 'image') {
    $ext_allowed = array('jpg','jpeg','gif','png');
    apply_filters('images_ext_allowed', $ext_allowed);
    } elseif ($field->type == 'file') {
    $ext_allowed = array('doc','docx','pdf');
    apply_filters('files_ext_allowed', $ext_allowed);
    }
    
    $ext = strtolower(substr($_FILES['field_'.$field_id]['name'], strrpos($_FILES['field_'.$field_id]['name'],'.')+1));
    if (in_array($ext, $ext_allowed)) {
    require_once( ABSPATH . '/wp-admin/includes/file.php' );
    add_filter( 'upload_dir', 'bxcft_profile_upload_dir', 10, 1 );
    $_POST['action'] = 'wp_handle_upload';
    $uploaded_file = wp_handle_upload( $_FILES['field_'.$field_id] );
    $destino = str_replace('0โ€ฒ, $user_id, $uploaded_file['file']);
    $aux = explode(โ€œ/โ€, $destino);
    if (!file_exists(str_replace('/'.$aux[count($aux)-1], โ€, $destino))) {
    mkdir(str_replace('/'.$aux[count($aux)-1], โ€, $destino));
    }
    copy($uploaded_file['file'], $destino);
    unlink($uploaded_file['file']);
    $value = str_replace($uploads['baseurl'], โ€, str_replace('0โ€ฒ, $user_id, $uploaded_file['url']));
    }
    } else {
    if ($field->type == 'image' && (!isset($_POST['field_'.$field_id.'_deleteimg']) || !$_POST['field_'.$field_id.'_deleteimg']) && isset($_POST['field_'.$field_id.'_hiddenimg']) && $_POST['field_'.$field_id.'_hiddenimg'] != โ€) {
    $value = $_POST['field_'.$field_id.'_hiddenimg'];
    }
    elseif ($field->type == 'file' && (!isset($_POST['field_'.$field_id.'_deletefile']) || !$_POST['field_'.$field_id.'_deletefile']) && isset($_POST['field_'.$field_id.'_hiddenfile']) && $_POST['field_'.$field_id.'_hiddenfile'] != โ€) {
    $value = $_POST['field_'.$field_id.'_hiddenfile'];
    }
    }
    
    xprofile_set_field_data( $field_id, $user_id, $value );
    }
    }
    }
    }
    add_action('bp_core_signup_user', 'bxcft_signup_user', 10, 5);
    
    function bxcft_profile_upload_dir( $upload_dir, $user_id=0 ) {
    if ($user_id == 0)
    $user_id = bp_displayed_user_id();
    $profile_subdir = '/profiles/' . $user_id;
    
    $upload_dir['path'] = $upload_dir['basedir'] . $profile_subdir;
    $upload_dir['url'] = $upload_dir['baseurl'] . $profile_subdir;
    $upload_dir['subdir'] = $profile_subdir;
    
    return $upload_dir;
    }
    
    /**
    * Replacing the buddypress filter link profile is it has the filter.
    * If user deactivated the filter, we don't add another filter.
    */
    function bxcft_remove_xprofile_links() {
    if (has_filter('bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data')) {
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    add_filter( 'bp_get_the_profile_field_value', 'bxcft_xprofile_filter_link_profile_data', 9, 2);
    }
    }
    add_action( 'bp_setup_globals', 'bxcft_remove_xprofile_links', 9999 );
    
    /**
    * This function only works if plugin bp-profile search is active.
    * @global type $bps_options
    * @param type $type
    * @return string
    */
    function bxcft_profile_field_type($type) {
    if (function_exists('is_plugin_active') && is_plugin_active('bp-profile-search/bps-main.php')
    || in_array( 'bp-profile-search/bps-main.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) )) {
    global $bps_options;
    $id = bp_get_the_profile_field_id ();
    
    if ( ((is_admin() && strpos($_SERVER['REQUEST_URI'], 'page=bp-profile-search'))
    || (isset($bps_options) && $bps_options['agerange'] == $id
    && isset($_POST['bp_profile_search']) && $_POST['bp_profile_search']))
    && $type == 'birthdate') {
    return 'datebox';
    }
    }
    
    return $type;
    }
    add_filter('bp_the_profile_field_type', 'bxcft_profile_field_type', 1);
    
    add_action('init', 'my_xprofile_links');
    function my_xprofile_links() {
    if (has_filter('bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data')) {
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9 );
    }
    if (has_filter('bp_get_the_profile_field_value', 'bxcft_xprofile_filter_link_profile_data')) {
    remove_filter( 'bp_get_the_profile_field_value', 'bxcft_xprofile_filter_link_profile_data', 9);
    }
    add_filter( 'bp_get_the_profile_field_value', 'my_xprofile_filter_link_profile_data', 10, 2);
    }
    
    function my_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
    if ( 'datebox' == $field_type )
    return $field_value;
    
    if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
    return $field_value;
    
    $values = explode( ',', $field_value );
    
    if ( !empty( $values ) ) {
    foreach ( (array) $values as $value ) {
    $value = trim( $value );
    $new_values[] = make_clickable( $value );
    }
    $values = implode( ', ', $new_values );
    }
    return $values;
    }
    
    #176487
    meg@info
    Participant

    Hi @rianhall,

    add this code to functions.php :

    https://gist.github.com/dzmounir/8285459

    No need to edit any template files. Just change
    $excluded_roles = array( 'administrator', 'subscriber' );

    by puting the role ids to hide.

    #176060
    Manu-PB
    Participant

    @megainfo
    Thanks for answer.
    Is there any possibility then to hide a field to members ?
    And I wonder why the DB field value is called “adminsonly”and not as expected “memberonly” or “onlyme” ???

    #175908
    lustek
    Participant

    logged out users in normal resolutions sees login link, registration link and search form.

    in mobile resolutions (less than 800px as far as i remember) they disappear and the admin bar is just blank.

    a logged in user sees the mobile version of admin bar in front end with all links, so it’s not the issue with my theme.

    is it a bug or a feature to hide login, registration and search in mobile admin bar?

    i’m using WP 3.8 and BP 1.9

    #175475
    craftersuniversity
    Participant

    With the new update of wordpress, i found out that this has nothing to do with BuddyPress or any theme, it is a bug in wordpress itself. The have tried to fix it, but its still not working well, the menu fills the screen and cannot be scrolled or hidden. I recommend hiding all buddypress menus until the bug gets fixed:

    /* =Hide BuddyPress sub menu until it works in mobile phones
    ————————————————————– */
    #wpadminbar .quicklinks .menupop ul.ab-sub-secondary {
    display: none !important;
    }

    #175066
    JeremyPark123999
    Participant

    Hi, I am not entirely sure if this should be posted on the wordpress forums or here. I think that since this PHP script is using data in the buddypress registration page, that here is the place.

    Anyway, I am trying to set up a website for my Minecraft Server that I have been hosting for the past few months. I am using the code below to only allow players with a premium Minecraft account to register on the website, in order to block spammers. The link in the code (http://www.minecraft.net/haspaid.jsp?user=) will print a boolean changing if the account name is valid or not. The name is put after the “=” and if it is valid, “true” will be printed, and if it isn’t valid “false” will be printed.

    I am trying to make it that the name is checked before the account is made. What should happen is that the username is taken and checked on the Minecraft database, and allow the user to register if “true” is echoed, and if “false” is echoed, the registration will not be allowed to continue.

    The issue is, that I am really not skilled in PHP at all, and I can’t find out why this code isn’t working. It makes no visible change to anything, and registration continues as if it wasn’t there. If anyone could give me a hand here, that would be great. Here is my Code.

    <?php
    /*
       Plugin Name: Minecraft Username Validator
       Description: Minecraft username Validation
       Version: 0.1
       Author: JeremyPark123999
    */
    
    /* Register actions */
    add_action('registration_errors', 'verify_mc_account', 10, 3);
    add_action('admin_menu', 'add_mcval_options');
    
    /* Check account on minecraft.net */
    function verify_mc_account( $errors, $login, $email ) {
    	//$user_info = get_userdata(1);
    	$user_info = get_user_by('login', $login );
    	$options = array(
            'timeout' => 5,
        );
        $mcacct = wp_remote_get('http://www.minecraft.net/haspaid.jsp?user='.$user_info->user_login);
    
        if ( $mcacct == 'false' ) {
            if ( $mcacct == 'false' ) {
                $errors->add('mc_error',__('<strong>ERROR:</strong> Minecraft account is invalid.'));
            } else {
                $errors->add('mc_error',__('<strong>ERROR:</strong> Unable to contact minecraft.net.'));
            }
        }
        return $errors;
    }
    /* Activation/Deactivation */
    function set_mcval_options() {
        add_option('hide_me', 'false');
    }
    
    function unset_mcval_options() {
        delete_option('hide_me');
    }
    
    register_activation_hook(__FILE__, 'set_mcval_options');
    register_deactivation_hook(__FILE__, 'unset_mcval_options');
    
    /* Add admin menu */
    function add_mcval_options() {
        if ( get_option('hide_me') != "true" ) {
            add_options_page('Minecraft Validator Options', 'Minecraft Validator', 8, 'mcval-options', 'mcval_options');
        }
    }
    
    /* Display options page */
    function mcval_options() {
        ?>
    <?php }
    

    My website is at tumbleweed-mc.net

    #174793
    Shmoo
    Participant

    I’ve manually re-created the bp_get_options_nav because it’s a too dynamic and clunky piece of code.

    Now I’ve made a simple HTML nav-list of each group component and added some PHP code between to print the ‘bp_group_permalink’ / [component-name] / but I only need to find a way to check IF a user can moderator this current group or is admin, if thats TRUE –> print the HTML list of the [admin component ] IF FALSE do nothing and hide this HTML list.

    I would like to have the same conditional statement for the [ send-ivites ] component that checks if a user can invite friends because he’s logged-in + member of this group.

    
    		<nav class="item-list-tabs no-ajax nav-centered">
    			<ul class="button-group radius">
    				<li><a class="button" href=""><i class="fi fi-root-groups"></i></a></li>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>"><i class="fi fi-home"></i></a></li>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>members/">Members</a></li>
    				<li class="group-btn-select item-list-tabs no-ajax">
    					<ul>
    					/*** select filter stuff here ***/ 
    					</ul>
    				</li>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>send-invites/"><i class="fi fi-megaphone"></i></a></li>
    				<?php do_action( 'bp_group_options_nav' ); ?>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>admin/edit-details/"><i class="fi fi-wrench"></i></a></li>
    				<li><a class="button" href="<?php bp_group_activity_feed_link(); ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><i class="fi fi-rss"></i></a></li>
    			</ul>
    		</nav>
    

    group nav

    How can I make those conditionals on list number 5 and 6.

    Thanks.

    #174755
    @mercime
    Participant

    @rastarr
    – There’s a free plugin but has not been updated in over 2 years https://wordpress.org/plugins/bp-ninja/
    – There’s premium and maintained plugin http://buddydev.com/plugins/bp-stealth-mode-for-site-admin/

    Martin
    Participant

    Hi there,

    I was wondering whether there is a code snippet to stop certain Admins from showing as being Online – tends to clutter up the sidebar widget. Showing in the activity is fine however.

    Any help would be terrific
    Martin

    #174727
    pjbursnall
    Participant

    Ok I’ll have a look and test each option. My preference is to hide both the admin bar and dashboard (as I would think most people would want to), but I will look at those plugins.

    Going forwards I would suggest a lot of people would be happier with BP if normal users could run through all functions with ever seeing the admin bar or dashboard.

    Thanks,
    Paul.

    #174717
    modemlooper
    Moderator

    check the WP plugin repo there are some plugins to make the admin bar work better on mobile

Viewing 25 results - 401 through 425 (of 915 total)
Skip to toolbar