donmik
Forum Replies Created
-
You welcome! 😉
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Custom Post Type MultiselectorYou’re absolutely right, I don’t know what I was thinking.
It’s solved now in version 1.4.9.2.
Sorry!
Hi,
You need to create a function to calculate your age you can use my plugin for example. Put this code in the functions.php in your theme:
function echo_age($birthdate) { echo floor((time() - strtotime($birthdate))/31556926); }Now instead of using this
<?php bp_member_profile_data( 'field=Age' );?>Use this:
`<?php echo_age(bp_get_member_profile_data(‘field=Age’)); ?>And it will work I think.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] imageYou’re right, I’m really sorry but I have to work on other things. I promise I will do it! xD
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Hide year of birthYou welcome!
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Hide year of birthIf you want to do this, you can create a new filter in your functions.php overriding the filter of this plugin.
Put this in your functions.php:
function my_bxcft_get_field_value( $value, $type, $id) { 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) && count($childs) > 0) { // Get the name of custom post type. if ($childs[0]->name == 'show_age') $show_age = true; } if ($show_age) { return '<p>'.floor((time() - strtotime($value))/31556926).'</p>'; } return '<p>'.date_i18n( 'F j' , strtotime($value) ).'</p>'; } return $value; } add_filter( 'bp_get_the_profile_field_value', 'my_bxcft_get_field_value', 15, 3);It will override the filter from the plugin and show only the day and month of birthdate. If you want to change the date format, you need to change this line:
return '<p>'.date_i18n( 'F j' , strtotime($value) ).'</p>';F => Name of month.
j => Day.Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Get posts by xprofile fieldSorry to answer so late, I’m kind of busy lately.
Mmm, I think I understand. For example, you can have custom post type of jobs in London and you want to show them when a user from London is logged in.
Well, for the custom posts types you can use tags or maybe Types plugin (Great plugin!). With this code, you can get any data from profile field of the current logged in user:
global $bp; $your_data = bp_get_profile_field_data('field=nameofprofilefield&user_id='.bp_loggedin_user_id());Next thing to do is to filter your custom posts types using this data.
Hi,
Well, this is not the best thing but the easies way to do this is to only allow people to select those dates. For example if I register today, I only can select a birthdate from 1995 to 2002.The other way a little more complicated but better is validating the birthdate. Adding a function to your functions.php in your theme can be enough. I think this post http://code.hyperspatial.com/620/buddypress-signup-form-hook/ can help you.
Hi,
This is not an issue from this plugin. It’s from buddypress. You can find the code responsible of this in global.js in your buddypress theme _inc/global.js. Line 810 to 832 you will see the code responsible of this.
If you want to change this, you need to code yourself in javascript when you click the close button change the value.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Custom Post Type MultiselectorYeah, I think you’re right. I’ve added this to version 1.4.9.1.
Thanks!
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Get posts by xprofile fieldI’ve been looking for an answer and I don’t know one easy…
For now, if I were in your situation, I would filter first the authors using something like BP Profile Search plugin http://wordpress.org/extend/plugins/bp-profile-search/. In this plugin, we can search members looking in xprofiles fields.
With this, we obtain the user_id of the authors and you can use it to make a query of posts written by these authors. Maybe there is another way but I couldn’t find it.
If you are already in tags <?php ?> you don’t need to write them again. If you are in middle of html code you need <?php and ?>.
This function is php, you need php tags to make it work.
Sorry I was saying with a br between.:
<?php bp_member_profile_data( 'field=Member-Status' ); ?> <br/> <?php bp_member_profile_data( 'field=Pro-Status' ); ?>This code bp_member_profile_data( ‘field=Member-Status’ ); returns the value of the field. If you want to show
“Pro”
“Anwalt”You need to write:
<?php bp_member_profile_data( ‘field=Member-Status’ ); ?>
<?php bp_member_profile_data( ‘field=Pro-Status’ ); ?>
Or
<p>
<?php bp_member_profile_data( ‘field=Member-Status’ ); ?>
</p>
<p>
<?php bp_member_profile_data( ‘field=Pro-Status’ ); ?>
</p>The code I give you will only work in members-loop, the file which shows the members directory. If you want to put this in other files, you need to find the file in the theme, for example for the widget.
Remember that this code will only work if you are in a loop like this:
<?php while ( bp_members() ) : bp_the_member(); ?>. If not, you need to send the user_id as an argument.Well, for this, I think you need to edit the templates of your theme. For example in your theme, search /members/members-loop.php file. This file is responsible of showing the members directory.
Here you can edit this file and show other fields if you want with this code:
<?php bp_member_profile_data(array('field' => 'Email')); ?>bp_member_profile_data is a buddypress function who allow you to access to the profile data of your users. You must send it an array with ‘field’ and the name of the field you want. In this example, I request the field I call “Email”.
In your case if you need to show the field you call “team”:
<?php bp_member_profile_data(array('field' => 'team')); ?>Or if you want “coach”:
<?php bp_member_profile_data(array('field' => 'coach')); ?>This code will work only if you are in a loop like this:
<?php while ( bp_members() ) : bp_the_member(); ?>If you want to show a field for a particular user, you need to send also the user_id :
<?php bp_member_profile_data(array('field' => 'coach', 'user_id' => 'xxx')); ?>xxx is the user_id.