Search Results for 'code'
-
AuthorSearch Results
-
June 3, 2010 at 3:37 pm #89110
In reply to: s2member integration
kevinjohngallagher
MemberOh for the love of @****
Apparently bbPress, in it’s infinate wisdom, is now turning every tag opening and closing, even those in and backticks and [blockquote] into screen written &gt.
I wouldn’t mind if the damn thing would write the HTML as &gt so it at least looked right on the screen, but no…
I’ll try and cope and paste it into a paste bin thing for you wood2695
Grrrrrr
[code] and backticks and [blockquote] into screen written &gt.
I wouldn’t mind if the damn thing would write the HTML as &gt so it at least looked right on the screen, but no…
I’ll try and cope and paste it into a paste bin thing for you wood2695
Grrrrrr
June 3, 2010 at 3:34 pm #89109In reply to: s2member integration
kevinjohngallagher
MemberRighty ho, so while I can’t test my code (on iPhone sorry), I can help shed some more light on this.
First Off: there is not (that I can see) a table called wp_capabilities. There is just a meta_key called “wp_capabilities” in the wp_usermata table. That actually makes some sense
The good news here is, that it’s a 1 to 1 relationship so easy to copy over.
// Show Database Errors
// Comment this line out when going live

$wpdb->show_errors();
// 99 times out of 100 this is overkill
// I’m just being on the safe side
//
// It checks what the current user ID is
if ( !$user_id ) {
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
} else {
$user_id = (int) $user_id;
}
// Connects to the database
// Retrieves the value for this user for wp_capabilities
$user_cap = $wpdb->get_row( “SELECT meta_value FROM wp_usermeta WHERE user_id=$user_id AND meta_key=’wp_capabilities’ LIMIT 1” );
// Checks to see if the user already has a bb_capabilities
// If it does we’ll overwrite it
// If it doesn’t we’ll add a new one.
$user_cap_in_bb_meta = $wpdb->get_row( “SELECT meta_value FROM bb_usermeta WHERE user_id=$user_id AND meta_key=’bb_capabilities’ LIMIT 1” );
if ($user_cap_in_bb_meta)
{
// update bbPress database
$wpdb->query(“UPDATE bb_usermeta SET meta_value='”. $user_cap->meta_value .”‘ WHERE user_id=”. $user_id .” AND meta_key= ‘bb_capabilities’ “);
} else {
// Add a new row to the bbPress database
$wpdb->query(“INSERT INTO bb_usermeta (user_id, meta_key, meta_value) VALUES (“. $user_id .”, bb_capabilities, ‘”. $user_cap->meta_value .”‘) “);
}
// Print all Database errors
// Comment this line out when going live

$wpdb->print_error();
// Hide Database Errors
// Comment this line out when going live

$wpdb->hide_errors();
Now, the disclaimer. This rather unsurprisingly hasn’t been tested by me, and my contain (will contain) a crazy amount of typos.
What it does is relaly simple. It copies the wp_capabilities and pastes them as bb_capabilities in the bbpress table. In terms of your initial goal, firing this code once the s2M stuff is finished will achieve that goal (basically, copy and paste it on the landing/finished/thanks/congrats page).
A quick word of warning. If you’ve been using Zaerl’s plugin or anything else that utilises the “bb_capabilities” meta_key then this will overwrite it. Now as it’s overwriting it with whats in the WordPress database, it’s very unlikely to cause issues.
But if you’ve set up something funny with a bbPress Plugin then you might end up overwriting it. In theory, this shouldn’t happen because the user is registered via s2M, so that’ll be it’s first time in the bbPress database – but I’m just giving you a heads up.
I may write this, with all the failsafe functionality, into a WP/bbPress plugin if I get time in a few weeks. But I’m also a tad wary of encroaching onto ground Zaerl’s been excelling in. Good code doesn’t need my size 13s stomping all over it.
Ok mate, try this and throw me back any errors.
June 3, 2010 at 2:08 pm #89163eschickel
MemberFull re-install after dropping tables fixed it. Thanks for the help everyone!
June 3, 2010 at 1:53 pm #89108In reply to: s2member integration
wood2695
MemberIf 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.
June 3, 2010 at 1:49 pm #87816In reply to: Whoa! (bbPress.org 2.0 is live)
mr_pelle
ParticipantBut then, the code in this post is fine:
Maybe the previous one was edited and that’s where the trouble started?
My post had GT LT replacement too, I had to edit it and remove the php tags… but this is not a solution, because there are post in which you cannot remove the tags, as https://bbpress.org/forums/topic/internet-explorer-problem-1?replies=8#post-69386
June 3, 2010 at 1:35 pm #89107In reply to: s2member integration
kevinjohngallagher
MemberI’m sadly on an iPhone so not in a position to knock out code.
I’ll throw something together later today that should help.
June 3, 2010 at 1:12 pm #89106In reply to: s2member integration
wood2695
MemberRight. 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.
Cheers bud.
June 3, 2010 at 12:29 pm #87815In reply to: Whoa! (bbPress.org 2.0 is live)
kevinjohngallagher
MemberYeah, If you edit with CODE in place it causes issues.
Before hand we just used to put code in BLOCKQUOTES, but now it’s got that daft graphic it’s not helpful at all (imo).
June 3, 2010 at 12:26 pm #89079In reply to: Internet Explorer problem
kevinjohngallagher
MemberMaybe
Codejust doesn’t like me
Thanks for trying to fix this Chris
June 3, 2010 at 12:25 pm #89105In reply to: s2member integration
kevinjohngallagher
Member<br />
<pre><code>// Line 358 if ($ccaps) /* Add custom capabilities. */
foreach (preg_split ("/[rnts;,]+/", $ccaps) as $ccap)
if (strlen ($ccap)) /* Don't add empty capabilities. */
$user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));It’s the ” $user->add_cap ” That adds the capabilities to wordpress.
That said, I think the best thing to do would be to follow this:
1) Select * from wp_capabilities where User_id = User_id
2) for each ($row) insert into bb_capabilites blah blah blah
that way you don’t need to know what the s2M is doing, you just need to copy the data from wp_cap to bb_cap when you’re done
June 3, 2010 at 12:12 pm #89104In reply to: s2member integration
wood2695
MemberThat 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[0])))<br />
{<br />
$processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */<br />
/**/<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.
June 3, 2010 at 11:55 am #87814In reply to: Whoa! (bbPress.org 2.0 is live)
chrishajer
ParticipantBut then, the code in this post is fine:
Maybe the previous one was edited and that’s where the trouble started?
June 3, 2010 at 11:49 am #87813In reply to: Whoa! (bbPress.org 2.0 is live)
chrishajer
ParticipantCheck how backticks and work to format a post.
https://bbpress.org/forums/topic/internet-explorer-problem-1?replies=8#post-69386
Was initially written with backticks, and rendered as GT and LT, so I tried to edit it to replace backtick with [code] but it’s still messed up.
Someone mentioned that re-editing also introduced paragraphs or breaks, IIRC. When I first edited the post, every line of code and a [BR] after it.
[code] work to format a post.
https://bbpress.org/forums/topic/internet-explorer-problem-1?replies=8#post-69386
Was initially written with backticks, and rendered as GT and LT, so I tried to edit it to replace backtick with but it’s still messed up.
Someone mentioned that re-editing also introduced paragraphs or breaks, IIRC. When I first edited the post, every line of code and a [BR] after it.
[code] but it’s still messed up.
Someone mentioned that re-editing also introduced paragraphs or breaks, IIRC. When I first edited the post, every line of code and a
after it.June 3, 2010 at 11:47 am #89078In reply to: Internet Explorer problem
chrishajer
ParticipantOf course in my post worked fine. Argh. See it working above?
[code] in my post worked fine. Argh. See it working above?
June 3, 2010 at 11:46 am #89077In reply to: Internet Explorer problem
chrishajer
ParticipantBackticks and
did not work for formatting Kevin's post. I tried to fix it. Really I did.Basically, remove the top three lines of the file (header.php?), and the last line (footer.php?).
June 3, 2010 at 11:27 am #89102In reply to: s2member integration
wood2695
MemberAnd 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.
Thanks.
June 3, 2010 at 11:17 am #89101In reply to: s2member integration
kevinjohngallagher
MemberNah that sounds good mate. It’s basically what I was suggesting here:
2) Write some custom code for the s2Member callback API (which it supports) to add a field to the bbPress database.
Basically, what you want to do is look for the bit of code in the s2M files that writes to the wp_capabilities table, and copy it on a new line with bb_capabilities.
Or if you don’t want to go hacking around (totally understandable), make your “landing page” when people finishing paying/signing up via s2M have a bit of code that copies the last row from the wp_capabilities into bb_capabilities. This method means you wouldn’t have to touch the core of WP/bbP/s2M – but would still work.
Doesn’t matter that this isn’t a core question mate, you’re helping us break a bit of new ground here, and we’re always interested in that. bbPress isn’t feature rich, so we like to know when it’s bene extended in a way we all hadn’t thought of
And you’re polite – we like that
June 3, 2010 at 10:36 am #89161kevinjohngallagher
MemberHi Guys, thanks for the info. It’s always good to rule things out

Basically, I’d attempt the following:
1) Log out of wordPress and clear your cookies and cache.
2) Upload and overwrite your existing files with a newly dowloaded version of bbPress
3) If that doesn’t work, set all permissions to 777 and see if it makes a difference.
4) If that doesn’t work. start again with the new files.
I know it sounds annoying, and sorry, but at this stage we’re just covering the bases.
Oh, could you also tell us what server host you’re using?
Thanks !
June 3, 2010 at 10:31 am #89076In reply to: Internet Explorer problem
kevinjohngallagher
MemberOk found the reason why.
This site works best in Google Chrome.
<div id="container">
<title>theCollegehunt-Best colleges,Best coaching classes,Career guidance,Examinations,Examination papers,College romance,College dating</title>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>theCollegehunt</title>
Basically you need to remove
<div id="container">
<title>theCollegehunt-Best colleges,Best coaching classes,Career guidance,Examinations,Examination papers,College romance,College dating</title>
and the bottom DIV
</body>
</html>
</div> <
REMOVE THIS ONEJune 3, 2010 at 10:26 am #88917In reply to: WordPress Header on bbpress
mr_pelle
ParticipantI use this in my template:
global $is_bb;
$is_bb = true;
get_header(); // call WP's header$is_bb = true;tells WP that current page is a bbPress page. If you need to load different content depending on that, just use:if ( $is_bb ) {
// bbPress-related code
} else {
// WP-only code
}June 3, 2010 at 10:13 am #87812In reply to: Whoa! (bbPress.org 2.0 is live)
mr_pelle
ParticipantPlugins directory not updating: Fixed.
Seems it’s not retroactive… I mean, Zaerl’s last plugins are now listed correctly, but all other plugins did not get updated (yet): it looks like my last plugins update was a month ago!
June 2, 2010 at 9:19 pm #89075In reply to: Internet Explorer problem
chrishajer
ParticipantIf that’s it, it’s always good to start by making sure the code is valid. My guess is there is a closing div missing or otherwise invalid code.
http://validator.w3.org/check?verbose=1&uri=http://www.thecollegehunt.com/
June 2, 2010 at 8:08 pm #89158eschickel
Memberlooks like my error logs were disabled.
i guess i can drop my tables and reinstall, but i’m certain i didn’t do anything wrong during the install.
June 2, 2010 at 6:47 pm #89156rickkettner
MemberThanks for the reply!
1. WP 2.9.2
2. Just bbPress with new install of WP… nothing else.
3. Yes, using PHP5
4. I just went through the steps in the BB install. Was going to do the rest in the bb admin, but can’t get there.
5. Not sure where to look for the error log
June 2, 2010 at 4:24 pm #89033In reply to: OneMoreThing.nl
kevinjohngallagher
MemberI doubt anyone needs to release it as a theme, it’s just a custom front page (although a good one for sure).
It just loops through Categories / Forums and then outputs the last topic and last post for each forum with it’s gravatar next to it. The code to do it yourself is already in front-page.php
( I say that without taking away from the excellent work done by lukepuuk and others on the theme )
Exit mate, If you want your bbPress to be/act different than all the others, you’ll have to change more than the CSS/Background. But realistically you don’t need much/any plugins to enable your forum to be unique while staying cool and usable
-
AuthorSearch Results