Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 3,751 through 3,775 (of 4,122 total)
  • Author
    Search Results
  • #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’)?

    #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?

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

    #54933
    grosbouff
    Participant

    Here’s a piece of code to replace the displayed nickname by name+firstname.

    change $first_name_field_id and $name_field_id to match your fields.

    /**

    NAME + FIRSTNAME | START

    */

    function user_name_firstname($fullname,$user_id=false) {

    global $bp;

    global $site_members_template;

    $first_name_field_id=40;

    $name_field_id=39;

    if ( !$user_id ) $user_id=bp_get_the_site_member_user_id();

    if ( function_exists(‘xprofile_install’) ) {

    $first_name= xprofile_get_field_data($first_name_field_id, $user_id );

    $name = xprofile_get_field_data($name_field_id, $user_id );

    if ($name) {

    $fullname = $name;

    if ($first_name) $fullname.=‘ ‘.$first_name;

    }

    wp_cache_set( ‘bp_user_fullname_’ . $user_id, $fullname, ‘bp’ );

    }

    return apply_filters( ‘user_name_firstname’, $fullname );

    }

    add_filter( ‘bp_get_the_site_member_name’, ‘user_name_firstname’,9);

    /**

    NAME + FIRSTNAME | END

    */

    Now I have to find a way to order the directory member results by Name+Firstname… Any idea ?

    #54788
    jantanner
    Participant

    Thanks for the quick help. It works fine with me.

    Any quick idea, how to link it to the members search like usual profile fields do?

    greetings from berlin

    Christoph

    #54743

    In reply to: Profile Field Linking

    Paul Wong-Gibbs
    Keymaster

    It might be a better idea to use the xprofile data template loop https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-profile-data-loop-bp_has_profile/ and put some IFs in so it only uses the fields you want to see?

    #54734
    wordpressfan
    Participant

    The next step would be to add some code checking first to see whether there is any data for that field. If true, print the data, if not echo ‘(no data found)’.

    #54733
    wordpressfan
    Participant

    @smuda: yes.

    @poolie: thanks! that works.

    #54699
    Paul Wong-Gibbs
    Keymaster
    #54682
    poolie
    Participant

    <?php echo xprofile_get_field_data('2'); ?>

    would work, where 2 is the id of the field.

    #54681
    smuda
    Participant

    @wordpressfan did you wrap <? ?> around it? :)

    @andy that still doesn’t seem to work. <?php echo xprofile_get_field_data($2); ?> gives an error. <?php echo xprofile_get_field_data($name); ?> too. :/

    #54678
    wordpressfan
    Participant

    How do I echo the field’s data?

    The line “echo xprofile_get_field_data( $field_name_or_id [, optional $user_id] );” only displays “echo xprofile_get_field_data( $field_name_or_id [, optional $user_id] );”

    #54356
    shedmore
    Participant

    Anybody have ideas on the post/question above????

    fubp
    Participant

    *Bump.

    Please anyone?

    #54176
    shedmore
    Participant

    Okay…I have more details from my testing. It works now, but I am not really sure WHY. It seems to me that you have to (for some reason) call the get_field_data function (even if its on a useless peice of data) before you can use the set_field_data function.

    If you notice from my post above…the only thing that is different is that I have added a new variable that is simply capturing the Name field (number 1). Well when I add this:

    $nametestfield = xprofile_get_field_data(1,$wpuid);

    And then the set_field after it (with my age variable)…than it starts working, and the field is inputted.

    SO….Is there a reason why you can’t call the set_field independently. Calling in the name is basicaly useless in the function above, but it DOES make the whole thing work for some reason.

    ///////////////////////////////

    function BP_Insert_Test($wpuid, $age) {

    $age = ‘tester gender’;

    $nametestfield = xprofile_get_field_data(1,$wpuid);

    echo(‘user name exists already’ . $wpuid . ‘ and userdata is ‘ . $age);

    echo(‘Need Field is’ . $nametestfield);

    xprofile_set_field_data(2, $wpuid, $age);

    }

    #54174
    shedmore
    Participant

    For some reason…no matter what I try, I can’t inject SPECIFIC variables via the xprofile_set_field_data function….I run this function (below)

    ONLY AFTER running two conditionals to make sure

    /////////

    ONE the buddypress globals are set

    and

    TWO the check for the xprofile function passes

    Both conditionals pass (as expected) then go to my test function below

    ////////

    End result — The echo statement appears correctly…but nothing is appearing in the field values for the user – I am pulling my hair out??????

    Sample

    ////////

    function BP_Insert_Test($wpuid, $age) {

    $age = ’22’; // Should appear in the profile

    echo(‘user id is ‘ . $wpuid . ‘ and userdata is ‘ . $age);

    xprofile_set_field_data(2, $wpuid, $age);

    }

    Any ideas?

    #54166
    Damon Cook
    Participant

    I’m attempting to do something kinda similar. I just want to create a block (pardon my Drupal lingo) that shows a blog’s author information in my theme. I want to specifically show their BP custom fields.

    Right now I’ve copied over bp-sn-parent/profile/profile-loop.php to my theme and called: locate_template( array( 'profile/profile-loop.php' ), true ) but this gives me everything in the user’s profile. I would like to get a little more granular and just specify certain fields. hmmm

    Here is my current example as it exists.

    #54157
    shedmore
    Participant

    Okay….Andy is probably busy, I didnt mean to explicitly ask Andy (only) :)…if anyone has any advice on this I would appreciate it!

    #54119

    In reply to: "No blogs found."

    outolumo
    Participant

    I have this same issue. The blog name bears no resemblance to the username. There’s no reference to any blog in the profile fields.

    WPMU 2.8.4a

    BuddyPress 1.1

    It was not solved by itself overnight.

Viewing 25 results - 3,751 through 3,775 (of 4,122 total)
Skip to toolbar