• brillfx

    (@brillfx)


    Hi , first JSON API is awesome!
    its a huge help , so thanks for that!

    ok , im trying to add my xprofile fields to json api’s output.
    basically people register through buddypress and add xprofile fields, however im reading the autors info into my application from:

    “get_recent_posts&custom_fields=…..”

    i was wondering if anyone knows how to add the xprofile fields to the author’s info and if its possible.
    i know there is a json api for bbpress but that will just increase my query time so that’s why i want it with the posts im getting .

    im not so great with php and still learing how this works
    any help would be highly appreciated.

    thanks

    http://wordpress.org/extend/plugins/json-api/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author dphiffer

    (@dphiffer)

    Hi brillfx, I’m replying to this a bit late, but you should be able to do this using an action hook or a filter. These aren’t very well documented as of yet, but the two you might try hooking into are ‘json_api_encode’ or ‘json_api_[post type]_constructor’.

    Plugin Author dphiffer

    (@dphiffer)

    Something like this:

    add_action('json_api_post_constructor', 'add_xprofile_fields');

    function add_xprofile_fields($post) {
      $author_id = $post->author->id;
      $post->author->xprofile = ...;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help in adding xprofile values from buddypress to JSON API’ is closed to new replies.