I’ve been setting up BuddyPress so that people users can add their information in the profile fields. I’ve added about 5 groups of information, and this works fine. But if I add another group, the group name appears below the others (it needs to wrap around), but it isn’t linked and so it doesn’t work. Is there a limit to the number of groups you can have when setting up profile fields?
Just updated my Custom Profile Filters for Buddypress http://wordpress.org/extend/plugins/custom-profile-filters-for-buddypress/. Allows users to specify which phrases in their profiles should be linked to a site-wide search. Also gives admins the power to turn off the automatic linking of a given profile field, and to specify fields (like Twitter or FriendFeed) where the handle should redirect to the social networking profile page, rather than a BP search.
I’ve split the function as follows:
function xprofile_add_signup_fields() {
global $bp_xprofile_callback, $avatar_error, $avatar_error_msg;
/* Fetch the fields needed for the signup form */
$fields = BP_XProfile_Field::get_signup_fields();
if ( $fields ) {
?>
<div id="extra-form-fields">
<?php
for ( $i = 0; $i < count($fields); $i++ ) {
if ( $bp_xprofile_callback[$i]['field_id'] == $fields[$i]->id && isset($bp_xprofile_callback[$i]['error_msg']) ) {
$css_class = ' class="error"';
} else {
$css_class = '';
}
?>
<div class="extra-field">
<?php if ( $css_class != '' ) { echo '<div class="error">' . $bp_xprofile_callback[$i]['error_msg'] . '</div>'; } ?>
<?php echo $fields[$i]->get_edit_html($bp_xprofile_callback[$i]['value']); ?>
</div>
<?php
$field_ids .= $fields[$i]->id . ",";
}
?>
</div>
<input type="hidden" name="xprofile_ids" value="<?php echo attribute_escape( $field_ids ); ?>" />
<?php
}
}
add_action( 'signup_extra_fields', 'xprofile_add_signup_fields' );
function xprofile_avatar_field() {
global $bp_xprofile_callback, $avatar_error, $avatar_error_msg;
if ( !(int) get_site_option( 'bp-disable-avatar-uploads' ) ) {
?>
<div id="avatar-form-fields">
<h3><?php _e('Profile Picture (Avatar)', 'buddypress'); ?></h3>
<p id="avatar-help-text"><?php _e('You can upload an image from your computer to use as an avatar. This avatar will appear on your profile page.', 'buddypress'); ?></p>
<?php
if ( $avatar_error ) {
$css_class = ' error';
} else {
$css_class = '';
}
?>
<div class="avatar-field<?php echo $css_class; ?>">
<?php if ( $css_class != '' ) { echo '<div class="error">' . $avatar_error_msg . '</div>'; } ?>
<label for="file"><?php _e( 'Select a file:', 'buddypress' ) ?></label>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_site_option('fileupload_maxk') * 1024; ?>" />
<input type="hidden" name="slick_avatars_action" value="upload" />
<input type="hidden" name="action" value="slick_avatars" />
<input type="file" name="file" id="file" />
</div>
<script type="text/javascript">
jQuery(document).ready( function() {
jQuery('form#setupform').attr( 'enctype', 'multipart/form-data' );
jQuery('form#setupform').attr( 'encoding', 'multipart/form-data' );
});
</script>
</div>
<?php
}
}
add_action( 'signup_avatar_field', 'xprofile_avatar_field' );
Unfortunately it doesn’t work 100%. I was able to register a test user, but first name, last name and avatar were not stored.
With the old combined function first name and last name were stored correctly, so I must have made a mistake in splitting them. Where?
Comments + suggestions appreciated!
I want a registration form that looks something like this:
First name: …
Last name: …
Email address: …
Sign Up! (button)
This excellent plugin makes login with email address possible; a username is no longer needed!
Restructuring the registration form in WPMU/BP appears to be almost impossible. I’ve posted other questions about this, like here, but this post is an attempt to start at the top and go through it step by step.
1. Created a custom field “Last name” and made it required. It appears under “* Name:” on the form as “* Last name:”.
How can I rename “* Name:” on the form to “* First name:”?
2. Went into bp-core-signup.php to change the order of the registration form fields – or is there a better way? To move the ‘firstname’ and ‘last name’ fields to the top of the form I’ve moved this bit up:
echo '<div id="extra-fields">';
do_action( 'signup_extra_fields', $errors );
echo '</div>';
Unfortunately ‘Profile Picture (Avatar)’ is included in signup_extra_fields.
Why? Is there any way to remove this from the initial registration and move it to optional profile fields?
Or is there any way to move “Name” (or firstname+lastname) to the top of the form separate from the extra_fields?
Where and how are the extra_fields generated? How can I change their appearance, remove/edit text, etc.?
Solutions to this would be a good start. More problems later…
There are already fields for first_name and last_name in wp_usermeta, so it shouldn’t be necessary to create custom profile fields for them in bp_xprofile.
How can I add these first_name and last_name fields to the registration form, instead of one “Name” field? And how could the one fullname be generated from first_name and last_name?
btw, this is standard across a lot of social media sites. Look at Facebook – aside from the fact that they login with email instead of username, they also have display name, first and last….just like BP can have
Exactly, but how?! Do I really have to get into complicated custom coding to get an “industry standard” registration process?
Where is that built-in “name & last name” feature that Nicola Greco mentioned?
Following Mike Pratt’s suggestion I’ve added custom profile fields for separate first name and last name and made them required.
They now show up on the registration form, but there’s already the required field “Name” there.
Is there a way to autogenerate “Name” from “first name” and “last name”?
Aren’t separate first name and last name already a default part of the system somewhere? I noticed user management in wp-admin has separate first and last name fields. Where are they stored? Can’t I use that for the registration form as well?
Very confused…
Hi
I know this issue has been already adressed before, i’ve read the threads about it, but i cannot find any missing piece of code or spaces or anything related to the php document i’m getting the error from.
When i search for a keyword for a group on http://futeblogs.com/groups that already exists, i get this message:
Warning: Cannot modify header information - headers already sent by (output started at /home/futeblog/public_html/wp-content/bp-themes/bpmember/directories/groups/groups-loop.php:4) in /home/futeblog/public_html/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-signup.php on line 5
Wich means something is wrong in groups-loop.php line number 4
When i search for a group that is not there , there , i get this
Warning: Cannot modify header information - headers already sent by (output started at /home/futeblog/public_html/wp-content/bp-themes/bpmember/directories/groups/groups-loop.php:47) in /home/futeblog/public_html/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-signup.php on line 5
So, line 47 on same page.
However, i’m looking and looking and can’t find anything.
Here’s the code:
<?php if ( bp_has_site_groups( 'type=active&per_page=10' ) ) : ?>
<div class="pag-count" id="group-dir-count">
<?php bp_site_groups_pagination_count() ?>
</div>
<div class="pagination-links" id="group-dir-pag">
<?php bp_site_groups_pagination_links() ?>
</div>
<ul id="groups-list" class="item-list">
<?php while ( bp_site_groups() ) : bp_the_site_group(); ?>
<li>
<div class="item-avatar">
<a href="<?php bp_the_site_group_link() ?>"><?php bp_the_site_group_avatar_thumb() ?></a>
</div>
<div class="item">
<div class="item-title"><a href="<?php bp_the_site_group_link() ?>"><?php bp_the_site_group_name() ?></a></div>
<div class="item-meta"><span class="activity"><?php bp_the_site_group_last_active() ?></span></div>
<div class="item-meta desc"><?php bp_the_site_group_description() ?></div>
<?php do_action( 'bp_core_directory_groups_content' ) ?>
</div>
<div class="action">
<?php bp_the_site_group_join_button() ?>
<div class="meta">
<?php bp_the_site_group_type() ?> / <?php bp_the_site_group_member_count() ?>
</div>
<?php do_action( 'bp_core_directory_groups_actions' ) ?>
</div>
<div class="clear"></div>
</li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<div id="message" class="info">
<p><?php _e( 'There were no groups found.', 'buddypress' ) ?></p>
</div>
<?php endif; ?>
<?php bp_the_site_group_hidden_fields() ?>
Any help is much appreciated.
This has not yet been implemented. As this thread has not seen any activity for 4 months, I would suggest searching the trac and see if it was ever added as a feature request / enhancement ticket. If not, you can add it yourself!
You login to trac using your BP.org credentials.
As a side note, the reordering of groups would need to exclude the first field group as it is the grouping of fields that appear on the signup page.
Update:
By the way, I should have provided a little more detail. Whereas I call this a bug, technically what is happening is all profile data, except URLs, are filtered to make them searchable–unless the field data has more than 5 non-comma separated words in a row (don’t ask why that limit, I don’t know).
So, if you hover your cursor over the field value, you’ll see this toward the end of the link:
?s=
This creates a search link for the keyword or phrase which when clicked on should perform a search that brings up related results. Of course, on a development site, you more than likely will not have any relevant results.
Whereas in general I like the idea of making data searchable via links (it’s sort of like tags), this implementation is flawed. At a minimum, it should not be linking the user’s “Full Name” field as the best search result for that is for the viewer to stay exactly where they currently are–on that member’s profile. Also, linking radio button groups or checkbox selections seems unnecessary. The data in these types of fields is often too specialized to be of much meaning in a search. Furthermore, the code arbitrarily excludes phrases over 5 words long. Finally, clicking on one of these links can be confusing to users as it sends them to the members homepage without explaining what is going on. Only in very large sites will any relevant results be returned.
It might be nice if there was an administrative option to not make profile fields clickable.
I have not yet figured out an appropriate patch to the filter function. But, when I do, I’ll add it to this trac ticket.
In the meantime, if you wish to simply deactivate this “feature”, you could use a remove_filter() call to disable the offending filter.
@jensenrandy-
I’ve actually just isolated the bug. Interestingly enough, bp.org (this site) also has this bug. I suppose you could call it a feature, but creating links to what seems like nothing is a bug to me. Go into your profile on this site and look for yourself.
Of course the clue was in the linking text I highlighted in my first post–but I failed to notice. I can get the profile fields to work properly by commenting out a certain filter. I’m trying to determine the proper patch. I’ll post the bug ticket number back here when I have it all figured out.
Hi,
yes everything is public in the current version of BuddyPress. In order to view these new fields all that you have to do is to fill them.
I not sure if I misunderstand what your problem is, so I apologize if this is something you already know.
So, after you finished adding new fields in admin section, go to your Buddypress profile page, hit Edit profile. On the first page you will see fields from the Base group. If you are using Buddypress default theme, look at the gray bar just under SocialNetwork title. On this bar you will see something like:
[ME] [MY PROFILE] [Base] [and here should be your new groups]
Just click on your group, enter some text in those fields and they will be shown on your profile page.
Hello, ok correct me if i got this wrong but when changing the profile field setup there is the option to create a new, to which i can add new fields.
Now my site is specific breed of dog site and so i would like to have the ability for users to add there dogs info to profile.
ie
Dog 1
date of birth
sex
colour
breeder
etc etc
Now i have created 2 new groups Dog 1 Dog 2 and added new fields, but can’t see how to make these public?
can this be done at present?
cheers
I just tried this on a test site of mine. Within the Basic field grouping, all fields, including radio button fields, are turned into links. Yep, radio button fields. Tell me how that makes sense. It grabs the text from the selected option field and displays that as a link. I can understand it display the text from the selected radio button, but turning that into a link makes no sense at all.
The linking occurs in other field groups as well, not just the basic field group.
I’ll look at the codebase tomorrow to see what’s going on. I think it is something in get_edit_html() that is causing this issue.
So this only appears to happen in the Admin user’s profile fields. Okay, a few more questions:
- What happens if you delete the “blah” data, save the emptied out field, and then reenter some data in that same field?
- What happens if you create a new text field and try entering data? Does it also create links?
- What happens if you delete that field then recreate it and enter data?
there are four original wordpress blogs in a folder off the root..(/maria/ being one of them, the others are linked in the blogroll section of her blog) then i have wpmu installed in the /profiles/ directory and that’s where buddypress is installed too
doesn’t seem like they should interfere or anything, they’re using different databases and different prefixes for the table fields.
My guess (and this is a long-shot) is that you cannot leave the field blank once you’ve entered something in there, but BuddyPress also won’t lock you into that screen if it is.
Otherwise users could find themselves in all sorts of redirect problems going from profile group to group.
I haven’t tried that part yet myself though.
If there’s 5 required fields on the page, and you fill in 4 of them, in my opinion it should still save the 4 you filled in.
Haha! You are correct! This must be a bug. Otherwise, it seems useless to have a message saying you have to do something when in fact you don’t.
But, if you leave that screen and go back to it, the information gets saved.
The activity stream doesn’t say it got saved, but they do.
Ironically enough, if you save your profile without all of the required fields filled in on the page, it still saves the data. Not sure if this is a bug or not, but I kind of like it like this actually
John,
I just tried editing a test user profile field in which a newly-created required field had not yet been modified by that user. I changed some data in a different field and when I clicked on “Save Changes”, I got a message stating that:
There were problems saving your information. Please fix the following:
"Allow this profile group to be seen by" cannot be left blank.
In other words, since I had not entered data in this new required field, it would not let me save my changes.
I’ve read a post here saying that an edit a users profile feature will not be part of buddypress until 1.1. However we use buddypress as an internal network for our association of companies and we had one of our folks go through and set up profiles for everyone.
The problem is, she mismatched the username and email (first 2 required fields) with the custom fields below it. So now all 30-40 users have mis-matched info.
Is there a directory file that I can dig through to find this information stored somewhere and manually rectify it?
The only fields that show up during registration are the ones in the main group, and even then they have to be marked as required. Any other profile fields won’t show up during registration, but just like Jeff said will need to be filled in.
(Ironically enough, if you save your profile without all of the required fields filled in on the page, it still saves the data. Not sure if this is a bug or not, but I kind of like it like this actually.)
I suspect in the future there will be more selections and features as to which fields to show on registration, etc…
Any profile fields you add after a user has registered will be blank until they go into their profile and add data to them. If you have set a profile field as “Required”, the next time a user edits their profile data, they will not be able to save their changes unless they have entered data into any required fields.
3129018Inactive
After installing , i add some profile fields but the profile won’t show after new signup and needs to fill up again their profile fields
Did you manage to get it hiding certain fields? I need to ask people for sensitive data that I don’t want shown on the public profile. Would this suffice and where in the code do I need to flip it?