Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Xprofile question….


  • enlightenmental1
    Participant

    @enlightenmental1

    echo 'Welcome' . ??????????????(field_7, $curauth->the_user). ' , How Are You' ;

    notice the ????????????? aboveā€¦. what do i put there to get Xprofile fields?
    here is what I use on regular wordpress profile field…

    if( get_user_option(first_name, $curauth->the_user) ):
    
    echo 'Welcome'. get_user_option(first_name, $curauth->the_user) .' ' ;
    
    endif;
Viewing 14 replies - 1 through 14 (of 14 total)
  • xprofile_get_field_data( $field_name, $user_id )


    enlightenmental1
    Participant

    @enlightenmental1

    Fatal error: Call to undefined function xprofile_get_field_data() in…

    eh?

    my code:

    if( xprofile_get_field_data(field_1, $curauth->the_user) ):
    
    echo 'Welcome' . xprofile_get_field_data(field_1, $curauth->the_user). ', enter here' ;
    
    endif;

    Thanks Andy, your skills humble me

    Sorry yes, you’ll need to be running the trunk version, I don’t think that function was in RC-1.


    enlightenmental1
    Participant

    @enlightenmental1

    Could a person even attempt to add the necessary functions without replacing RC1 ?

    my boss is all over me to get this site done… so we’ve done much customizing to the core to get the desired results…

    can I simply add this function? or am i in over my head (proly already am)

    thanks agian


    enlightenmental1
    Participant

    @enlightenmental1

    wow… I honestly only pushed the “send post” button once… lol

    Possibly. You could try adding this to bp-xprofile.php:

    function xprofile_get_field_data( $field_name, $user_id = null ) {
    global $bp;

    if ( !$user_id )
    $user_id = $bp->displayed_user->id;

    return apply_filters( 'xprofile_get_field_data', BP_XProfile_ProfileData::get_value_byfieldname( $field_name, $user_id ) );
    }


    enlightenmental1
    Participant

    @enlightenmental1

    sorry to bother you further….

    that corrects the fatal error… however the field_1 value is not called back……(thought field_1 was full name…)

    echo 'Welcome' . xprofile_get_field_data(field_1, $curauth->the_user). ', access your account below.' ;
    I named it wrong? or there’s more function to add? I think I will move onto the latest trunk if this doesnt work…. is there a “version hsitory” where i can see the new code used in the latest trunk? otherwise I’ll be comparing lots of code when i try to implement

    Use the name of the field:

    echo 'Welcome' .xprofile_get_field_data( 'Full Name', bp_loggedin_user_id() ) .', access your account below.' ;

    https://trac.buddypress.org/browser/


    enlightenmental1
    Participant

    @enlightenmental1

    Fatal Error: bp_loggedin_user_id unidentified function……

    this is after replacing bp-xprofile.php and bp-xprofile/bp-xprofile-filters.php with the trunk version

    now replaced bp-xprofile-templatetags.php and getting a fatal error…. still working on it

    that function will work, you need to just work out how to get the user_id – maybe the $current_user global will work.


    enlightenmental1
    Participant

    @enlightenmental1

    I thought $current_user might work as well…. but it isn’t…

    bp_loggedin_user_id seems to Error no matter how/where i use it…

    which file has the bp_loggedin_user_id function? I would like to manually add that from the trunk

    $curauth->the_user //pulls from regular WP profile

    $current_user // not sure if this is even a wp function

    bp_loggedin_user_id // returns a fatal error

    if bp_loggedin_user_id is a function, it must not be in my install…. and I can’t find where that one is in the trunk..


    Burt Adsit
    Participant

    @burtadsit

    I\’m trying to remember back when, when the $bp global var was still an array. If you are on a version of bp that is that way then I *think* the var you are searching for is: $bp[\’loggedin_userid\’]

    If you are on a more recent ver then the var is $bp->loggedin_user->id

    Don’t forget to turn off the lights as you leave the room please.


    enlightenmental1
    Participant

    @enlightenmental1

    i wanna turn the lights off so bad…..

    xprofile_get_field_data(field_1, $bp->loggedin_user->id)

    xprofile_get_field_data(‘First Name’, $bp->loggedin_user->id)

    xprofile_get_field_data(‘First Name’, $curauth->the_user)

    xprofile_get_field_data(‘First Name’, $bp[‘loggedin_userid’]) //errors…

    none of these work


    enlightenmental1
    Participant

    @enlightenmental1

    ok… never mind… this DOES work

    thanks for your help guys

    <?php echo 'Welcome' . xprofile_get_field_data('First Name', $bp->loggedin_user->id) .', access your account below.'; ?>

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] Xprofile question….’ is closed to new replies.
Skip to toolbar