Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 951 through 975 (of 3,593 total)
  • Author
    Search Results
  • #240238
    CodeMonkeyBanana
    Participant

    @shanebp Thanks for the reply.

    […]in any relational table, if an item is assigned to a group ID and that group ID no longer exists in the table that holds group IDs, then that data will not be displayed, ie. orphaned.

    I deleted through the admin panel so I am not sure what was deleted, that was what I meant by asking if is was standard behaviour. Possibly what I should have said is; when a user deletes a group by using the ‘bp-profile-setup’ page to click on the ‘delete group’ button, is buddypresses default behaviour to just drop the group and leave the profile data in the table or does it also iteratively remove the profile fields?

    I can see the reason why you would want to leave the data in the table (and also reasons why you wouldn’t). I had a quick look at the code but I am not familiar enough with it yet to pinpoint the exact code block.

    If fields are not deleted then I guess any fields directly referenced would still be visiable on the site. That may be misleading to user as they may assume deleting a group would also remove fields. However you wouldn’t want a group to be deleted by accident and then a large amount of data be lost. I would guess a system of deleting the group and then updating each profile field to explicitly notify calling functions that their parent has been deleted would be appropriate in the circumstance.

    I have used a relational database before but I am unfamiliar with the logic employed by buddypress to interact with it.

    The behaviour I was was getting was weird. When I deleted a group and created it again no fields were showing. Then when I added a field, it had a value immediately after creating so something weird was going on so I thought I would ask to see if you knew if the profile data gets deleted when a user clicks delete group in admin panel.

    I am starting again now so will pay closer attention to all data as it goes into fresh tables but sometimes it is harder to see to absence of data compared to the addition of new data.

    Why? BP will always create a Base group.

    I am running a multisite where individual user blogs can create their own fields (https://codex.buddypress.org/themes/guides/segregated-x-profile-fields-for-multisite/).

    As the article says:

    This code will not create dummy content, so for every new site you will need to create a Profile Fields group and add profile fields to it manually.

    When I create new site there are no field groups made at all which I assumed is what it was talking about. Also I wanted to have a default set of groups but allow subsite to edit them. If they want to get default groups back they can just delete all their groups and default will be restored. I could add a separate button for that but I just figured I’d do it like this, no particular reason, I am still in early stages of project.

    I think there were other errors at play so starting from scratch with a little more understanding will hopefully enlighten me. I will be duplicating tables this time instead of using meta table.

    #240141
    shanebp
    Moderator

    This is a basic mysql table structure issue.

    The id field is set to auto increment.
    So it you really want the id to be 1, you need to flush the bp_xprofile_groups table.
    But that may orphan any data you have in bp_xprofile_fields or cause mismatches with data in the
    bp_xprofile_data table.

    Perhaps the id field should not be an argument in xprofile_insert_field_group.

    Does it really matter what the id is?

    #240140
    Henry Wright
    Moderator

    Yeah sounds like it could be your database preserving referential integrity. i.e. Can’t delete a profile group unless all fields belonging to that group have been deleted first.

    Check what’s going on by looking at your database. This may help:

    BuddyPress Database Diagram

    #240114

    In reply to: Per-group Identity?

    Tony G
    Participant

    Well, group meta allows meta data to be applied to groups. I’m thinking along the lines of data in the usermeta table which is only consumed by specific groups. This might be expressed as a name/value pair in the profile. So with reference to my original example, a GroupName profile value would include:
    school:Robert
    home:Bobby
    coolGame:Zarcon

    The BuddyPress Profile Shortcodes plugin allows for custom fields and related shortcodes to be used. This is much closer to my needs but still not quite there. I can’t create a profile field for every possible group. Ideally there would be a pulldown of groups to which the user belongs, where they can enter the name they wish the use for that group, and the group/name pairs would be displayed in a grid.

    Now I’m thinking one of the better user meta plugins could handle that. But I would also need to customize it so that there can only be one WP user with a specific value for a specific group. This is a unique key per group, as some reference to @Bobby can’t apply to more than one person, but the @Bobby in one group can be different from @Bobby in another group.

    On the client side, I would then need to modify bbPress to get the user name that’s specifically for the current group, rather than using wp_get_current_user()->display_name or whatever it has there. For example:
    get_user_meta($user_id,’groupName_’.$group_id,true)
    or better
    get_user_meta($user_id,’groupNames’,false)[$group_id]

    Actually I’d rather abstract all requests for a user name to a function which can then be replaced with custom code just once. I don’t suppose anyone has already done that, or it’s been proposed as a BP/BBP enhancement?

    I’m a noob with coding into WP, haven’t touched BP/bbP, and know little about the APIs, so please bear with me on the syntax and other specifics and focus on the concepts. Thanks.

    The more I try to flesh it out above the more it seems possible for me to do this myself. But it would be really helpful if someone has already done it. Or if someone with knowledge in this area can see a more direct line from an exiting plugin to the solution I’m describing.

    Thanks for your time!!

    #240029
    shaquana_folks
    Participant

    My apologies @danbp I had a plugin called “BuddyPress xProfile Custom Fields Type” set up, that’s where the button came from. I just deactivated the plugin. But even when I still try to fill out the registration form, there’s no error that shows up this time, however, it takes me right back to that same registration page and it still did not create that new user for me. It would still just show up on the screen like this:

    New registration screenshot

    Any suggestions why this is still happening? Also, is there a good plugin that anyone can recommend for me to use so that when users create their profiles, they’ll be able to upload a profile picture?

    #239985
    CodeMonkeyBanana
    Participant

    I’ve been staring at the code for a while and it’s starting to make sense.

    I’m not great with databases but looking at the function I gather it changes a few fields into primary keys that point to the data table so fields can be individual.

    It runs the table modification code on the dbdelta_create_queries hook.

    The wordpress codex seems to say that this action will happen anytime a database or a table is created.

    Am I right in saying that this only ever has to be run once? Can I just run it once on admin init then remove it and add the modify_bp_global_xprofiles_tablenames at runtime or have I misunderstood it?

    #239800
    shanebp
    Moderator

    Iโ€™m calling it from the buddypress-xprofile-custom-fields-type plugin, do you think could be some filter that intercept querystring and reset it ?

    I doubt it.
    Where in the plugin are you calling it?
    In a function?
    And what is that function hooked to?
    Is that hook being called on the page where you manually call the $_GET? Probably not.

    #239799
    city4run
    Participant

    Hello Shane,
    I called manually the URL in the browser with the ?var1=TEST to be sure that it’s called properly but nothing change.

    I’m calling it from the buddypress-xprofile-custom-fields-type plugin, do you think could be some filter that intercept querystring and reset it ?

    danbp
    Participant

    Please search before asking. Search: Remove Profile Links brings up:

    https://buddypress.org/support/topic/on-profile-base-answers-to-fields-works-as-links/

    tstrickland415
    Participant

    Ok now everything works as you mentioned, but there’s just one caveat. The xprofile gets updated fine, but it’s not updating the actual Members Type field in the Extended Profile section of the Users panel in the backend.

    To clarify, when we make the xprofile field it’s a completely separate field than the Members Type field that Buddypress introduced recently. So in the Users->Extended Profile section there’s two fields for Member Types, the one we created and the one Buddypress introduced. Your code is only affecting the one we created and not the real Buddypress Member Type field. Is there a way to have the BP Member Type field get updated with the corresponding member type from the xprofile field?

    danbp
    Participant

    Yes 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 tabs

    function 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.

    Member Types

    Members Loop

    May this help.

    #239507
    PersepolisTehran
    Participant

    I 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/ .

    danbp
    Participant

    @minglonaire,

    i’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:

    Customizing Labels, Messages, and URLs

    #238943
    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 : )

    #238908
    modemlooper
    Moderator

    Your question is vague. Please tell more. Are you referring to profile fields?

    danbp
    Participant

    The 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
    email

    on the right BP’s Name field in which you can enter first and last name.

    Registration

    #238867
    shanebp
    Moderator

    Try 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 );
    danbp
    Participant

    hi @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');

    tiquality
    Participant

    Thanks 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!

    danbp
    Participant

    Any 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 );	
    }
    fabwintle
    Participant

    Hi @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?

    #238603
    danbp
    Participant

    It’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.

    #238258

    In reply to: Activity link

    Supriya Gusain
    Participant

    Hi @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=Camping

    #238134
    danbp
    Participant

    hi @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'); 
    #237999

    In reply to: Bp register page

    shanebp
    Moderator

    It 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

    @jayd94

    So 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.

Viewing 25 results - 951 through 975 (of 3,593 total)
Skip to toolbar