Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 2,401 through 2,425 (of 5,755 total)
  • Author
    Search Results
  • #175838
    Henry
    Member

    @macpresss

    Take a look at this page to see the parameters accepted:

    Profile Fields Loop

    Perhaps try using profile_group_id:

    By default all groups and all fields will be displayed. If you provide the ID of a profile field group, then only the fields in this group will be displayed

    So it would be:

    if ( bp_has_profile( 'profile_group_id=2' ) ) :

    Where 2 is the ID(s) of the group you’d like to include. I think it should take a comma separated list but I haven’t tested.

    #175819
    petdailypress
    Participant

    This plugin: Buddypress Xprofile Custom Fields Type, had a conflicting field that I couldn’t see in my original theme. So I switched over to Twenty Twelve and the extra field popped up. So, I just deleted the (invisible) conflicting field from the profile, which allowed the Registration process to move forward.

    #175807

    In reply to: Hide profile field

    somethingelse
    Participant

    this is great help… but how do we do this with the s2member fields when we have s2member set to integrate with buddypress profiles???

    #175805
    Henry
    Member

    You could try looking at https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/ to see how they do it. I think one of the profile field types is ‘number’ – so that might be the best place to start.

    petdailypress
    Participant

    Wordpress version 3.8, Buddypress 1.9, bbPress 2.5.1, Website: bekindtodogs.com

    I am testing out the register page and my testers are all telling me they can’t get past the register page. They enter their info, do the spam test, and then it just loops back to Registration without moving on to the next step.

    I am thinking there is something I need to do with my Activate page. I have a page called Activate, which is set in the Buddypress settings, but that page doesn’t have any bbPress Template like the Register page does. Isn’t there supposed to be a bbPress Activate Template?

    I deactivated the plugins “Are You A Human?” and “Buddypress Xprofile Custom Fields Type” but that didn’t seem to matter.

    Please help!

    #175772
    Shmoo
    Participant

    It’s my theme and I code WordPress themes for like 5 years now but I don’t see myself as a Developer it’s more a hobby 🙂

    I’m solid at HTML-CSS and can read PHP when I see it happen but I can’t write PHP it out of the box.

    This error shows up when I try to hide a complete xProfile-group-ID or just an unique xProfile-field-ID from the loop.

    This is what I did.
    Inside: my-theme/buddypress/members/single/profile/profile-loop.php
    I found the start of the loop

    
    <?php if ( bp_has_profile() ) : ?>
    ....
    

    My first thought was, maybe there are default options here to control the output of which ID’s will be visible so I started the search how the bp_has_profile() was build and looked into plugins/buddypress/bp-xprofile/bp-xprofile-template.php and found this at line 150:

    
    ....
    
    $defaults = array(
    	'user_id'             => bp_displayed_user_id(),
    	'profile_group_id'    => false,
    	'hide_empty_groups'   => true,
    	'hide_empty_fields'   => $hide_empty_fields_default,
    	'fetch_fields'        => true,
    	'fetch_field_data'    => true,
    	'fetch_visibility_level' => $fetch_visibility_level_default,
    	'exclude_groups'      => false, // Comma-separated list of profile field group IDs to exclude
    	'exclude_fields'      => false  // Comma-separated list of profile field IDs to exclude
    );
    

    This looks very familiar to bbPress so my first thoughts was lets try to add one of those Array’s to the loop and overwrite the default value.
    Just like this.

    
    <?php if ( bp_has_profile( array ( 'exclude_groups' => 1 ) ) ) : ?>
    ...
    

    This works perfect, it hides all xProfile-fields from the first Base primary Tab (back-end). Just like I wanted it because I didn’t want all the fields to show up front-end, I’ve got a few xProfile-fields that I use for user-customization of the profile-page. Each user can add color-codes to change the default menu-color and add background-images to their profile-page to make each profile a little more unique.
    Those field-ID’s are just urls or color-codes and don’t have to be visable to the public, thats why I try to hide them front-end.

    buddypress member pofile tab

    Shmoo
    Participant

    I’m getting a strange error while the code seem to be working fine.

    ” Missing argument 2 for wpdb::prepare() “

    I’ve got Debug mode turned on in the config.php file and when I switch this mode off the error is gone but and everything is just working fine but I would like to know how bad this is.

    The errors shows up when I was testing this.

    
    <?php if ( bp_has_profile( array ( 'exclude_fields' => 15, 'exclude_groups' => 2 ) ) ) : ?>
    
    modemlooper
    Moderator

    This code is just a start, I did not test to see if field groups will break it but you can get an example of spitting out fields as an object array variable on profile load and then using the variable to get the values instead of requesting each time.

    put this in bp-custom.php

    
    // creates global object array from profile fields
    function bp_profile_fields_array() {
    	global $fields;
    
    	$fields = array();
    
    	if ( bp_has_profile() ) :
    
    		while ( bp_profile_groups() ) : bp_the_profile_group();
    
    			if ( bp_profile_group_has_fields() ) :
    
    				while ( bp_profile_fields() ) : bp_the_profile_field();
    
    					if ( bp_field_has_data() ) :
    
    							$field_name = bp_get_the_profile_field_name();
    							$field_value = bp_get_the_profile_field_value();
    
    							$field = array(
    								'field_name' => $field_name,
    								'field_value' => $field_value,
    							);
    
    							$fields[] =	$field;
    
    					endif;
    
    				endwhile;
    
    			endif;
    
    		endwhile;
    
    	endif;
    
    	return $fields;
    
    }
    add_action( 'bp_before_member_header', 'bp_profile_fields_array' );
    
    // echoes value of field from object array based on param
    function bp_get_single_profile_field( $param ) {
    	global $fields;
    
    	foreach ( $fields as $key => $val ) {
    	   if ( $val['field_name'] === $param ) {
    		   echo $val['field_value'];
    	   }
    	}
    }

    Then in your member templates:

    <?php bp_get_single_profile_field('PROFILE FIELD NAME'); ?>

    Shmoo
    Participant

    In the profile-loop.php ( members/single/profile )

    Instead of this loop.

    
    <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
    	<?php if ( bp_field_has_data() ) : ?>
    	<tr<?php bp_field_css_class(); ?>>
    		<td class="label"><?php bp_the_profile_field_name(); ?></td>
    		<td class="data"><?php bp_the_profile_field_value(); ?></td>
    	</tr>
    	<?php endif; ?>
    <?php do_action( 'bp_profile_field_item' ); ?>
    <?php endwhile; ?>
    
    Shmoo
    Participant

    I know, but what if I duplicated the code above for all 20 profile fields ?

    – country
    – about
    – gender
    – age

    I would like to know how bad this would be for performance on the site, from my understanding it has something to do with Database Query’s ?

    Trying to make a Tab view of the profile info, on the first tab I would like to show all general stuff and on the second tab I would like to show work info + social media options.

    Henry
    Member

    Hi @macpresss

    What do you mean by ‘export all profile fields by a conditional tag’?

    Doing what you’ve done above is good practice because if Country is an optional field and it has not been completed by the member then nothing will be outputted:

    <?php if ( $data = bp_get_profile_field_data( 'field=Country ' ) ) : ?>
         <!-- do something -->
    <?php endif ?>

    If you’re doing something with a single profile field then there is no need to loop through them all. It’s basically wasted effort and slower performance.

    Shmoo
    Participant

    Is it bad coding to export all profile fields by a conditional tag instead of the default profile loop ?

    Something like this..

    
    <?php if ( $data = bp_get_profile_field_data( 'field=Country ' ) ) : ?>
    <div class="profile_fields">
             Country: <span><a href="..../?s=<?php echo $data ?>" title="<?php echo $data ?>">
    <?php echo $data ?></a></span>
    </div>
    <?php endif ?>
    

    This would give me ultimate control about the CSS and layout front-end of each field but how bad is it for performance of the site ?

    #175581
    CliffDillard
    Participant

    I have custom fields, e.g. graduation year. The fields show up properly and the user can use profile / edit to go back in and correct data. But as Admin, how can I edit existing records for these non-standard fields? If I go into “All Members” I only see the base WordPress fields and not the custom fields. Have I missed setting up something that would allow me to edit this data? Thank you.

    #175506
    craig
    Participant

    Hey Guys,

    Ok so I would have thought I’d have found something about this as it seems a pretty obvious addition to already awesome plugin.

    I’m looking to allow my member to search one another, but not only by username, but also by profile fields, location etc.

    I know there was once upon a time a plugin called member search, but I don’t know it’s status and I’m wondering if buddypress has yet implemented something inhouse?

    any guidance on this would be awesome.

    thanks guys

    #175416
    craigola
    Participant

    Hi all. Wanted to see if anyone had any ideas for these functions I need or if I need to code them in myself.

    1. I need to be able to add child item/person profiles of sorts. So, using a child as an example, I would first create a new child (not literally) and then there would be profile fields I could add for it.

    So there is me: Craigola
    Then under me and showing up on my profile page would be
    Child 1 – Age 89 Hobbies: Kittens, pickles, long parks in the walk.
    Child 2 – Age 2 Hobbies: Turtles, Baba Ganouch,

    I could add photos of said children as well.

    Any idears?

    Thanks!

    Craig

    danbp
    Participant

    hi @matt-mcfarland,

    i’m not a dev but consider this, to get a user ID:

    $user_id = bp_get_member_user_id();

    To answer the sql question, here’s a function that doesn’t exist in buddypress, which let you get the xprofile_group name by it’s ID For inspiration…

    function bpfr_get_xprofile_group_id_by_name( $name = '' ) {
    	global $wpdb;
    	
    	$bp = buddypress();
    	
    	if( empty( $name ) )
    		return false;
    		
    	return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_groups} WHERE name = %s", $name ) );
    }

    For the output, you have to create another function containing at least:

    
    	$user_id = bp_get_member_user_id();
    	$xprofile_group_id = bpfr_get_xprofile_group_id_by_name( 'the groupe name' );
    
    if( !class_exists( 'BP_XProfile_Group' ) )
    		return false;
    		
    	$args = array(
    		'profile_group_id'       => $xprofile_group_id,
    		'user_id'                => $user_id,
    		'fetch_fields'           => true,
    		'fetch_field_data'       => true
    	);

    May this help you !

    #175261
    Henry
    Member

    Hi @noizeburger, glad you finally got this working. I’m sure your tutorial will be helpful to many people too. I especially like the last snippet which shows you how to disable the editing of certain fields on the edit profile screen!

    noizeburger
    Participant

    This topic has been always important to my community project. Throughout the last 4 years I’ve tried several ways to reach a way working with different user profiles. If you search the forums you’ll see that others also did and still do.

    Maybe my approach/solution will fit some of the requests.
    First of all, I’ve to say THANK YOU to the following people/users:

    @henrywright-1 for some hints into the right direction
    donmik, publisher of the wonderful Buddypress Xprofile Custom Fields Type plugin
    and Brajesh Singh @sbrajesh for his usefull code snippets.

    So, what I needed and what was the solution?

    I’m working on a platform for musicians and music fans. To give both usertypes different capabilities in their profiles I decided to give them different user roles.
    To achive this, there are several wordpress plugins. Below you will find a list of the plugins I use.
    In earlier versions of Buddypress I’ve used the WP Roles at Registration plugin together with Buddypress xProfiles ACL plugin. So I had the possibility to make the user chose a role at registration and a way to define what buddypress profile groups are shown in the different profile types. Both plugins haven’t been updated in the last two years but both still work. xProfiles ACL needs to be hacked – see this support thread .

    So far so good. But there is no way to include the user role (in my case “band” and “fan”) in buddypress search. My first attempt was to include the user role via some code snippet in my member-loop, but that seemed a bit complicated to me. I wanted a conjunction between the user role and buddypress search. So there had to be a way to select the user role through a xprofile field, ’cause xprofile fields can be searched and also displayed in the member-loop in several ways.

    To stop confusing you, here’s what I’ve done:

    required plugins:

    1. Buddypress xProfiles ACL with the hack mentioned a few lines earlier.
    2. Capability Manager Enhanced to define custom user roles, if you’re not satisfied with the default wordpress roles (subscriber, contributor,…).

    The first step is to create your user roles, modify the ACL plugin and define some profile field groups that can be finally added to the different user roles/types.
    Create a xprofile field (selectbox) with the title “User Role” and name the options “Band Role” and “Fan Role” – in my case. You can call them whatever you want. Place this field in the “base” profile group, otherwise it won’t be shown during registration. Also make the field “required”. In my case the user can’t decide, if the visibility of the field can be changed.

    In a second step you need to create a bp-custom.php in the root of your wordpress plugin folder (if you haven’t done this yet, cause you have other custom functions).
    Put the following snippet in your bp-custom:

    <?php
    function custom_bp_core_signup_user($user_id) {
        $user_role = strtolower(xprofile_get_field_data('User Role', $user_id));
        switch($user_role) {
            case "Band Role":
                $new_role = 'band';
                break;
            case "Fan Role":
                $new_role = 'fan';
                break;
        }
        wp_update_user(array(
            'ID' => $user_id,
            'role' => $new_role
        ));
    }
    add_action( 'bp_core_signup_user', 'custom_bp_core_signup_user', 10, 1);

    As you can see, I’ve included the title of the xprofile field in line 3. It’s important to put in the exact title of your xprofile field. The case “Band Role” and case “Fan Role” is the place to put your select options of the field. Finally $new_role has to be filled with the wordpress or custom user roles – important, otherwise it won’t work: in lowercase letters – in my case “band” and “fan”.

    Save your bp-custom.php and you’re nearly done.
    In my case I want to prevent the users to change their user role after registration (if you want to give them the possibility to do so, more hacking has to be done – but I’m not sure how to). Put another snippet in your bp-custom.php:

    //hide the user role select field in edit-screen to prevent changes after registration
    add_filter("xprofile_group_fields","bpdev_filter_profile_fields_by_usertype",10,2);
    function bpdev_filter_profile_fields_by_usertype($fields,$group_id){
    //only disable these fields on edit page
    if(!bp_is_profile_edit())
    return $fields;
    //please change it with the name of fields you don't want to allow editing
    $field_to_remove=array("User Role");
    $count=count($fields);
    $flds=array();
    for($i=0;$i<$count;$i++){
    if(in_array($fields[$i]->name,$field_to_remove))
    unset($fields[$i]);
    else
    $flds[]=$fields[$i];//doh, I did not remember a way to reset the index, so creating a new array
    }
    return $flds;
    }

    Again, fill in the title of the profile field (User Role), where it’s indicated in the code.

    That’s it. I hope I haven’t been too confusing. Ask if you need help.

    adamjd
    Participant

    Still no easy solution to this one? It’s odd that BP has been around for so long and more people aren’t having an issue with the extra profile fields not being sent upon registration.

    #175180
    applegateian
    Participant

    Hi guys

    We have a sidebar custom plugin, where we return different user profile data based on the user type.

    One of these fields returns one of 6 drop down options. However, what I want to do is only one of 5 of the options if selected, and not display the 6th if present. I still need the 6th option but just don’t want to show it in the sidebar.

    Here is the line of code in the plugin to display this data:

     echo " <h2 class='sidebarRole'>".xprofile_get_field_data( 'Role (architect)', get_the_author_id()) ."</h2>";						
    

    Is there a way to say, if the returned result is ‘x’, then don’t display anything?

    Thanks,

    Ian

    #175130
    koendb
    Participant

    Could for instance add dropdown boxes with categories to users extended profile pages.
    Get the value of those profile fields from your home template and use it in a query.

    #175121
    noizeburger
    Participant

    Hi again, @henrywright-1

    just wanted to let you know, that I’ve requested some help from the developer of BP Custom xprofile Fields – donmik

    I asked him, if it is possible, to use a custom xprofile field (selectbox) to choose the user role and pass it over to wordpress. He gave me this function or – you can say – hint:

    function custom_bp_core_signup_user($user_id) {
        $user_role = strtolower(xprofile_get_field_data('NAME OF THE XPROFILE FIELD', $user_id));
        switch($user_role) {
            case "role 1":
                $new_role = 'Contributor';
                break;
            case "role 2":
                $new_role = 'Author';
                break;
            default:
            case "role 3":
                $new_role = 'Suscriber';
                break;
        }
        wp_update_user(array(
            'ID' => $user_id,
            'role' => $new_role
        ));
    }
    add_action( 'bp_core_signup_user', 'custom_bp_core_signup_user', 10, 1);

    I put this code in my bp-custom.php, but it does not work. I think there’s something missing. Maybe you have an idea, or @modemlooper?

    #175100
    DoublDatr
    Participant

    I have a type of matchmaking site and want users to be able to search more than one field from a drop down. For example, If someone wants to search both males AND females, how can I do that? The ‘select matching fields’ area is where I’m using it. I’d like to use a ‘both’ option in the search form that would return male or female, but it will only search for the actual string ‘both’, which obviously nobody is going to put under gender in their profile. I tried using a multi-select box, but that field type won’t show up in the ‘select matching fields’ area. Any ways to do this?

    Thanks!

    #175090
    shanebp
    Moderator

    >Wow, so basically in order for members to have access to edit all of the fields that they entered while signing up, we have to pay for a custom plugin to get access to those fields?

    Let me repeat:
    They are accessed on the front-end on a member’s profile page.
    your-site.com/members/peteratomic/profile/

    If it’s your profile or you are an admin, you will clearly see an ‘Edit’ button.

    >Utterly mind-boggling why this functionality isn’t built in to BP.
    It is built into BP.

    #175085
    shanebp
    Moderator

    > they’re totally inaccessible afterward
    They are accessed on the front-end on a member’s profile page.
    your-site.com/members/peteratomic/profile/

    >Clicking the “your profile” link in the backend brings up a page
    In the Dashboard, that link takes you to the DashBoard > User > Edit screen which is a standard WordPress screen.
    If you want to view and edit BuddyPress Extended Profile fields on that screen,
    then you might be interested in this premium plugin:
    http://www.philopress.com/products/bp-dashboard-user-profile-edit/

Viewing 25 results - 2,401 through 2,425 (of 5,755 total)
Skip to toolbar