Search Results for 'code'
-
AuthorSearch Results
-
July 19, 2008 at 3:10 pm #65924
In reply to: bbpress update soon?
_ck_
ParticipantNote that bbPress is not a finished final product. It’s pre-release and therefore in a state of flux. bbPress has always been a bit behind WordPress changes. If you are using bbPress, you are considered an “early adopter” and therefore you have to accept that things aren’t going to be perfect.
No one but maybe Sam or MDA can say when bbPress will have a release that’s 2.6 compatible. There is code in the trunk that supposedly will work but I wouldn’t recommend using the trunk. It has to be ported to the 0.9 branch and then tested. I suspect they may even wait for the 1.0 beta release and I don’t know if that’s two weeks away or two months away.
Again, there is nothing special about the WP 2.6 release – it only has a handful of extra features and no security bug fixes over 2.5.1 – in fact people are having a bunch of little problem with 2.6 still so why rush to upgrade? I was able to easily downgrade back to 2.5.1 with no problems.
July 19, 2008 at 3:40 am #66201In reply to: Administrator Recount
_ck_
ParticipantIt’s kinda (good) crazy but there’s actually a role key for “recount”.
update: you can make a plugin to give recount access – it will only work for those that can access admin panel
make this into a plugin:
<?php
/*
Plugin Name: Add Extra Caps
*/
function add_extra_caps($caps) {
$caps['recount'] =__('Access the recount administration panel');
return $caps;
}
add_filter( 'get_assignable_caps', 'add_extra_caps');
?>Install and activate it, edit their profile and check the ability for them. Then they should be able to access it.
You don’t even need to keep the plugin running after that, it can be deactivated/deleted until you want to take away the ability.
July 19, 2008 at 2:20 am #3643Topic: check out this very nice R-t-L Arabic bbPress
in forum Showcase_ck_
ParticipantI don’t know who set this up but they did a fantastic job:
Apparently they also shared their R-t-L/Arabic modification so others can get online with bbPress more easily:
http://code.google.com/p/bbpressar/
It’s a shame we don’t do unicode support for usernames.
Wasn’t someone looking at making a patch for that?
July 18, 2008 at 10:32 pm #66006In reply to: WordPress + bbPress Integration 101
_ck_
ParticipantSecurity considerations and table of contents added.
A bit more later.
Ragekage, to make a plugin, just copy all of the code for the function from pluggable.php inbetween the IF statemate and then edit as desired. Add the simple plugin comment header and save to your desired filename.
July 18, 2008 at 11:59 am #65920In reply to: bbpress update soon?
malfhok
MemberActually, I’ve been logged into both admins since I upgraded, and it hasn’t asked for my password since the initial upgrade. Any ideas why I’m seeing this “bug” and nobody else is?
Serious, though. Nobody take that as a sure sign that bbPress 0.9 works with WP 2.6. _ck_ knows more about bbPress than I do.
July 18, 2008 at 7:34 am #66003In reply to: WordPress + bbPress Integration 101
_ck_
Participant== Security Considerations when Integrated ==
If for some reason you are on a shared server that uses subdomains and you do not own/control the entire domain (ie. myblog.example.com johnsblog.example.com) or your URL has a tilde in it (“~”) ie. example.com/~myblog/ and you do not own the entire domain (ie. earthlink.com) my cookie advice above is not a good idea and you will have to customize – ask for help.
The reason why is related to some of the cookie changes in WordPress 2.6 – essentially cookies set to the
domain of “.example.com” will get transmitted to the server for ANY subdomain on the server (myblog.example.com will also see the cookies for johnsblog.example.com) The same thing goes for the cookie path in that cookies set to the path of webroot (“/”) will be sent to both example.com/~myblog/ as well as example.com/~johnsblog/ – malicious code on another subdomain or path could snoop on the cookies and steal your admin access to your blog/forum or pretend to be another user.
WordPress 2.6 (and a future version of bbPress) use separate cookies for admin access that can be locked down to very specific paths as well as different cookies for SSL access. This is an attempt to make sure that cookies which give admin access get transmitted as little as possible and only to the specific server/account that needs it so snooping hackers can’t spoof you.
Note this is only a concern if you do NOT control your own server (ie. other people can run PHP on YOUR domain name) or perhaps if you run a WPMU setup. Otherwise, setting the dotted cookie domain and webroot path is the simplest way to get integration cookie sync.
July 18, 2008 at 5:06 am #65998In reply to: WordPress + bbPress Integration 101
_ck_
Participant== The Shared User List (table) ==
The most essential concept to all integration is that WordPress and bbPress just share the same list of users in the database.
This is where some people make a mistake right at the start and accidentally create or keep using two separate copies of the user lists (usually one complete with many users and the other just themselves because it’s a fresh install of bbPress).
If you find that after your integrated install of bbPress that it cannot “see” any of your WordPress uses, you must check that bbPress is using both the correct DATABASE, and the correct TABLE.
The most common name for the user table is called WP_USERS
The WP_ is what we call the prefix and indicates that it’s part of WordPress by default. If bbPress is running by itself and not integrated, the prefix is likely BB_. Unless you are doing reverse integration and don’t want to change the table name, there is a 99.9% chance that your user table should be WP_USERS.
If your bbPress cannot see the WordPress users, check your “User database table prefix” in the bbPress integration admin menu OR add this to the bottom of bb-config.php
$bb->wp_table_prefix = 'wp_';
July 18, 2008 at 4:45 am #65995In reply to: WordPress + bbPress Integration 101
_ck_
Participant== Instant Integration for Power Users ==
If you’ve just installed bbPress 0.9 into a WordPress 2.5 website and followed the integration setup questions but it’s just not integrating correctly and you feel you are fairly web savvy you can try this “shortcut”. (Or read the other posts below for more “theory”.)
** If you have lost admin access entirely, do steps #4+ first and then come back to 1,2,3
1. open this url in a browser window to edit:
http://your-website-url.com/bbpress/bb-admin/options-wordpress.php
(/bbpress/ is your install directory for bbpress)
2. open this url in another browser window for reference:
http://your-website-url.com/wordpress/wp-admin/options.php
(/wordpress/ is your install directory for wordpress)
3. you MUST copy the secret text
from
/wordpress/wp-admin/options.php
to WordPress database secret
on
/bbpress/bb-admin/options-wordpress.php
They *MUST* be IDENTICAL
4. open to Edit
bb-config.php
in the bbPress directory5. open to Edit
wp-config.php
in the WordPress directory6. bbPress 0.9
the
define("SECRET_KEY","blahblahblah")
inyour WordPress
wp-config.php
MUST MATCH thedefine("BB_SECRET_KEY","blahblahblah")
inyour bbPress
bb-config.php
bbPress 1.0
instead of SECRET_KEY in 1.0 there are 3 replacements
AUTH_KEY
SECURE_AUTH_KEY
LOGGED_IN_KEY
you can go here to generate a complex secret_key(s):
bbPress 0.9: https://api.wordpress.org/secret-key/1.0/
bbPress 1.0: https://api.wordpress.org/secret-key/1.1/
(note you must add the BB_ part for the bb-config.php)
7. Copy all these items into the bottom of bb-config.php and edit as required:
$bb->wp_siteurl = 'http://your-site-url.com/blog/';
// that’s your WordPress URL, not bbPress
$bb->wp_home = 'http://your-site-url.com/blog/';
// almost always the same as siteurl unless you tinker
$bb->wp_table_prefix = 'wp_';
// should almost always be wp_ unless you tinkered
$bb->user_bbdb_name = 'username_wordpress';
// this is the MYSQL database name for *WordPress*
// you can copy it right out of WordPress !
$bb->user_bbdb_user = 'username_wp';
// this is the MYSQL user name for *WordPress*
// you can copy it right out of WordPress !
$bb->user_bbdb_password = 'blahblahblah-changeme';
// this is the MYSQL password for *WordPress*
// you can copy it right out of WordPress !
$bb->user_bbdb_host = 'localhost';
// 99.9% of the time it’s going to be localhost, unless you are on DreamHost or some other weird ISP
$bb->custom_user_table = 'wp_users';
// 99.9% of the time it’s going to be wp_users
$bb->custom_user_meta_table = 'wp_usermeta';
// 99.9% of the time it’s going to be wp_usermeta
$bb->authcookie = 'wordpress_12345678901234567890123456789012';
// in theory you should be able to leave this out
// but this is going to be copied from WordPress cookie
// this *must* match the WordPress setting
// do NOT use the 1234567 part, use your own cookiehash from WordPress – see the note at the very bottom
$bb->cookiedomain = '.your-domain-name.com';
// note the leading DOT – this is important
// this *must* match the WordPress setting
$bb->cookiepath = '/';
// I *highly* recommend you set the cookie path to /
// this *must* match the WordPress setting
$bb->sitecookiepath = '/';
// I *highly* recommend you set the cookie path to /
// this *must* match the WordPress setting
8. Copy all these items into the bottom of wp-config.php and edit as required:
$wp->cookiedomain = '.your-domain-name.com';
define(COOKIE_DOMAIN,'.your-domain-name.com');
// note the leading DOT – this is important
// we list both for WordPress legacy compatibility
$wp->cookiepath = '/';
$wp->sitecookiepath = '/';
define('COOKIEPATH', '/' );
define('SITECOOKIEPATH', '/');
// I *highly* recommend you set the cookie path to /
Once you get all of the above in sync, you definitely should have login integration between WordPress and bbPress. If not, you’ve either made a typo/mistake or you have a more complex setup (ie. reverse integration)
The hardest part of the above might be the wordpress cookie hash (authcookie). In theory you should be able to leave it out and bbPress should automatically create the same hash as WordPress if the secret keys and salt are the same but sometimes it gets it wrong for one reason or another and you have to force it to be correct.
Unfortunately WordPress does not list the cookie hash on the options page and if you don’t know how to examine your wordpress cookies, this is impossible. Fortunately there is a plugin to look at (and even change) your wordpress cookies:
http://www.2diabolos.com/blog/wp-content/uploads/_setCookieParams.zip
or you can use this bookmarklet to show all the cookies your browser has for a website:
July 18, 2008 at 12:09 am #65991In reply to: Adding bbPress to WordPress
724719
Inactiveok i found out how to put bbPress in WP . all i did was put this in wp-config.php:-
define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
require_once('path/to/bbpress/config.php');
?>…..But how do I show a list of the latest 5 topics ?
July 17, 2008 at 7:31 pm #65943In reply to: using bb_get_profile_link
parthatel
MemberThis is the warning that appears on the top of the page.
<b>Warning</b>: parse_url(/%3Ca%20href=%27http://mydomain.com/links/profile.php?id=2%27%3EView%20your%20profile%3C/a%3E) [<a href='function.parse-url'>function.parse-url</a>]: Unable to parse URL in <b>/home/domain/public_html/links/bb-includes/functions.php</b> on line <b>1794</b>
This is what the My Profile link links to:
http://mydomain.com/%3Ca%20href='http://mydomain.com/links/profile.php?id=2'>View%20your%20profile</a>
July 17, 2008 at 4:14 pm #65835In reply to: Infinite Loops on posts and profiles with IIS
_ck_
ParticipantI have a crazy idea to try to “fake out” bbPress and make it think request_uri actually exists on the IIS server so it doesn’t try to (incorrectly) calculate it itself.
Try saving and installing this as a plugin with a leading underscore, ie.
_IIS-fix.php
<?php
/*
Plugin Name: IIS request_uri fix
*/
if (isset($_SERVER['HTTP_REQUEST_URI'])){
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REQUEST_URI'];
}
else{
if(isset($_SERVER['SCRIPT_NAME']))
$_SERVER['HTTP_REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
else
$_SERVER['HTTP_REQUEST_URI'] = $_SERVER['PHP_SELF'];
if($_SERVER['QUERY_STRING']){
$_SERVER['HTTP_REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REQUEST_URI'];
}
?>no activation required, should auto-activate – just delete if it causes problems
July 17, 2008 at 3:44 pm #65834In reply to: Infinite Loops on posts and profiles with IIS
_ck_
ParticipantI’m taking a look at this now for what it’s worth.
Not sure if I’ll be able to help but let’s see.
IIS is sending a refresh header:
Refresh 0;url=http://www.louisecooper.com/journal/messageboard/topic.php?id=20
content length is zero, so nothing is being sent
Apparently IIS returns “request_uri” differently than other servers. I suspect it’s a similar problem to what they went through with drupal here: http://drupal.org/node/166095
Unfortunately it’s way over my head to fix. I suspect it will take someone like MDA to fix it.
July 17, 2008 at 3:03 pm #65969In reply to: Why is integration so troublesome?
755833
InactiveWell I fixed it, if anyone (incl. developers) are interested. Unfortunately it requires modifying a line of core application code…
pluggable.php in bb-includes
Line 502
$bbdb->insert( $bbdb->users,
compact( ‘user_login’, ‘user_pass’, ‘user_nicename’, ‘user_email’, ‘user_url’, ‘user_registered’ )
);
Replace with
// bbPress / WordPress bug fix added display name to wordpress
$display_name = $user_login;
$bbdb->insert( $bbdb->users,
compact( ‘user_login’, ‘user_pass’, ‘user_nicename’, ‘user_email’, ‘user_url’, ‘user_registered’, ‘display_name’ )
);
July 17, 2008 at 2:38 pm #65968In reply to: Why is integration so troublesome?
_ck_
ParticipantIf you are getting anonymous users, I suspect you haven’t setup integration properly and they are not sharing the same user table.
As far as your other observations (and I felt he same way in the beginning too) you have to realize that (easy) integration was only a priority starting with 0.9
(you can see how complicated the process used to be under 0.8 here – note most of that is not needed now)
Until 0.9, bbPress was just something that ran wordpress.org for Matt and there was no attitude to make integration work. There were tons of problems with usernames etc. and all integration had to be done manually with lots of plugins to fix things.
Then attitudes changed when Matt got funding and decided to use the bbPress code to power TalkPress (essentially forums for users on WordPress.com) Sam and MDA have done a great deal of work to make integration work better but it definitely has a way to go (and should become painless and super-easy IMHO).
So 0.9 has made integration easier but keep in mind bbPress is not even 1.0 yet, so officially it’s not even a released product. The radical cookie changes in 2.6 will take awhile for bbPress to catchup, it’s always been that way.
ps. if it’s not obvious, I am in no way officially associated with Automattic/WordPress/bbPress. Just a plugin developer. And I am not paid. My opinions are definitely just my own and not any kind of official statement.
July 17, 2008 at 2:21 pm #65799In reply to: Integration Problems Now Can’t log in at all.
chrishajer
ParticipantGoing back to the first post, what does this mean:
the db's fine but erased by login information
It seems that the installation went well, you just need to figure out what user to log in with. If you can’t do that, why not register a new user with your email address. (Check the wp_users table now for the last id, and then after you register, make sure you look for the new id.) It will get the normal permissions of a member, then go into the database and modify that user’s meta info to give them moderator permissions? Then log in with as that user?
July 17, 2008 at 1:30 pm #3638Topic: Why is integration so troublesome?
in forum Troubleshooting755833
InactiveI’m not meaning to be rude or anything but I’m struggling to understand why two bits of software made by the same company are so hard to integrate? I’ve never managed to get integration working fully and I always get to the point where users who registered through the forum post on the WordPress blog show up as Anonymous… which basically renders the whole process pointless. I’ve managed to get WordPress and vBulletin to integrate seamlessly, but not bbPress.
bbPress and WordPress are both great pieces of software in their own right, but when it comes to integration with each other they are pretty weak. For example, the new bbPress isn’t compatible with WordPress 2.6 because of an issue with cookie management in WordPress… for the integration to work we now have to wait for bbPress to release an update which according to a moderator on here will be a while away.
There are also so many unsolved integration threads here that it’s very difficult to find any one collection of possible solutions. I appreciate the amount of work that goes into this kind of software and time required to provide support. I’m just feeling a bit frustrated
July 17, 2008 at 6:57 am #3637Topic: Hiding Subforums’ Subforums from Subforum Pages
in forum Installation755628
InactiveHi.
This is an extension of this question: http://bbpress.org/forums/topic/hiding-subforums-on-the-homepage#post-11761
My forum has forums, subforums, and then subforums of those subforums. Basically, there are three levels of forums.
I was able to hide the subforums from the main forums page. But how do i hide the subforums’ subforums from the subforums pages, so that the visitor must click on the subforum to view the subforums’ subforums.
I would really appreciate any help on this matter. I am not good at coding so it would be wonderful to get assistance!
July 17, 2008 at 1:58 am #65887In reply to: Show (gr)avatar on frontpage
_ck_
ParticipantOf course you can do it, bbPress can do almost anything – as long as you code it
Showing the gravatar is the easy part, the code to fetch the latest poster and their email address is the tricky part. How’s your mysql?
Showing a gravatar for any email address is as simple as:
<img src="<?php echo "http://www.gravatar.com/avatar.php?gravatar_id=".md5($user->user_email); ?>" >
The mysql code for the email of the last poster is going to need a left join of the users table against the post table and more than I am willing to do right now. I suppose I could be lazy and use
get_latest_posts(1, 1)
to fetch the entire info the last post and grab the email address from there.July 17, 2008 at 1:27 am #65941In reply to: using bb_get_profile_link
parthatel
MemberI tried that and this is what I get as the url of the link:
http://mydomain.com/%3Ca%20href='http://mydomain.com/links/profile.php?id=1'>View%20your%20profile
July 17, 2008 at 12:14 am #65231In reply to: Top 100 listings
_ck_
ParticipantRight now I have it simply by number of posts which of course is not an indication of quality by any real means but easiest way for me to track.
There’s also the top 1000 list where I try to track everyone.
It’s not a contest, no-one wins anything, and it’s completely unofficial, so don’t worry about it
July 16, 2008 at 11:35 pm #65938In reply to: Registering with another users email ???
_ck_
Participantnv1962, it would be a good plugin to learn/practice from. Roughly 3-5 lines total. Essentially you’d add an action to bb_send_headers and just like my plugin above, if the bb_get_location==”register-page” you echo the redirect header for the wordpress page (and then do a die() so no other code can execute until it redirects).
July 16, 2008 at 11:29 pm #65940In reply to: using bb_get_profile_link
_ck_
ParticipantbbPress functions with the word “get” in them do not self-echo, they simply return the string. So you have to add echo. You almost have it, for example, this should work:
<a href="<?php echo bb_get_profile_link(); ?>">My Profile</a>
And just to confuse you, there are a couple of legacy functions with the word “get” in them that do echo. But they shouldn’t and are rare so don’t worry too much, lol.
July 16, 2008 at 11:22 pm #65936In reply to: Registering with another users email ???
_ck_
ParticipantWell login integration is not as important as the register part. As far as your instructions, I wouldn’t recommend deleting the contents of a core file but the redirect part is okay.
It occurs to me, it’s actually possible to redirect the register page in bbpress to the wordpress side via plugin with no edits required anywhere.
Remember that bbPress registration process should catch up to the WordPress side eventually. In fact I like it’s layout better but WordPress’s is more mature code-wise.
July 16, 2008 at 11:07 pm #65934In reply to: Registering with another users email ???
_ck_
ParticipantYes, this is why I always recommend to people when integrating with WordPress that they redirect all login and registration links to the wordpress side. It’s had years of development in that area.
In any case, here is a simple plugin to prevent duplicate email addresses. Unfortunately bbPress has no way to place custom error messages on the page without template hacking but this should do:
<?php
/*
Plugin Name: no duplicate email addresses
Author: _ck_
*/
if ($_POST && bb_get_location()=="register-page") {add_filter('bb_verify_email','no_duplicate_email');}
function no_duplicate_email($email) {
if ($email) {global $bbdb; if (!$bbdb->get_row($bbdb->prepare("SELECT * FROM $bbdb->users WHERE user_email = %s", $email))) {return $email;}
else {add_action('bb_foot','no_duplicate_email_alert'); return false;}}
}
function no_duplicate_email_alert() {echo "<scr"."ipt>alert('".__("email address already registered")."');</script>";}
?>(bbPress 0.9 or higher required)
July 16, 2008 at 11:00 pm #3634Topic: using bb_get_profile_link
in forum Installationparthatel
MemberHow do I make a link that directs the user to their profile?
The default code in bbPress is
<?php printf(__('Welcome, %1$s!'), bb_get_profile_link(bb_get_current_user_info( 'name' )));?
.Yet if I use this, the name of the user will be the linked text. Also, I’m not able to use this code alone. If I try:
<?php bb_get_profile_link(bb_get_current_user_info( 'name' )); ?>
…it doesn’t work. I also tried:
<a href="<?php bb_get_profile_link(); ?>">My Profile</a>
How can I change the text to My Profile and also let it stand alone? (standalone meaning on its own paragraph and with no Welcome, %1$s!)
-
AuthorSearch Results