Search Results for 'profile fields'
-
AuthorSearch Results
-
May 23, 2015 at 8:14 am #239561
danbp
ParticipantYes indeed, there is a way.
Step by step tutorial with example code which you add to bp-custom.
Note: use this code as is and follow the instruction. Once you understood what it does and how it works, you will be able to modify it to your needs.First, create a new xprofile field in the first group field (aka Base Group and containing Name as default field). Only fields created in that group are visible on the register page. Call it Type, enter description and choose multiselectbox as field type. Add operator, vendor, coach as select option.
That’s all for the register part handled by BuddyPress.
Now we need to declare the whole thing to get it work on front-end.
Member-type is an additionnal functiony to select members by… type ! Not by role, not by latest, mst popular or anything else. Just (for the moment) by a custom type of your choice.We have to built a member directory for our types. We have 3 types and they will be shown on 3 new tabs on that directory.
1) we formally declare the member types
2) we count members by type (to stay correctly informative on the directory)
3) we display the tabsfunction using_mt_register_member_types() { bp_register_member_type( 'operator', array( 'labels' => array( 'name' => __( 'Operators', 'using-mt' ), 'singular_name' => __( 'Operator', 'using-mt' ), ), ) ); bp_register_member_type( 'vendor', array( 'labels' => array( 'name' => __( 'Vendors', 'using-mt' ), 'singular_name' => __( 'Vendor', 'using-mt' ), ), ) ); bp_register_member_type( 'coach', array( 'labels' => array( 'name' => __( 'Coaches', 'using-mt' ), 'singular_name' => __( 'Coach', 'using-mt' ), ), ) ); } add_action( 'bp_init', 'using_mt_register_member_types' ); function using_mt_count_member_types( $member_type = '', $taxonomy = 'bp_member_type' ) { global $wpdb; $member_types = bp_get_member_types(); if ( empty( $member_type ) || empty( $member_types[ $member_type ] ) ) { return false; } $count_types = wp_cache_get( 'using_mt_count_member_types', 'using_mt_bp_member_type' ); if ( ! $count_types ) { if ( ! bp_is_root_blog() ) { switch_to_blog( bp_get_root_blog_id() ); } $sql = array( 'select' => "SELECT t.slug, tt.count FROM {$wpdb->term_taxonomy} tt LEFT JOIN {$wpdb->terms} t", 'on' => 'ON tt.term_id = t.term_id', 'where' => $wpdb->prepare( 'WHERE tt.taxonomy = %s', $taxonomy ), ); $count_types = $wpdb->get_results( join( ' ', $sql ) ); wp_cache_set( 'using_mt_count_member_types', $count_types, 'using_mt_bp_member_type' ); restore_current_blog(); } $type_count = wp_filter_object_list( $count_types, array( 'slug' => $member_type ), 'and', 'count' ); $type_count = array_values( $type_count ); if ( empty( $type_count ) ) { return 0; } return (int) $type_count[0]; } function using_mt_display_directory_tabs() { $member_types = bp_get_member_types( array(), 'objects' ); // Loop in member types to build the tabs foreach ( $member_types as $member_type ) : ?> <li id="members-<?php echo esc_attr( $member_type->name ) ;?>"> <a href="<?php bp_members_directory_permalink(); ?>"><?php printf( '%s <span>%d</span>', $member_type->labels['name'], using_mt_count_member_types( $member_type->name ) ); ?></a> </li> <?php endforeach; } add_action( 'bp_members_directory_member_types', 'using_mt_display_directory_tabs' );We also need to sort the members list on each type tab using the loop scope.
function using_mt_set_has_members_type_arg( $args = array() ) { // Get member types to check scope $member_types = bp_get_member_types(); // Set the member type arg if scope match one of the registered member type if ( ! empty( $args['scope'] ) && ! empty( $member_types[ $args['scope'] ] ) ) { $args['member_type'] = $args['scope']; } return $args; } add_filter( 'bp_before_has_members_parse_args', 'using_mt_set_has_members_type_arg', 10, 1 );And we finally clean the cache to stay up to date with the output
function using_mt_clean_count_cache( $term = 0, $taxonomy = null ) { if ( empty( $term ) || empty( $taxonomy->name ) || 'bp_member_type' != $taxonomy->name ) { return; } wp_cache_delete( 'using_mt_count_member_types', 'using_mt_bp_member_type' ); } add_action( 'edited_term_taxonomy', 'using_mt_clean_count_cache', 10, 2 );That’s all for a members directory page showing All Members and tabed Members by type.
If you want to show the type of a member on his profile header, use this:
function using_mt_member_header_display() { $member_type = bp_get_member_type( bp_displayed_user_id() ); if ( empty( $member_type ) ) { return; } $member_type_object = bp_get_member_type_object( $member_type ); ?> <p class="member_type"><?php echo esc_html( $member_type_object->labels['singular_name'] ); ?></p> <?php } add_action( 'bp_before_member_header_meta', 'using_mt_member_header_display' );Or if you want to display the type under each user avatar on the member directory, you can use this snippet. Note: was originally made to add a geoloc shortcode below the member type. I let it as is, so you can see how it’s done.
function who_are_you_directory() { // by member_type name + geoloc (wpgeo me) $user = bp_get_member_user_id(); $terms = bp_get_object_terms( $user, 'bp_member_type' ); if ( ! empty( $terms ) ) { if ( ! is_wp_error( $terms ) ) { foreach( $terms as $term ) { echo '<p>' . $term->name . '</p>'; echo do_shortcode('[gmw_member_info]'); } } } } add_filter ( 'bp_directory_members_item', 'who_are_you_directory' );Anything inspired by Codex and heavy topics reading.
May this help.
May 21, 2015 at 5:53 pm #239507In reply to: How to customize labels ?
PersepolisTehran
ParticipantI changed this note “Registering for this site is easy. Just fill in the fields below, and we’ll get a new account set up for you in no time” to my custom note, and i changed “Blog detail” to “Profile detail”. Then i made 2 file : 1) β buddypress-en_US.mo . 2) buddypress-en_US.po and i uploaded both to /wp-content/languages/plugins/ .
May 21, 2015 at 7:05 am #239472danbp
Participanti’m part of the one percenter who cares about well formed urls and a basic system which is working on 23% of www’s sites !
If you have enhancement ideas, feel free to post in the appropriate forum or open a ticket on Trac.
BP is only a WP plugin and doesn’t handle registration. On the other hand, WP use a very short registering form, containing 3 fields: username, email and password.
First and last name are optionnal fields on the standard WP user profile. These fields are not mandatory, never appear on the registration page and it’s in the freedom of everyone to use them or not. When BP is installed, he provides a mandatory Name field, which can be used to enter a username or a first/last name.
Even if i have no percentage to give you, i’m pretty sure that almost all users are satisfied to use a CMS which doesn’t ask them for real names at first ! And why not their address, blood group, gran’mother nickname or their mom’s phone number ?
This are privacy options, and WP is smart enough to not abuse of such things, by default. Smart enough also to use the simpliest existing register routine, like all other major web operators, a username, a valid email and an encrypted password.
Anything else is matter of flexibility, one of the major interrest to use BuddyPress. And definetly no, not all communities have members who knows each others. Don’t make you the spokeman of such behalf speculation. π
I think you’re confused by system requirements and your own desires. To get it clear for the register aspect, read here please.
Oh, and the answer to your question is here:
May 11, 2015 at 4:33 pm #238943In reply to: Hide Profile Field Group from Specific Member Type
thomasoriis
Participant@modemlooper – It could be nice if one could handle this from the xprofile fields in wp_admin as well – do you know how to do that ? I don’t think I have to request that feature I am sure it will come.
Could be nice : )
May 10, 2015 at 4:10 am #238908In reply to: Mobile display issue (0 selected) showing
modemlooper
ModeratorYour question is vague. Please tell more. Are you referring to profile fields?
May 9, 2015 at 6:33 pm #238883danbp
ParticipantThe unique field coming with BP xtended profile is called Name by default. This field name can be changed and you can add some specific description to it to fit your need.
On the register page you have on the left the 3 mandatory fields from WP
username
password
emailon the right BP’s Name field in which you can enter first and last name.
May 9, 2015 at 2:01 pm #238867In reply to: Automatic links in profile fields
shanebp
ModeratorTry this in your theme/functions.php or in bp-custom.php
function klosurdo_unlink_fields( $field_value ) { $no_link_fields = array( 'Photographer Bio' ); $bp_this_field_name = bp_get_the_profile_field_name(); if ( in_array( $bp_this_field_name, $no_link_fields ) ) $field_value = strip_tags( $field_value ); return $field_value; } add_filter( 'bp_get_the_profile_field_value', 'klosurdo_unlink_fields', 99, 1 );May 6, 2015 at 7:27 pm #238754danbp
Participanthi @tiquality,
to show the user’s mail above the other user information, you can add the following snippet to bp-custom.php or child-theme’s functions.php
Assuming users gave a valid email at registration, we can output that address.
Avantage is that they haven’t to enter their mail a second time while completing their profile.So we just need to manually add this address to the template, using one of the action hook avaible in profile-loop.php
function tiquality_add_custom_field() { if ( bp_is_active( 'xprofile' ) ) : if ( is_user_logged_in() ) { ?> <div class="bp-widget <?php bp_the_profile_group_slug(); ?>"> <table class="profile-fields"> <tr class="my_mail"> <td class="label">Contact me</td> <td class="data"><a href="mailto:<?php bp_displayed_user_email(); ?>"><?php bp_displayed_user_email(); ?></a></td> </tr> </table> </div> <?php } endif; } add_action('bp_profile_field_buttons', 'tiquality_add_custom_field');If you prefer it on the profile header, use the action hook indicated by Brajesh
add_action('bp_member_header_actions', 'tiquality_add_custom_field');May 6, 2015 at 11:17 am #238735tiquality
ParticipantThanks Brajesh, but I didnt find this files, bp-custom.php and member-header.php π
This is my link profile project: http://tiquality.com.br/intranet/members/admin/profile/
On the extend profile fields, it should show the mail of wordpress user.
tks!
May 2, 2015 at 11:40 pm #238635danbp
ParticipantAny other idea? Yes !
Use bbP Signature instead. This plugin has a filtrable function where you can easely add custom fields near signature.Activate the plugin. Create a field called signature and add this snippet to bp-custom.php
function my_bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) { // Default arguments $defaults = array( 'separator' => '<hr />', 'before' => '<div class="bbp-reply-signature">', 'after' => '</div>' ); $r = wp_parse_args( $args, $defaults ); extract( $r ); // Verify topic id, get author id, and potential signature $reply_id = bbp_get_reply_id ( $reply_id ); $user_id = bbp_get_reply_author_id( $reply_id ); if(function_exists('bp_has_groups')) { $signature = xprofile_get_field_data( 'Signature', $user_id ); // here we add our custom fields $wowi = '<br>'. xprofile_get_field_data( 'Industry', $user_id ); $wowt = '<br>'. xprofile_get_field_data( 'Type', $user_id ); } else { $signature = bbp_get_user_signature ( $user_id ); } // If signature exists, adjust the content accordingly if ( !empty( $signature ) ) $content = $content . $separator . $before . $signature . $wowi . $wowt . $after; return apply_filters( 'my_bbp_reply_content_append_signature', $content, $reply_id, $separator ); } if ( !is_admin() ) { remove_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 ); add_filter( 'bbp_get_reply_content', 'my_bbp_reply_content_append_user_signature', 1, 2 ); }May 2, 2015 at 8:57 am #238625fabwintle
ParticipantHi @danbp,
I Have this plugin indeed, however what I want to do is automatically populate my signature with existing fields. I don’t believe this plugin achieves that. All it does is adds a ‘signature’ field to the BP x profile field that my member would need to populate themselves.
Any other idea?
May 1, 2015 at 9:14 am #238603In reply to: On Profile-Base, answers to fields works as links
danbp
ParticipantIt’s built in automatic search feature.
To deactivate the whole profile links, add this snippet to bp-custom.php or your child-theme functions.php
function bpfr_remove_xprofile_links() { remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 ); } add_action('bp_setup_globals', 'bpfr_remove_xprofile_links');To remove selectively such profile links, see here.
April 23, 2015 at 10:58 am #238258In reply to: Activity link
Supriya Gusain
ParticipantHi @henrywright,
Like if we go to profile page, it has profile image and profile tabs. In profile tab fields like name, age, activities and in activities we have for example Skiing. When we click on Skiing it searches for the members having same activity Skiing.
But right now the search displays all members with Skiing and i want to show only the userβs with gender preference.
like for example this url http://sitename/members/?s=CampingApril 20, 2015 at 9:58 pm #238134In reply to: Links in Bio of Profile fields (Bug)
danbp
Participanthi @utahman1971,
this is the default behave of extended profile fields. Also it’s very handy, as those links became searcheable keywords. This let users click and find other entered same words.
That said, a bio is generally more personnal, so those links maybe less important…
Here’s a snippet (bp 2.0.1 +) you can add to bp-custom.php. It let’s you selectively disable those automated linking from some fields and let some other in place.
function my_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) { // Access the field you are going to display value. global $field; // In this array you write the ids of the fields you want to hide the link. $excluded_field_ids = array(2,6,7); // If the id of this $field is in the array, we return the value only and not the link. if (in_array($field->id, $excluded_field_ids)) return $field_value; 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 ); // 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[] = '<a href="' . $search_url . '" rel="nofollow">' . $value . '</a>'; } } } $values = implode( ', ', $new_values ); } return $values; } /** * We remove the buddypress filter and add our custom filter. */ function remove_xprofile_links() { // Remove the old filter. remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 ); // Add your custom filter. add_filter( 'bp_get_the_profile_field_value', 'my_xprofile_filter_link_profile_data', 9, 2); } add_action('bp_setup_globals', 'remove_xprofile_links');If you want to deactivate completely profile fied links, you can use this function:
function bpfr_remove_xprofile_links() { remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 ); } add_action('bp_setup_globals', 'bpfr_remove_xprofile_links');April 18, 2015 at 4:24 pm #237999In reply to: Bp register page
shanebp
ModeratorIt would be helpful to your question to get some terminology sorted.
Example:
- username aka login name: jayd94
- display name: Daniel
In BP, your profile would show:
Daniel
@jayd94So the name on the BP ‘side’ of register = display name
And the name on the WP ‘side’ of register = username aka login name
Both fields are required.Using that info, can you restate your question.
April 14, 2015 at 10:03 pm #237889In reply to: FYI: Plugins to Lock BuddyPress Profile Fields
bp-help
ParticipantApril 12, 2015 at 6:10 pm #237756In reply to: Create Custom Page of Registration
danbp
ParticipantYou said first:
I would like to create a page for user registration and another page for editing the profile with more options.This is a resume of how BP already works.
The registration page can be extended (BP xprofile component) and user can fill out these additionnal fields from within their profile page.Please take a look on Codex, before reinventing the wheel.
April 8, 2015 at 12:57 pm #237479In reply to: [Resolved] Only display custom field if not empty
mrgiblets
ParticipantA quick follow up question…
Can I echo the xprofile_get_field_data fields elsewhere in WordPress (outside of Buddypress) in the same way?
ie :
$location = xprofile_get_field_data( 'Location', $user_id ); echo $location;Obviously replacing user_id with the numeric user id.
April 8, 2015 at 12:33 pm #237478In reply to: [Resolved] Only display custom field if not empty
mrgiblets
ParticipantSuperb, thank you @danbp!
Not only answered my question but this also gives me the fundamentals to implement further ideas I have for my BP site like displaying profile fields based on user roles.
Cheers π
April 8, 2015 at 11:27 am #237469In reply to: Custom sort members
danbp
ParticipantThat is also explained, with filter example, on the member loop codex page !
See Filtering by Xprofile fields.
April 7, 2015 at 11:39 pm #237428danbp
ParticipantI told about BuddyDrive because you have a download button aside a description written in french. And that plugin author is french, like me. And i’m a user of this plugin….
You use a premium theme, and we can’t help you much here if you have an issue with it. As we have no free access to it’s code.
As site admin, you can configure the registration form and add some description if you need some near a field.
Go to dashboard > users > profile fieldsIf you need some more details about BuddyPress feel free to read the Codex. And don’t hesitate to ask your theme support.
Have a nice day too.
April 6, 2015 at 5:16 pm #237341In reply to: mentions suggestion js problem
aymanomar85
Participant1- WordPress 4.1
2- install directory
3- subdirectory
4- wordpress upgrade 4.1.1
6-BuddyPress 2.2.1
7- last version
8- yes i have many plugins8.1-Advanced Custom Fields
8.2-bbPress
8.3-BP Login Redirect
8.4-BP Profile Search
8.5-BP Profile Widgets
8.6-BuddyPress
8.7-BuddyPress cover
8.8-BuddyPress Edit Activity
8.9-BuddyPress Follow
8.10-BuddyPress Security Check
8.11-Buddypress Social
8.12-BuddyPress Xprofile Custom Fields Type
8.13-Email newsletter
8.14-Facebook Friends Inviter
8.15-HashBuddy
8.16-rtMedia for WordPress, BuddyPress and bbPress
8.17-Social Login
8.18-User Name Availability Checker for wordpress/buddypress
8.19-Wordpress Social Invitations – LiteApril 3, 2015 at 1:33 pm #237244danbp
Participanthi @mcpeanut,
this snippet useable from BP 2.0.1 and above, can be added to bp-custom.php
it will hide the field ID 1 which is the default Name field to all, except site admin.it will also avoid the user to edit that field. So if you use this, i recommand you tell them on register page that once they entered a name it they could change it later. You can than ask them $$$$ to do it. π
function bpfr_hide_profile_field_group( $retval ) { if ( bp_is_active( 'xprofile' ) ) : // hide profile group/field to all except admin if ( !is_super_admin() ) { //exlude fields, separated by comma $retval['exclude_fields'] = '1'; //exlude field groups, separated by comma $retval['exclude_groups'] = '1'; } return $retval; endif; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );More here:
April 2, 2015 at 4:07 pm #237187danbp
ParticipantNo.
Why ?
Because this is an error message. If you see it when you’re on profile fields admin, it is better for you to see this as nothing. As admin, it is you who set up field access. It is required ? Make it not required or fill in that field.
March 31, 2015 at 12:17 pm #237003In reply to: Particular Dating Site
Henry Wright
Moderator -
AuthorSearch Results