Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP Avatars in bbPress


  • gogoplata
    Participant

    @gogoplata

    Is it possible to display the avatars uploaded in BuddyPress in bbPress (integrated with WPMU, but not using bp-forums)? If so, how?

    TIA

Viewing 25 replies - 26 through 50 (of 76 total)

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Looks like a duplicate in your oci_bb_group_forums_tags.php…

    /**
    * oci_xprofile_field_value()
    *
    * Return the specified xprofile field value
    * Note: dates are in unix time format
    *
    * @param <int> $user
    * @param <string> $group name
    * @param <string> $field name
    * @return <type> unknown
    */
    function oci_xprofile_field_value($user, $group, $field){
    $bp_user = oci_get_userdata($user);
    return $bp_user['xprofile_' . $group . '_' . $field]['value'];
    }

    /**
    * oci_xprofile_field()
    *
    * Return the specified xprofile field array
    * Note: dates are in unix time format
    *
    * The field array is composed of:
    * array(
    * 'group' => group name string,
    * 'name' => field name string,
    * 'value' => field value string,
    * 'type' => bp's name for the field type
    * )
    *
    * @param <int> $user
    * @param <string> $group name
    * @param <string> $field name
    * @return <type> array
    */
    function oci_xprofile_field_value($user, $group, $field){
    $bp_user = oci_get_userdata($user);
    return $bp_user['xprofile_' . $group . '_' . $field];
    }

    Second one should be changed to oci_xprofile_field according to the doc above it.

    Still trying to get the import to work…

    When I uncomment the `

    var_dump($groups_n_users); die;`

    I get…

    bool(false)

    Still looking…

    When I uncomment the `

    var_dump($args); die;`

    inside oci_bb_xmlrpc_query(), I get array(3) { [0]=> string(4) "dsoc" [1]=> NULL [2]=> int(0) }

    dsoc is the name of my user, but it looks like the PW is empty?

    So I uncomment the next line, and I get this…

    string(5) "err: "
    object(IXR_Message)#188 (14) {
    ["message"]=>
    NULL
    ["messageType"]=>
    NULL
    ["faultCode"]=>
    NULL
    ["faultString"]=>
    NULL
    ["methodName"]=>
    NULL
    ["params"]=>
    NULL
    ["_arraystructs"]=>
    array(0) {
    }
    ["_arraystructstypes"]=>
    array(0) {
    }
    ["_currentStructName"]=>
    array(0) {
    }
    ["_param"]=>
    NULL
    ["_value"]=>
    NULL
    ["_currentTag"]=>
    NULL
    ["_currentTagContents"]=>
    NULL
    ["_parser"]=>
    NULL
    }
    object(IXR_Error)#187 (2) {
    ["code"]=>
    int(-32700)
    ["message"]=>
    string(28) "parse error. not well formed"
    }

    Now I’ve typed and retyped my PW twice. I can get post data from bbPress to BuddyPress, and I can post from BuddyPress and see it in bbPress. It’s communicating back and forth successfully…

    Looks like it isn’t updating the PW to me for some reason… brb

    K… Deleting the line from the DB and resaving the bbGroups options info, still makes the PW = NULL or nothing… Looks like it’s stopped saving the PW somewhere.


    Burt Adsit
    Participant

    @burtadsit

    John I put the deep detection around the require_once() at the top of oci_bb_group_forums.php just take that line out and use your own technique. Mine obviously doesn’t work.

    Yes that fn should be oci_xprofile_field(). Wrong file got into the zip.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    oci_bb_group_forums.php – line 619

    Change

    $options["password"] = $options["pass1"];

    to

    $options["password"] = $_POST["pass1"];

    ;)


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Now that the PW situation is squared away… When I try to import all users, the query hates me…

    string(5) "err: " object(IXR_Message)#188 (15) { ["message"]=>  string(204) "
    Fatal error: Out of memory (allocated 31719424) (tried to allocate 1645485 bytes) in /homepages/8/d149961498/htdocs/delsolownersclub/wp-includes/class-IXR.php on line 107
    " ["messageType"]=> NULL ["faultCode"]=> NULL ["faultString"]=> NULL ["methodName"]=> NULL ["params"]=> NULL ["_arraystructs"]=> array(0) { } ["_arraystructstypes"]=> array(0) { } ["_currentStructName"]=> array(0) { } ["_param"]=> NULL ["_value"]=> NULL ["_currentTag"]=> NULL ["_currentTagContents"]=> string(0) "" ["_parser"]=> resource(267) of type (xml) ["currentTag"]=> string(2) "br" } object(IXR_Error)#187 (2) { ["code"]=> int(-32700) ["message"]=> string(28) "parse error. not well formed" }

    Is it really trying to allocate 40mb for this query?

    If the wrong file is in the zip, is it possible that I’ve been banging my head against this chasing a ghost? Ha!


    Burt Adsit
    Participant

    @burtadsit

    Thanks. I gotta stop coding at 4am.


    Burt Adsit
    Participant

    @burtadsit

    Just the template tags file. Has nothing to do with the import routine. I’ve successfully run the import routine for all and just group users on my windows box and the linux box on the dv.

    Looking at your error msg and the new ALL import routine. Sec.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Coding at 4am is usually when I do my best ha!

    Okay so… What the heck does “parse error. not well formed” tell me to do next?


    Burt Adsit
    Participant

    @burtadsit

    No, I can’t imagine it’s allocating that much mem for anything. That spot in the ixr library is for getting the xml values for a ‘struct’. I’m not transferring structs at all. It has a specific option in that fn for ‘array’ and that’s the closest thing.

    Anyway. Somehow I think that both ixr libs are being used. Somehow. Just comment out the require_once() on the wp side and take out the restriction on the bbpress side for that same library inclusion.

    That ‘parse error’ means that it can’t parse some xml that it’s getting. Lets deal with the mem problem. I think that the ‘parse error’ is just a spurious err msg.

    How many groups and users do you have? Nothing can be 40megs of mem.


    Burt Adsit
    Participant

    @burtadsit

    Nah. Both ixr libs can’t be loaded at the same time. It would error out. A whole bunch of mem is being allocated for some reason. Lemme check the code and see what could possibly be running amok if I had deep going.

    I’ll just have to fire it up (deep) and test it. How do you turn that on? I had it running once but can’t remember what to do in the config files.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    164 users, 3 groups.

    Commented out the require_once on oci_bp_, took out the restriction on bbp, appears to be the same result.

    The mem error hasn’t come back since that one time…


    Burt Adsit
    Participant

    @burtadsit

    What are you getting now? If not the mem error.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    If I don’t dump any variables, then nothing…

    Basically the if ( !$client->query( $method, $args ) ) { returns nothing…

    If I trace that back to “oci_server_get_all_groups” in the oci_bp_ side, and it never gets anything.

    My guess is that this all has to do with the deep integration part… And that your code is fine and my connection is crap…

    It’s weird tho, because I can post/retrieve in group forums no problem. Which means that the connection between the two sides is fine, right?

    If I uncomment the var_dump as to why, I get…

    string(5) "err: " object(IXR_Message)#189 (14) { ["message"]=> NULL ["messageType"]=> NULL ["faultCode"]=> NULL ["faultString"]=> NULL ["methodName"]=> NULL ["params"]=> NULL ["_arraystructs"]=> array(0) { } ["_arraystructstypes"]=> array(0) { } ["_currentStructName"]=> array(0) { } ["_param"]=> NULL ["_value"]=> NULL ["_currentTag"]=> NULL ["_currentTagContents"]=> NULL ["_parser"]=> NULL } object(IXR_Error)#188 (2) { ["code"]=> int(-32700) ["message"]=> string(28) "parse error. not well formed" }


    Burt Adsit
    Participant

    @burtadsit

    If you can use the bp group forums from bp then all is well. Gimme a minute here and I’ll find a spot to put some debug code.

    Where is that var_dump()?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Line 395 of oci_bb_group_forums.php..

    I’m going to go mobile for a bit, but will be back this evening to keep at this. :)


    Burt Adsit
    Participant

    @burtadsit

    John, I’m thinking that the problem with nothing coming back is related to the bug you found with the password. I think that the bbpress side is sending the correct username but a blank password and the authentication is failing.

    On the bbpress side the username and password are saved in meta data. I’m not changing the actual ‘connection user’ password. The same thing is happening on the bp side. sambauers is saving the username and password in meta data.

    In this case the bug in my code checked the two passwords and saved an empty string as the password. It send it along to authenticate. It fails and doesn’t return an error message.

    Fix would be to save the password again. Three times.

    1) Change the password in the bbpress user maintenance screen for the utility user.

    2) Change the password in the bbGroups config screen.

    3) Change the password in the buddypress config screen.

    We’ve got 3 passwords floating around and one is hosed. More than likely the one in my stuff.


    Burt Adsit
    Participant

    @burtadsit

    The above scenario matches what’s going on exactly.

    1) You can use bp’s group forums because Sam’s password wasn’t changed. It’s coming from wp meta and it matches the utility user password which wasn’t changed either. bp can talk to bbpress.

    2) The import fails because my password is trashed. It sends the blank password over to bp which gets checked with Sam’s password and it fails.

    Both of us, Sam and I, were too lazy to figure out how to change the actual user’s password instead of just storing it in meta data. Funny thing is I have a ticket in bp trac that complains about the utility username and password being stored in meta data. (sigh)


    Burt Adsit
    Participant

    @burtadsit

    Updated zip online: http://code.ourcommoninterest.org

    Fixed the password save error.

    Added better error handling in the authentication routine on the bp side.

    Fixed the duplicate template tag function name.

    Now when the password is trashed it will give a valid error message instead of nothing.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Updated all passwords, still no luck. I had hoped this was the issue and actually deleted the data from the oci_groups_forums field in the DB and reset it. Did the same on the BP side also, and changed the user PW.

    Is it possible you’re comparing a plain text password to a MD5’ed password and they’re not the same?

    You said something about Sam saving the PW in meta data? Maybe I’m being a bit daft but I don’t have any plug ins from Sam that require saving a PW anywhere? I have your plugin on the bbPress side saving to site meta but that’s doing just fine now.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    If I revert back to .22 of the oci_bp_group_forums.php file, it imports the groups just fine. The problem is on that side somewhere.

    Problem is I don’t know how to debug oci_server_get_all_groups because it’s called inside the xmlrpc request, and no amount of echo’ing or var_dumping actually die’s anything. :(


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Sorry for all of the thinking out loud, just trying to keep you in the loop with everything as much as I can. Burt would you rather I post this here or on your own forums? I just now thought that maybe this isn’t the best place to debug this together?

    I’m off to bed but plan on attacking this more tomorrow. Thanks again for your help and generosity with this. :)


    Burt Adsit
    Participant

    @burtadsit

    @plaintext passwords

    Nope just comparing text to text. You are using sambauers code even if you don’t know it John. The bp group forums uses Sam’s bbpress live plugin for group forums access. Everbody knows it as just a widget that displays bbpress forums and topics in wp sidebars. It’s alot more than that. It’s got all the capabilities bp needs to create and post to bbpress from bp. It’s all there under the hood. See: /mu-plugins/bp-forums/bp-forums-bbpress-live.php

    @doing support here

    This is ok. I don’t mind. I talked to Andy about this issue and bluntly asked about it. I know it’s hard to believe, but I’m not very subtle at times. He’s ok with this.

    @reverting and things are ok

    I’ll revisit this again and wipe things clean on my side. Start from scratch. Test again. When you stop wasting your time sleeping, let me know what your setup is for deep integration. I just need to simulate that on my side.

    You do this in bb-config.php?

    if ( !defined( ‘ABSPATH’ ) ) {

    include_once( ‘/Full/Path/To/wp-load.php’ );

    }

    I remember it being something more than that. For the admin area also. I’ll start there.

    @debugging xmlrpc

    Ha! Welcome to the nightmare John.


    Burt Adsit
    Participant

    @burtadsit

    Mornin’ John.

    I’ve got my system setup to use deep integration now. This way in bb-config.php:

    if (file_exists(‘../wp-blog-header.php’))

    require_once(‘../wp-blog-header.php’);

    else

    if (file_exists(‘../../wp-blog-header.php’))

    require_once(‘../../wp-blog-header.php’);

    Very first thing under the comment block in that file. I’m also using your code to fix the require_once() problem on both sides.

    I deleted *all* the meta data that bbGroups puts into bbpress meta and wp user meta tables. Started completely from scratch. Configured bbGroups to use the utility user and password that is setup in the bp group forums side.

    Imported all my test groups and users. Both all users and just users who belong to groups. I get the proper numbers and data. I don’t have 100+ users but that shouldn’t matter. If Andy was going to try and import the 500,000+ users from wordpress.org I’d be worried about the amount of data getting generated.

    I don’t think I have to worry about that scenario right now. :)

    I’m not having any problems importing even with deep integration. Lemme know what you find on your side. I have to do some running around today so I’ll be gone till this afternoon. I’ll check back in then.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    For deep integration I’ve found that using the absolute path to the file works the best. I use this in bb-config.php…

    if ( !defined('ABSPATH') & !defined('XMLRPC_REQUEST')) {
    include_once( '/homepages/8/d149961498/htdocs/delsolownersclub/wp-blog-header.php' );
    }

    Now I know what you’re going to say, and I’ve also tried it with and without the second check for XMLRPC_REQUEST with what seems to be little or no change. Remember before in the other topic, because the XMLRPC is including both ways, which means including both plugins, it was getting an error message of duplicating functions, even with the other two checks in there.

    Basically if you’re in bbPress, it includes WP, which includes XMLRPC, which then continues to load bbPress which tries to load XMLRPC. When the XMLRPC request goes through from BBP to WP, it hits up a new BBP page, which loads WP again, to do all the PW checks, and I feel like all of these circular inclusions and requests are spinning me around and I’m chasing my tail. What I’m trying to do is avoid deep integration if an XMLRPC request is taking place, that way BBP is just BBP when XMLRPC is taking place.

    Is it safe to delete all the bbpress_live entries in the database too? What should I all delete from the DB to start from square one and give this another try?


    Burt Adsit
    Participant

    @burtadsit

    Hmmm.

    xmlrpc query from bbpress happens

    xmlrpc query gets to wp

    xmlrpc.php does include(wp-load.php)

    wp-load.php does require_once(wp-config.php)

    wp-config.php does require_once(wp-settings.php)

    We are now in wp and it’s fired up.

    wp services the xmlrpc request

    We’re back in bbpress.

    That’s what happens during an import from bbGroups.

    During that process, at the beginning, in bbpress oci_bb_group_forums.php class.ixr.php is loaded because:

    if (defined(BACKPRESS_PATH))

    require_once( BACKPRESS_PATH . ‘/class.ixr.php’ );

    We get to wp loading plugins and in oci_bp_group_forums.php we get to:

    if (!defined(BBDB_NAME))

    require_once(ABSPATH . WPINC . ‘/class-IXR.php’);

    and class.ixr.php is not loaded again.

    That should work. I’m not sure what isn’t working on your side.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    My process above was using deep integration. Even if an XMLRPC request looks for the xmlrpc.php in the bbpress install directory, it still loads bb-load.php, which loads bb-config.php, which loads all of wordpress before proceeding to load the remainder of bbpress. If an XMLRPC request is being made from buddypress to bbpress (like when viewing a group forum from within BP), I don’t want to reload all of buddypress again invisibly, if that makes sense?

    That’s why I did…

    if ( !defined('ABSPATH') & !defined('XMLRPC_REQUEST')) {

    in bb-config.php, to prevent reloading ALL of wpmu and bp just for a quick xmlrpc peek.

    What I don’t get is why it works in every version but this new one.

Viewing 25 replies - 26 through 50 (of 76 total)
  • The topic ‘BP Avatars in bbPress’ is closed to new replies.
Skip to toolbar