Well that's one error message down!
Have you tried adding $bb_roles to your list of globals in config.php?
bbPress support forums » Plugins
bbSync
(255 posts)-
Posted 1 year ago #
-
Thanks, Felix. Getting closer.
Okay, I added "$bb_roles"
- Now, I get no errors when creating an entry in WP. The topic is created in bbPress. Yay! Progress!
- If I post a comment from WP, I get a blank page back on submit. If I go back and look at the entry, the comment is actually recorded, though. It is also present in bbPress.
- If I post a reply from bbPress, it does not show in WP. Is this expected?
Posted 1 year ago # -
hey fel,
thanks for all the work on this plugin, before i found it, i thought i was going to have to write one myself!
i am currently working on getting it up and running with wpmu, figuring out as i go along. i have a few suggestions, and i'll compile them once i'm completely done hacking this thing (i'm pretty close).
Posted 1 year ago # -
Hey fel, sorry for the delay in replying. I did it the less cool way you mentioned. Just changed the template to call my own modified function with an extra parameter passed to it (the amount of posts in the topic -1). Pretty simple, but worked like a charm. You probably couldnt modify that stuff through your plugin, but you could do some magic by just writing some felfunctions that mostly do that same stuff as wordpress's functions and then add them to the plugin. idk.
I do have a weird bug that im trying to figure out, I think crowspeaker had a similar one. I actually think his bug might be two separate bugs.
I can post back and forth and see comments yadadaada, everything works EXCEPT:
If I make a post in wordpress as an administrator, I lose my administrator powers in the forum (the forum only). I get the extra
capabilities(member)thing. I just delete that database entry and i can go full on again. I havent quite tracked the culprit down yet, but ill let you know. For now I can just hack it and delete that entry after every post if it exists. rofl. dont ever do that though.Posted 1 year ago # -
This has been scarcely tested, but I think I have a fix for my bug... weird...
in the bb-includes/capabilities.php file there is a function at the bottom that looks like this:
function bb_give_user_default_role( $user ) { if ( !( is_object($user) && is_a($user, 'BB_User') ) ) return; $user->set_role('member'); }I changed it to look like this:
function bb_give_user_default_role( $user ) { if ( !( is_object($user) && is_a($user, 'wp_User') ) ) return; $user->set_role('member'); }Instead of checking to see if the bb_user existed, we wanted to check to see if the wordpress user existed, assuming we merged our user table. For some reason, this seems like a bug in the bbPress code. Shouldn't that be a variable prefix to begin with?
Posted 1 year ago # -
ONE more post for now. My next task... Do we really need redundant blog comments if we call felbbreplies? I have this whole table of comments stored for anything posted through the blog, but i dont think I ever access them. If someone knows a quick way to help me out let me know. Otherwise, I think I'll work on that tomorrow. Thanks again felb, you've saved me hours of work.
-Slex
Posted 1 year ago # -
Joe, np. Re: #3, no, you need to modify the template to use fellbbreplies() and return all replies (comments and bb posts).
Jazbek, excellent!
Hey Slex, the less cool way is cool too. There's somd rewriting due on this plugin that I'll have to do somdtimd soon and I'll hopefully improve things then. The bug you found does exist, but I believe the problem is _before_ that function when it checks if the user has a capability. Or did you fix it? In any case, from a theoretical viewpoint, I thought bb used the bb_user class regardless of integration.
We don't _need_ blog comments. Note that you can simply get rid of the wp comments form and prevent them. I did a lot of work (quite a long tiem ago now) to get a bb form in there, but a lot of globals need setting/spoofing and I eventually ran into difficulties.
Posted 1 year ago # -
The fix that I made to that function has been tested now and it seems to work, but the fact of the matter is that it could have very well just broke that function all together. I think everything works to my satisfaction now though, so I probably wont worry about it until I run into some more problems. The only thing that gives me hope in that respect is that previously, that
if statementwas failing. meaning that the user was not a bb_user:if ( !( is_object($user) && is_a($user, 'BB_User') ) )so it would create new capabilities for the user (incorrectly at that). But when I changed it to wp_User, for some reason that
if statementcatches and just returns without creating the new capabilities that break access permissions. I don't know why this works after looking into the code, but until I see negative side effects, I might turn a shy eye (<--- i dont think thats a real saying...).Also, on the topic of redundant database entries, I think since we have the integration set up from the WP comment box, it wouldnt be incredibly difficult to simply take out the one database call (somewhere in the wordpress code never-never-land) that actually posts the comment to the database. So we're not inputting a box from bbpress, but we would effectively stop wordpress comments from being saved to the database since we never actually look at them. This of course wouldn't work if you were merely copying database entries in order to post the comments as posts in bbPress, but I dont think thats what you're doing. It probably is two separate database
INSERTcalls, and I bet we can take the wordpress one out, and have identical functionality (assuming we took out wordpress comments and exclusively use felbbreplies()). It's merely an optimization though, and unless the user base is larger than any of us probably are going to have it might not matter... I'll look into it tonight when I get home, and let you know.sorry for the long post
-Alex
Posted 1 year ago # -
Strange that it's not catching if it's a BB_User. That does seem to be the actual class name. Do you want to do some more testing on that? Are users usually instantiated as wp_User if it's integrated? Or is it just if you set up the current user as bbSync does, from wp, that you get the user as a wp_User object? It's up to you, if you could check that and arising questions out I'd be grateful as I'm all over the place right now.
Thanks for your post, really! I feel a lot more confident about finding the solution now.
Posted 1 year ago # -
Actually, I figured out when in the felfunctions the "member" capability was being set (you may already know this) - line 36
I thought that maybe the globals should be changed to
global $bb_current_user;
instead of
global $current_user;That seemed to work when I was posting in wordpress as an admin, but I just tried posting with another user account and got an SQL error, so no dice. I have some other stuff to work on right now, but will come back to this later. Maybe the global $bb_current_user needs to be set to the $current_user instead of doing
bb_set_current_user( $current_user->ID );?
Posted 1 year ago # -
Lots of stuff to check on now. Didn't think of some of that, my normal users are probably messed up now... Ill get back on this later tonight, We'll figure it out fel. Thanks for the insight as well jazbek, ill take a look at that function...
-slex
Posted 1 year ago # -
slex, i just noticed that the code in my reply was screwed up and fixed it just now. i put a link to trac for the line where the user is being set, might want to re-read.
Posted 1 year ago # -
Thanks for the edit jazbek, ill try that next. It seems more like an actual fix compared to whatever I did. However, I still have failed to run into a problem with my "hack." All my users have the ability to make posts and comments, and all of my administrators can do the same. And now my administrators all keep their administrator status after making a wordpress post. I'm confused to why this hack even works, now that I look deeper into it... But I can't break it... idk what to do.
Posted 1 year ago # -
Jazbek, you may well be right. I believe my original reason for that code was that I ran into problems with bb not properly initialising the user and that $bb_current_user would not be set (hence, no posting either). However, if that fix works then I may well have made a mistake then (or in remembering). Would be lovely.
Posted 1 year ago # -
Yeah, I think that did it. I just tested a post as a regular user and it worked without any errors. I am short on time right now so if anyone else has a chance to try it out, that'd be cool. Here's all I did (all in felsyncpost()):
1) added
$bb_current_userto the globals
2) commented out line 36
3) added$bb_current_user = $current_user;in its place.Try it out. :)
Posted 1 year ago # -
Tested. Works. Good job Jaz... now I dont have to wonder how many months from now my hack would have caused a nuclear war in china.
And just for the sake of completeness. I did not test the case where a user is a blog writer (can write new posts), but is not some sort of administrator on the forum. I can't foresee needing this functionality, but if it doesnt work, dont get mad at me.
Database redundancy time?
Posted 1 year ago # -
EDIT:THIS IS NOT A VALID POST IT WAS USER ERROR (aka im dumb)
I may have spoke too soon. I dont know what caused it, but i lost all keymaster functionality. Nothing gets added to the database, but it doesnt recognize me as an admin. I even reverted back to old code, and keymaster has no "keymaster" capabilities, even though the database clearly shows the entry that says it does.
I'll let you guys know if I find out the problem. :(
Posted 1 year ago # -
Ok, I just had the wierdest 10 minutes of my life, but to sum it up, my server went crazy, along with some cookie problems, and then fixes for those problems caused others, but I got everything standing up straight again and made the change that jaz did, and everything works perfectly. I did new user registrations and admin posts and user and admin comments and admin registrations and changing of user types, as much as I could think of and I couldn't break it. So we are back to the green light, and God is playing tricks on me. Sorry if I scared anyone...
Posted 1 year ago # -
You didn't scare me, but you made me laugh.. :)
Posted 1 year ago # -
Nice one jaz. I'll try it (note that I never had this problem) and add it tonight I hope. Has anyone else had this problem, can they try it?
Hehe, slex, at least it's alright now. Do you actually know what caused your loss of privileges? It may be important.
Re. database redundancy, I'd say no. It's a one-time database hit and I feel somewhat better letting the comments actually sit in the database, so that once someone's had enough of bb or bbsync they still have _something_. But if you can code a neat implementation, I'll gladly branch the code.Posted 1 year ago # -
Looks good. No fatal error, and I was able to post. ^^ Also fixed a glaring oversight - unescaped text - but it makes me wonder if bb has a method for doing the whole shebang of creating a post from standard user input. Hmm. Should be nice now, though. Uploadin' now.
[Edit] Release μ.
Posted 1 year ago # -
I'm not sure what I'm doing wrong.
I filled out all of the proper synchronization options and everything registered correctly.
But when I go to migrate from bbpress post, I receive this error:WordPress database error: [Table 'db218346346.wp_bbpress_post_posts' doesn't exist] SELECT * FROM wp_bbpress_post_posts WordPress database error: [Table 'db218346346.wp_bbpress_post_posts' doesn't exist] SELECT * FROM wp_bbpress_post_postsHow do I fix this?
Thank you for your help!
Posted 1 year ago # -
Hey vitovarducci. Are you sure you had bbpress post installed? It doesn't look like you do now. Check whether any old posts you had synchronised through bbpress post are synchronised now. If they are, or you didn't have any synchronised, well, that's good. It's sorted. If they aren't, can you check your database (through phpmyadmin or similar) and looks for a table called wp_bbpress_post_posts? Also check that you actually activated bbpress post (don't if you hadn't).
Posted 1 year ago # -
I understand having "something" as far as saving the wordpress comments, but the fact is that only WORDPRESS comments will be saved. Since the forum holds the integrated comments of both, all the comments are relevant, but if you were to look just at the wordpress comments, they wouldn't make sense because if anyone replied to a message using bbpress, and had a conversation with someone on wordpress, we would only get half of the conversation. They are pretty much worthless, unless we can sync both database tables to store all comments, and in that case, we might as well just have a backup... unless you consider having potentially broken comments as a back up worth having, which I can see a case for, since alot of the information would be perfectly valid. But to me it seems like an all or nothing thing.
Posted 1 year ago # -
fel,
Thank you so much. I never even had bbpress post, I thought that this migration would create new topics for each already existing blog post.
But every time I try to create a new post, I receive this error:
Fatal error: Call to a member function on a non-object in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/functions.php on line 997The post is still created on the blog, but nothing happens in bbpress.
Is this an error on my part?
Also, is there any way to create the new topics for each already existing blog post?
Thank you so much for all your help.
Posted 1 year ago # -
Slex, indeed there's some issue there. It probably needs further thinking about. However, like I said if you want to modify it to stop wp saving comments, or even to make bb add replies to wp comments, implement the change and I would definitely like to make a branch of bbsync.
Vito, can you please open bb's config.php file and add this line to it somewhere?
global $bb_cache;
That should fix that error (assuming you're using the latest stable, .8.3!).No good news on making backdated topics I'm afraid, because there's no way to use the API to create the topic and set the time of it to be in the past. You'd have to copy and modify some large blocks of code, which is exactly what I want to avoid with bbsync (regarding the problem that became with bbpress post, for example).
However, if you edit an old post in wp and press save, it will create a new topic in bb for you (but with today's date, rather than the appropriate one). It's an unfortunate limitation of bbsync.Posted 1 year ago # -
fel, I just wanted to say that I have had a couple drinks tonight and I feel like maybe I sounded confrontational, but I was really just weighing pros and cons. I will check it out and help you make the branch, but I really love what you have done with the plugin. I'll post again after some sleep/sobering up. Have a great weekend man.
-Alex
P.S. Felix is an awesome name.
Posted 1 year ago # -
fel, do you think maybe you should add
global $bb_cache;to the bbsync.php file instead of telling everyone to add it to their config? wouldn't it work out of the box that way?Posted 1 year ago # -
Slex, you didn't, it's cool, and for the last week I have barely posted here without being rather drunk (since I usually see posts late at night when I come home). I did not know about you and I somewhat hope that you did not know about me. It is cool.
Jazbek, have you tried it? It has been a good half-year since I came up with the
globals solution, but even from a purely theoretical standpoint I don't see why it would work. The key issue is that bb-include files cannot access the globals, and declaring globals in some function in wp shouldn't change that. The only thing that seems like it could is the main code, ie. config.php.
Of course, perhaps I'm making something of a fool of myself and it would totally work. If you've tried it and it worked for you (meaning also that without theglobals code in bbsync.php you had fatal errors) then I'll check it out again. Cheers.Posted 1 year ago # -
hmm... I did it... but I get another error when creating new posts...
Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271 Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275 Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271 Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275 Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271 Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275 Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271 Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275 Warning: Cannot modify header information - headers already sent by (output started at /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php:271) in /homepages/28/d126493713/htdocs/cbusaffairs1/wp-includes/pluggable.php on line 341Sorry, I just don't understand the code well enough to figure it out myself... :(
Posted 1 year ago #
Reply »
You must log in to post.