Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 5,151 through 5,175 (of 5,698 total)
  • Author
    Search Results
  • #56118

    In reply to: X-Profile Fields

    r-a-y
    Keymaster

    I don’t see this as well in BP 1.1+.

    This was extremely useful!

    But, I’m guessing if you already have these profile fields setup when you upgrade, these fields should still exist.

    It’s only if you decide to create new x-profile fields that you won’t be able to use the CSV option.

    EDIT: Added an enhancement ticket in Trac:

    https://trac.buddypress.org/ticket/1327

    #56042

    In reply to: html in profile fields

    philbow
    Participant

    DJPaul,

    Yes it was wrapped, and no line breaks/whitespace.

    Thanks,

    Phil

    #7441
    Lriggle
    Participant

    Just installed a fresh WP/BP in my test environment with WP2.8.5.2 and BP1.1.2. I’m having an issue setting up certain custom profile fields.

    In our live environment, which is a bit older and running BP 1.0.3, there were some pre-built fields available for things like State and Country pulldowns. I’ve been able to find the CSV files where this info resides in 1.1.2, but the pre-built fields don’t seem to be available.

    Have these been phased out of use in this version of BP, or did I mess something up? I don’t relish the idea of creating 50 pulldown items for the US states…

    #56004

    In reply to: html in profile fields

    Paul Wong-Gibbs
    Keymaster

    I assume you’ve wrapped your code in <?php ?> brackets?

    Also, check you haven’t got any linebreaks or white spaces anywhere.

    #55992

    In reply to: html in profile fields

    philbow
    Participant

    I am putting it into bp-custom.php per the thread referenced. The error is that it can’t pass the headers because it already did.

    Thanks,

    Phil

    #55915
    peterverkooijen
    Participant

    Excellent, that works very nicely. Thanks John James Jacoby!

    Could something like this become part of the core? When you have the name of a member, it should be easy to add associated data. This function makes it a lot easier.

    Edit: The function probably needs to be expanded a bit. I get these slashes (escapes?) in the output:

    Pandora's Box

    I’ll look into that when I have time…

    #55905

    Within the members loop, the problem is that you’re not feeding it any user_id to get the data for… Like I said above, without a user_id, it’s just looking for the $bp->displayed_user->id, which doesn’t exist because when you’re on a directory page, there is no displaued_user->id; you’re not looking at a member…

    Within any member related loop, you will need to make a custom function for that loop and use the user_id available to you to spit out what you need…

    Put this in your bp-custom.php… (haven’t tested this, wrote freehand, lookout for bugs)

    function bp_custom_member_list_xprofile_data( $field ) {
    echo bp_custom_get_member_list_xprofile_data( $field );
    }
    function bp_custom_get_member_list_xprofile_data( $field ) {
    global $site_members_template;

    return xprofile_get_field_data( $field, $site_members_template->member->id );
    }

    Then use it like this on fields that need checking…

    <?php if ( $company = bp_custom_get_member_list_xprofile_data('Company') ) : ?>
    <p><?php echo $company ?></p>
    <?php endif; ?>

    …or like this on fields that don’t…

    <p><?php bp_custom_member_list_xprofile_data('Company') ?></p>

    #55904
    peterverkooijen
    Participant

    Thanks for the additional information. I’ve tried this in members-loop:

    <?php if ( $company = xprofile_get_field_data('Company') ) : ?>
    <p><?php echo $company ?></p>
    <?php endif; ?>

    and this

    <p><?php echo xprofile_get_field_data('Company'); ?></p>

    Still get nothing with either version…

    The search actually searches all fields of the user/group/blog, and returns anything that is relevant to that item. So if any of my xprofile_field’s have a “k” in it somewhere, it will return me. So in theory, it doesn’t suck yet, it just hasn’t been narrowed down. It’s a blank slate and a starting point to building a better search. Search functions also greatly depend on the goal of the website and what results you’re trying to pull out.

    WPMU Sitewide Search plugins currently aren’t for the faint of heart. They take all of your posts/tags/categories for all blogs, lump them into new additional full text database tables, and search those instead. It’s the only real way to do it without a million joins that just wouldn’t make any sense… Problem is you’re duplicating your data twice over into 1 mega huge table, and rebuilding the search index for old posts on a larger website would be an astronomical task that would take days of processing.

    @erich73, those are good recommendations for the directories. Put them in a trac ticket as an enhancement for maybe 1.3?

    #55901

    In reply to: html in profile fields

    What error does it generate? The code looks fine. Where are you putting it. The only thing I can think is that it’s running before the filter is added somehow.

    #55897

    I recommend using the field name, just because it’s easier to keep track of…

    Example…

    <?php if ( $firstname = xprofile_get_field_data('First Name') ) : ?>
    <h3><?php _e('First Name', 'your-theme-textdomain') ?></h3>
    <div class="profile-data-field">
    <?php echo $firstname ?>
    </div>
    <?php endif; ?>

    …will get you the data from the field named “First Name” for the currently displayed user. If there is no user displayed (your account or anyone else’s), it will return false.

    #55887
    peterverkooijen
    Participant

    Doesn’t work for me. Field id ‘2’ is supposed to be company name in my installation, but this in the members_loop.php only displays name and last active:

    <h3><a href="<?php bp_the_site_member_link() ?>"><?php bp_the_site_member_name() ?></a></h3>
    <p><?php do_action( 'bp_core_directory_members_content' ) ?></p>
    <p><?php echo xprofile_get_field_data('2'); ?></p>
    <label><?php bp_the_site_member_last_active() ?></label>

    Should I use bp_the_site_member_something(‘2’)?

    #7418
    philbow
    Participant

    I have a need where I want to add html to the bp profile fields. I am using WP 2.8.4 and BP 1.1.1. Per a different thread, I’ve tried….

    function stuff_i_want_triggered_after_bp_loads(){
    remove_filter( 'xprofile_get_field_data', 'wp_filter_kses', 1 );
    }
    add_action('wp', 'stuff_i_want_triggered_after_bp_loads');

    …but it generates an error. Since the thread was older, I’m guessing something changed in 1x version.

    How can I enable html in profile fields?

    Thanks,

    Phil

    #55852
    buzz2050
    Participant

    Hi again,

    Well, now I have a fresh install of both WPMU(2.8.5.2) and BP(1.1.2) on my localhost. I do not have any other plugins apart from BP installed and still the same problem.

    I have added some ‘required’ custom fields to the ‘Base’ Profile Group. Even though the user fills them during the registration, they still appear blank on the ‘Edit Profile’ page (in BP members) and he has to fill them again (editing and saving works).

    I have the same install on my server, but there I upgraded from earlier versions and apparently, this problem does not occur there. Not sure what’s going on??!

    Please HEELLP!!

    -Sib.

    #55665
    peterverkooijen
    Participant

    @Chouf1, the code is not for uppercasing; it’s making sure firstname and lastname are stored consistently in the different places where WP/WPMU/BP stores names.

    Why is it too much to ask for consistently, reliably stored firstname + lastname in the WordPress world? Uppercasing should be part that imho. It’s utterly ridiculous to have to do that in CSS. Is that even official CSS? Do all browsers support it?

    In most software for grownups firstname and lastname fields are at the top of the members/users table, part of the core of the application, the heart of member registration and management. In the WP/WPMU/BP world it’s a messy afterthought, stored halfheartedly in three or four different locations, in different ways, without any synchronization between them. Aaarrrggghhh.

    Before a WordPress user account is activated, it is stored in the wp_signups table; there’s a meta field storing various things. Have you checked if its that one?

    That’s one of the two places where the lowercase version of the name is stored. My code above updates names with uppercase in the usermeta fields.

    My question is which code stores them in xprofile or wp_signups. Where should I apply my nameize() function to get clean names in xprofile?

    Cleaning them up before they’re stored in wp_signups would do the trick as well, because I think the xprofile data is taken from there. I don’t think the wp_signup data is used for anything else later, so it has a lower priority to me.

    Edit: Of course I’m not trying to uppercase all chars of the name, just the first ones, as used to be custom in western culture. FYI, here’s the nameize function I use:

    function nameize($str,$a_char = array("'","-"," ")){
    //$str contains the complete raw name string
    //$a_char is an array containing the characters we use as separators for capitalization. If you don't pass anything, there are three in there as default.
    $string = strtolower($str);
    foreach ($a_char as $temp){
    $pos = strpos($string,$temp);
    if ($pos){
    //we are in the loop because we found one of the special characters in the array, so lets split it up into chunks and capitalize each one.
    $mend = '';
    $a_split = explode($temp,$string);
    foreach ($a_split as $temp2){
    //capitalize each portion of the string which was separated at a special character
    $mend .= ucfirst($temp2).$temp;
    }
    $string = substr($mend,0,-1);
    }
    }
    return ucfirst($string);
    }

    Edit2: The CSS solution only works on the first name. The last name still starts with lowercase. Any easy CSS trick for that? I don’t think so.

    Apparently the same CSS trick is used in this forum, which would explain why my “username” – cough, spit – is displayed as ‘Peterverkooijen’ instead of ‘peterverkooijen’ as I had entered it. Why is that kind of mess considered acceptable?

    #7382
    peterverkooijen
    Participant

    My first custom field_1 is for fullname. I want to capitalize that input. I already have a function that does that – nameize(). Where should I apply it?

    I’ve gone through a lot of trouble to also update the full name in wp_usermeta and elsewhere upon activation, so those fields all have nicely formatted names.

    But the display name is apparently stored in xprofile before activation. Where is the code that does that? Or is there a way to update the xprofile field with capitalized versions in the same custom function I use to update wp_usermeta?:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    $uid = get_userdata($user_id);
    $email = $uid->user_email;

    $fullname = $meta[field_1];
    $space = strpos( $fullname, ' ' );

    $company = $meta[field_2];

    if ( false === $space ) {
    $firstname = $fullname;
    $lastname = '';
    } else {
    $firstname = substr( $fullname, 0, $space );
    $lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
    }

    $firstname = nameize($firstname);
    $lastname = nameize($lastname);

    $autousername = str_replace('-', '', str_replace("'", "", str_replace('.', '', str_replace(' ', '', strtolower($fullname)))));

    update_usermeta( $user_id, 'nickname', $fullname );
    update_usermeta( $user_id, 'first_name', $firstname );
    update_usermeta( $user_id, 'last_name', $lastname );

    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_login = %s WHERE ID = %d", $autousername, $user_id ) );
    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_nicename = %s WHERE ID = %d", $autousername, $user_id ) );
    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id ) );
    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $user_id ), $user_id ) );
    }
    add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    #55510
    buzz2050
    Participant

    Thanks for your reply Jeff. I understand that the register.php directly contains all the elements now.

    However, we liked the registration page of the default ‘bphome’ theme (BP 1.0.3) better (earlier) and accordingly we customized our site theme(premium edu-clean home theme for WPMU) to have a register page like that.

    To achieve this, I created a custom page template register.php with code similar to that of bphome’s and plonked it in my theme folder. There if you see, the page template is divided into right-column, center-column, left-column (it hosts the registration section)

    The code for this register.php is something like:

    <?php get_header(); ?>

    <!-- div content starts -->
    <div id="content" class="widecolumn">
    ....
    ....

    <div id="left-column">
    <div class="register bp_core_widget_welcome">
    <h2 class="widgettitle"><?php _e( 'Register for an Account', 'buddypress' ) ?></h2>
    <?php bp_core_signup_do_signup() ?>
    </div>
    </div>

    </div><!-- div content ends -->
    <?php get_footer(); ?>

    It’s the bp_core_signup_do_signup() that is responsible for including the content of the registration page in the left-column.

    Here is how my current registration page looks like:

    http://www.cmswebusa.com/testsib/reg_pg.png

    The registration section on the left is included in that section due to the bp_core_signup_do_signup() call. We still haven’t converted to the new single theme way, but we have already upgraded our BP to 1.1.2 and since then our custom fields just don’t get saved. Not sure what to do here?! I was wondering this could be happening coz of the deprecated function call. Also, how do I still make the registration section appear in the left-column of my page? Is there a function to include the register template or something?

    Thanks,

    Sib

    #55467
    buzz2050
    Participant

    @DJPaul

    Earlier when we were using WPMU 2.8.4a with BP 1.1, our registration form worked fine and all the custom fields got saved just fine. Only after the upgrades, are we experiencing this issue. Did not touch the WPMU install, just upgraded BP, that’s it!

    However, we do have a custom registration page which is different than wp-signup.php. On this page we are calling bp_core_signup_do_signup() which is deprecated in BP1.1.2. Could that possibly be creating the issue? Is there any alternative to this call in the newer version?

    We really need to fix this asap, users are already grumbling. Any troubleshooting advice is greatly appreciated.

    Thanks,

    Sib

    #55382
    buzz2050
    Participant

    Yup, that is the problem it seems – the old 2-theme structure.

    I am using the premium ‘edu-clean’ home theme coupled with the BP default ‘bpmember’ theme which is no longer in existence after I have upgraded my BP to 1.1.2. I needed to customize my ‘register’ page. Instead of using WPMU wp-signup.php, I wanted my signup page similar to bphome’s.

    To accomplish this, I simply created a page template(register.php) similar to bphome’s. Added a new page with the register slug, associated it with this template and made the user redirect from wp-signup.php to /register.

    My problem is, on my register template I have used <?php bp_core_signup_do_signup() ?> to display the registration form in the left-column widget. Now, from what I understand, this function is deprecated in 1.1.2. Perhaps, this is the reason my profile fields aren’t getting saved? I still am not sure, but in any case, I would like to replace this function with its equivalent function in 1.1.2.

    I want to retain this layout (i.e using edu-clean as the WPMU theme and bpmember as the BP theme) as of now. I still haven’t gotten the hang of the new single-theme architecture, but I’m working on it. Until I get that right, is there any way we can save our site users the trouble of having to save their profile fields twice?

    Please advice!

    -Sib

    #55377
    buzz2050
    Participant

    Well, I would be happy to share the solution, but I don’t really think my way is all that elegant, there’s got to be a better way and I’m waiting for someone to suggest it to me.

    Meanwhile, I am still using the old 2-theme model. I made some customizations in my bpmember theme to achieve this and put in some code in plugins/bp-custom.php as well.

    Firstly, we have a custom profile field called ‘Role’. And we wanted to have separate Role-tabs (as you can see on our site) to list all members for THAT role.

    To achieve this, I completely changed the bpmember/directories/members/index.php code and put in my ‘Role’ tab-structure there. Then, instead of making the members index file call the members-loop, I wrote a modified version of the members-loop, made it as a function and put it in my bp-custom.php. Now I make a call to this function (which is basically the members-loop) from my bpmember/directories/members/index.php page.

    To give you an eg of how we display all companies under the Company tab:

    In my bpmember/directories/members/index.php, under the code section for ‘Company’ tab I make a call like:

    display_members_by_role(‘Company’);

    In my bp-custom.php, I have written a function display_members_by_role($role) which is nothing but a slightly modified version of the members-loop.

    Here, in the ‘while’ for members-loop, I check for the Role field for that user-id. For this eg, if the Role is ‘Company’, print that member in the company-listing, else not.

    This is the code I have put in the members-loop which checks the custom profile field (which is this case is ‘Role’) and it’s value for that user-id:

    ...
    ...
    <?php while ( bp_site_members() ) : bp_the_site_member(); ?>

    <?php
    global $site_members_template ;

    $arr = BP_XProfile_ProfileData::get_value_byfieldname(array('Role'), $site_members_template->member->id) ;

    if( $arr['Role'] == $role) //$role is the role value received by the function, in this eg - Company
    {
    //do whatever
    }
    <?php endwhile; ?>
    ....
    ....

    Same logic is used for all other roles.

    BTW, get_value_byfieldname() can return values for multiple fields too. In case you want to retrieve values of more than one profile fields, its easily possible. Say I want the ‘City’ custom field value too, then I would pass something like –

    $arr = BP_XProfile_ProfileData::get_value_byfieldname(array(‘Role’,’City’)

    and access the ‘City’ value using $arr[‘City’]

    This function is pretty handy.

    While I am able to print the members belonging to that corresponding role using this logic, what I can’t get into place is the pagination part. The pagination still takes into account ‘All’ members since the members-loop technically does retrieve all members.

    All I have done is put a condition in order to just get the members for that role displayed. I was wondering if I should put in a separate pagination module, or if there is any other way of achieving this whole thing.

    -Sib

    #55306
    stwc
    Participant

    For what it’s worth, I ended up disabling Facebook connect as I approach site launch. It’s been characterized quite a few times as bare-bones, and it pretty much is. It works great for signups, but allows people to bypass filling out any profile fields, and accounts created using it cannot be logged-in-to once its been disabled (without a manual password reset by the admin).

    I’d really (really!) love to see a more integrated, fully-featured version (and may end up putting it together myself eventually if nothing appears and I learn more about how the guts of BP work), one that integrates a little better with BP profiles and allows people to login ‘normally’ to accounts created with it if they want — I think it would be a great tool to smooth the already low speedbump to user account creation, but I got scared about what would happen if I start (as I hope) to get a lot of signups and it breaks in future.

    #55130
    jazgold
    Participant

    just buy a bag of buns

    there are quite a few wordpress plugins for extending user profiles…

    i once used cimy extra user fields for a project, and it worked fine for my purposes. it looks like there are a bunch of options nowadays.

    #7266
    buzz2050
    Participant

    Hi,

    This is my first time with BP and my very first post in the BP forums. I have a query related to the members-loop.

    We have grouped our bp members role-wise. They choose a role from a set of four predefined roles while signing up (it’s a custom profile field).

    I have provided 4 tabs for 4 roles on my members page and clicking on a particular tab should only show the members belonging to THAT role. How can this elegantly be achieved with BP 1.1? Is there any template tag available?

    I basically want to collect the members-array that is returned by bp_site_members() and further filter it by ‘role’.

    I suppose I can hack the core, or maybe add my own function in bp-custom.php file to retrieve the members by whatever clause I want or maybe there is already a way in BP of doing this that I’m just not aware of.

    Not sure, if this is much simpler in logic than in my head right now.

    Any help much appreciated

    Thanks,

    Sib

    #7214
    grosbouff
    Participant

    Here’s a piece of code I wrote to sync the

    -name (core field)

    -last name (custom field)

    -first name (custom field)

    from BP with WPMU :

    -BP name becomes WPMU display name

    -BP first name becomes WPMU first name

    -BP last name becomes WPMU last name

    You have to create those 2 fields in the xprofile admin; then set their ids in the functions

    $first_name_field_id=…;

    $name_field_id=…;

    They have to be set in the BASE group of xprofile (group id #1).

    function sync_wp_bp_names() {

    global $bp;

    if (bp_get_current_profile_group_id()!=1) return false;

    require_once( ABSPATH . WPINC . ‘/registration.php’);

    $user = new WP_User($bp->displayed_user->id);

    $first_name_field_id=40;

    $name_field_id=39;

    //DISPLAY NAME == BP NAME

    if ( isset( $_POST[‘field_1’] ))

    $user->display_name = esc_html( trim( $_POST[‘field_1’] ));

    //FIRST NAME

    if ( isset( $_POST[‘field_’.$first_name_field_id] ))

    $user->first_name = esc_html( trim( $_POST[‘field_’.$first_name_field_id] ));

    //LAST NAME

    if ( isset( $_POST[‘field_’.$name_field_id] ))

    $user->last_name = esc_html( trim( $_POST[‘field_’.$name_field_id] ));

    wp_update_user( get_object_vars( $user ) );

    }

    add_action( ‘xprofile_updated_profile’, ‘sync_wp_bp_names’ );

    What do you think of that ?

    I also don’t understand the differences between display name and nicename in WPMU…

Viewing 25 results - 5,151 through 5,175 (of 5,698 total)
Skip to toolbar