Skip to:
Content
Pages
Categories
Search
Top
Bottom

xprofile_get_field_data NOT Working in Child Theme!


  • Buddy Quaid
    Participant

    @buddyq

    I’m simply just trying to use xprofile_get_field_data with no success inside a child theme.

    I have tried so many different things. I’ve tried…

    • adding global $bp;
    • creating a new instance: $bp = buddypress();
    • echo $bp->loggedin_user->id (returns nothing);
    • hardcoding data for xprofile such as: xprofile_get_field_data(4,3053)
    • include_once to the plugins page that contains the function
    • using add_action(“bp_loaded”, “my_function”). (Didn’t fire my function)
    • I get “TRUE” if testing if (function_exists(‘xprofile_get_field_data’))

    What else can I be doing? Seems simple enough, yet, doesn’t want to work.

Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    You are making some basic mistake.
    You shouldn’t need to create an instance of bp
    Try using the bp_ready hook instead of bp_loaded.
    Instead of $bp->loggedin_user->id use bp_loggedin_user_id() or get_current_user_id()
    You don’t say where you are trying to use it in your child theme.
    Why not use pastebin to share the section of code that is not working?
    Use var_dump rather than echo to see what is really being returned.
    Try your code in bp-custom.php


    Buddy Quaid
    Participant

    @buddyq

    Hi Shane,

    bp_ready worked! Thank you. I forgot to reply and say that it did work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar