Change the order of the date of the profile buddypress2.0.1
-
How are we going to change the order of the date of the profile of the buddypress?
-
If you’re talking about the extended xprofile datebox field, the builder class
BP_XProfile_Field_Type_Datebox
of the xprofile datebox field is in bp-xprofiles-class.php:1459(bp 2.0.1)You can overwite this class with your own for reflecting your needs. The technique (add your own class to…) to use is explained on the Codex
If you’re meaning another date, you have to be more precise !
You’ll find also a global date setting in your wordpress admin.
Hi danbp
It Seems to me the answer to my question
But, the problem is not resolved.
I am very troubled!plugins/buddypress/bp-xprofile/bp-xprofiles-class.php(bp-xprofile-classes.php):1459
/** * Constructor for the datebox field type * * @since BuddyPress (2.0.0) */ public function __construct() { parent::__construct(); $this->category = _x( 'Single Fields', 'xprofile field type category', 'buddypress' ); $this->name = _x( 'Date Selector', 'xprofile field type', 'buddypress' ); $this->set_format( '/^\d{4}-\d{1,2}-\d{1,2} 00:00:00$/', 'replace' ); // "Y-m-d 00:00:00" do_action( 'bp_xprofile_field_type_datebox', $this ); } /** * Output the edit field HTML for this field type. * * Must be used inside the {@link bp_profile_fields()} template loop. * * @param array $raw_properties Optional key/value array of {@link http://dev.w3.org/html5/markup/input.html permitted attributes} that you want to add. * @since BuddyPress (2.0.0) */ public function edit_field_html( array $raw_properties = array() ) { $user_id = bp_displayed_user_id(); // user_id is a special optional parameter that we pass to {@link bp_the_profile_field_options()}. if ( isset( $raw_properties['user_id'] ) ) { $user_id = (int) $raw_properties['user_id']; unset( $raw_properties['user_id'] ); } $year_html = $this->get_edit_field_html_elements( array_merge( array( 'id' => bp_get_the_profile_field_input_name() . '_year', 'name' => bp_get_the_profile_field_input_name() . '_year', ), $raw_properties ) ); $month_html = $this->get_edit_field_html_elements( array_merge( array( 'id' => bp_get_the_profile_field_input_name() . '_month', 'name' => bp_get_the_profile_field_input_name() . '_month', ), $raw_properties ) );
Please tell me Where Do I change specifically.
$this->set_format( ‘/^\d{4}-\d{1,2}-\d{1,2} 00:00:00$/’, ‘replace’ ); // “Y-m-d 00:00:00”
or for a general usage
The date format is setable in wordpress admin for the whole site, including BP.
Dashboard > General (/wp-admin/options-general.php)But you prefer perhaps to explain more precisely what YOU want to achieve instead of answering my stupid questions ? 😉
So, again:
Which date do you mean on profile ? There is no date on a profile ! Only a field type called date(box) in the xprofile admin, which let’s you add a birthdate or something like this on profiles.standard display of birthdate has become a DD-MM-YY.
This is because you set it like this in wordpress !Add this snippet to your child theme functions.php or into bp-custom.php
(tested with 2.0.1 and Twenty Thirteen)// modify the date (format) output on xprofile function nanopass_date_format_on_profile ($time) { global $bp; if ( bp_is_active( 'xprofile' ) || bp_is_profile_component() || bp_is_member() ) { $time = current_time ('Y-m-d'); // date format - See https://codex.wordpress.org/Formatting_Date_and_Time } return $time; } add_action ( 'bp_format_time', 'nanopass_date_format_on_profile', 1 );
Give feedback if it works for you.
- The topic ‘Change the order of the date of the profile buddypress2.0.1’ is closed to new replies.