Forum Replies Created
Hey drcoach. Hoping it might help you, I’ve dumped my edits into pastebin to avoid the bbPress forum’s reformatting. I’ve also added a few placement notes. http://pastebin.com/uZwUJCtA
Only 2 things that I could think of (with my limited knowledge of it all) is:
1) Is your setup a “deep integration” of WP+bbP?
2) The code that I said to add included some stuff that was already there (I guess “edit” would have been a better term). Only the “strong” code was the addition. The code I placed on pastebin includes notes on existing and unchanging lines and what & where to add. (sorry if you already understood that, I’m just trying to think of mistakes I might have made)
I hope that helps and good luck!
Aw crap. Same issue that kev was running into earlier, where the forum is turning all “greater than” characters into $gt. So all those “=&gt”s above should read…
(equal sign + greater than sign)
Pain in the…
Okay kids, here’s the solution that I’ve landed on. First, major props to kevinjohngallagher for taking the time to work this out with me. Second, the solution that I’ve come up with is not based on the previously mentioned code. I believe the code that kev had theorized was based on a flow of how s2M handled the end of the registration that wasn’t entirely correct (ie. no actual ‘thank you’ page). Perhaps this was something that could have been set up as such, but I abandoned that for another train of thought, which was… “if bbPress is reassigning bbP-specific roles based on the standard WP roles, so why can’t it do it for other non-WP-specific roles??”
So to accomplish this, I’ve made edits to two core bbP files. As kev said to me and I agree… “Usual disclaimer about editing the core blah blah blah.” This will likely need to be re-done again if/when I ever update bbPress, but for the time being, it is working splendidly. With all that said, I may be the only one trying to do this integration, but for anyone down the road that is trying to develop a member site with s2Member + WordPress + bbPress forum, here’s my solution (oh, and also based on a ‘deep integration’ of WP/bbP)…
in /bb-admin/options-wordpress.php, I added
$wpRoles = array(<br />
'administrator' => __('WordPress Administrator'),<br />
'editor' => __('WordPress Editor'),<br />
'author' => __('WordPress Author'),<br />
'contributor' => __('WordPress Contributor'),<br />
'subscriber' => __('WordPress Subscriber')<strong>,<br />
's2member_level4'=> __('s2Member Level 4'),<br />
's2member_level3'=> __('s2Member Level 3'),<br />
's2member_level2'=> __('s2Member Level 2'),<br />
's2member_level1'=> __('s2Member Level 1')</strong><br />
and then in /bb-includes/functions.bb-users.php, I added
static $wordpress_userlevel_map = array(<br />
'administrator' => 10,<br />
'editor' => 7,<br />
'author' => 2,<br />
'contributor' => 1,<br />
'subscriber' => 0<strong>,<br />
's2member_level4'=> 0,<br />
's2member_level3'=> 0,<br />
's2member_level2'=> 0,<br />
's2member_level1'=> 0</strong><br />
Because again, as far as the forum is concerned, I’m only really interested in differentiating whether a user is a logged-in member or not and show/hide the forums/topics/whatever using the zearl Visibility plugin based on that.
This maps all s2M roles to that of a member in bbPress. Roles may then be changed using the dropdowns in bbPress > Settings > WordPress Integration.
Hey man, I’m still with ya here. Gimme a few to digest and implement. I’ll post with developments, but in the meantime THANKS FOR YOUR TIME.
If you did that, I would be humbly in your debt. Though I won’t hold it against you if you don’t have the time to solve my problems
FWIW… I’ve found at least one other individual over on the s2M forum that could probably benefit from the solution. At least I know I’m not alone!
Your help is much appreciated.
Right. Of course! Seriously, I’m afraid I’m totally lost. I understand your logic, but my lack of PHP skills are shining bright. I’m an art director that had (until now) been successful hacking at standard WP PHP, but am clearly in over my head now. “Select the whozit and insert it into the whatzit now?”
You’ve been very kind and I’ve never been one to straight up ask for the answer to be spelled out for me. I understand if you don’t want to give up any untested/theoretical code, especially as it pertains to a 3rd party plugin. (unless your last suggestion was to code that elsewhere??) But I do find myself against a deadline and have got to continue adding content and styling or my client is gonna kill me! Believe me, I’d rather work on solving problems all day so I can learn from them.
So, I guess I’m going to have to launch this weekend (client has a conference) and just manually change bbPress user roles on new subscribers (lo-fi and lame, by me) until I have more time next week to dedicate to this solution.
That helps. This seems to be the code that is placing the custom user role into the wp_capabilities (from register-access.php, for ref). I suppose I could amend this to make all s2M members simply a “subscriber” which would serve my immediate needs (in theory). But I’d prefer to keep the custom roles for later down the road.
else if (is_admin () && preg_match ("/wp-admin/user-new.php/", $_POST["_wp_http_referer"]) && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles)))<br />
$processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */<br />
$level = ($role === "subscriber") ? "0" : preg_replace ("/^s2member_level/", "", $role);
What I can’t figure out is how to add to this a bb_capabilities row/value.
And you’re darn quick on the reply… I LIKE THAT!
Lemme poke around for what you suggested. I’ve tried looking for those a bit, but they’re clearly not coded as clear as “wp_capabilities”. I’ve found the labels for the roles that I suspect might be where it’s generating the table data, but don’t see the code that specifies where to populate it. Even then, I see no mention of the table prefix (wp_) so I’m not sure that if I even found capabilities, I’d know how to add a bb_capabilities.
My gut says that the hack to the s2M files is the way to go, so I’ll keep looking there.
Well I’ve spent a day on this that I didn’t have to spare and have come up with nothing. So I’m crying mercy. Admittedly, this is over my head.
KJG- while your solutions sound plausible (though I haven’t really found out where to start) I had another guy suggest that I try just making s2M fill bbPress roles while it creates roles for itself for a particular user. To my untrained ear, this seems like a simpler and more direct solution.
Perhaps I’m wrong there and still don’t really know where to start with that, but I see in my wp_usermeta that users added through WP have wp_capabilities and bb_capabilities, but a user added through s2M doesn’t have any bb_capabilities (duh!). So, how can I add that to the table when it’s adding it’s own custom wp_capabilites? Or KJG, is that the gist of what you were suggesting, only handling that on forum load rather than the initial table creation?
I realize that is more of a plugin functionality support question, but I’ve not heard back on the s2M forum and methinks they have other priorities there while ramping up for a pro version launch.
So this is a plea to anyone that might catch this thread and know what they’re doing with user role tables. I’m stumped. Much appreciated.
Heh, thanks. If I’m understanding you correctly, then I’m ahead of you on the basic forum functionality… I do have Zaerl Visibility plugged in (and working wonderfully) and that’s why my task-at-hand is mapping all the s2M roles to that of bbPress Member within bbPress. I don’t think I’m too far off here, just a bit out of my experience, but I’m up to the challenge.
I do find it funny that I’m the first to inquire about this. Not that I’m surprised, by the lack of results on some searching. But I love bbPress and s2Memeber seems like a very solid and well supported plugin (and free doesn’t hurt!)
And sadly, I don’t know my way around querying tables, but I’ll figure it out. Quite simply I want any s2M role to be mapped to a general member role (in bbPress) as I’ve set the forum up to only be different if you’re a logged-in member or not. Currently all s2M roles come in to bbPress as Inactive (no role).
Thanks again for your input. I’ll post a solution here if/when I find it.
Thanks for the quick response. I’ve already done the deep integration, so I’m partially there on number 1, I guess. I’ll look into how to accomplish your suggestion before I ask you to hold my hand
At the same time, if you’ve got a link/resource that might point me in the right direction, that would be sweet too.
Thanks man.In reply to: Reverse the display of the messages