Search Results for 'code'
-
AuthorSearch Results
-
July 11, 2007 at 12:33 pm #57788
In reply to: Just launced – integrated with WPMU
ylcncn
Memberwow nice site
July 11, 2007 at 12:07 pm #58851In reply to: version installs but has done some very bad things
retrospec
MemberHello,
The fault was found and suggested to me at wordpress forum and it is due to magic quotes runtime being turned on.
I’d strongly recommend as an interim you modify your installation instructions to state clearly that magic quotes runtime should be turned off for the software to work.
And for any future stable/svn release you should perform a check on magic quotes and code around this issue.
Neil.
July 11, 2007 at 7:43 am #58919In reply to: (request) remember me plugins?
_ck_
ParticipantI bet they mean like in wordpress where the cookie will be set for a year instead of a week?
What’s the bbpress cookie default, I’ll have to go look at the code.
I get around this problem by forcing the wp login from everywhere.
There was another request for this feature here:
https://bbpress.org/forums/topic/remember-me-option-at-login?replies=3
July 11, 2007 at 6:22 am #2080Topic: Plugin: Recent Posts (kinda like the “edit comments” in WP)
in forum Plugins_ck_
ParticipantThis is so simple I bet I am duplicating what someone else has already done. I am not sure why this isn’t in bbPress by default and it doesn’t even begin to address what I would consider basic moderation tools but it’s a start.
Install and check under “content” submenu. Why the posts menu =deleted posts in bbpress’s default I have no clue.
<?php
/*
Plugin Name: bbPress Recent Posts
Plugin URI: http://bbpress.org/plugins/
Description: shows most recent posts with (extremely limited) moderation options
Author: _ck_
Author URI: http://CKon.wordpress.com
Version: 0.01
*/
function recent_posts_admin_page() {
if ( !bb_current_user_can('browse_deleted') ) {die(__("Now how'd you get here? And what did you think you'd being doing?"));}
global $bbdb, $bb_posts, $bb_post, $page;
$bb_posts=get_latest_posts(0,$page);
$total = bb_count_last_query();
?>
<h2>Recent Posts</h2>
<ol id="the-list">
<? bb_admin_list_posts(); ?>
</ol>
<?php echo get_page_number_links( $page, $total );
}
function recent_posts_admin_menu() {
global $bb_submenu;
$bb_submenu['content.php'][] = array(__('Recent Posts'), 'use_keys', 'recent_posts_admin_page');
}
add_action( 'bb_admin_menu_generator', 'recent_posts_admin_menu' );July 11, 2007 at 4:48 am #58771In reply to: rebuilding topics DB
fel64
MemberIf you use
$bbdb->usersyou should get the appropriate table name instead.July 11, 2007 at 3:55 am #58770In reply to: rebuilding topics DB
_ck_
Participanttested working – at least for my setup:
function rebuild_topics() {
global $bbdb;
// currently only rebuilds last post pointers, last poster name, last poster id, last topic post date
// todo: rebuild entire topics table
// warnings: hard coded for WP user table - backup your DB before using
// run the built-in post/topic recount first
echo "t<br>n";
if ( $topics = (array) $bbdb->get_results("SELECT topic_id,post_id,poster_id,post_time FROM <code>bb_posts</code> a WHERE post_position=(SELECT MAX(post_position) FROM <code>bb_posts</code> WHERE topic_id=a.topic_id) AND post_status = '0' GROUP BY topic_id ") ) :
echo "tt" . __('Calculating last posters for each topic...') . "n";
foreach ($topics as $t) {
echo $t->topic_id."... ";
$user_login=$bbdb->get_var("SELECT user_login FROM wp_users WHERE ID='$t->poster_id'");
$bbdb->query("UPDATE $bbdb->topics SET topic_time='$t->post_time',topic_last_poster= '$t->poster_id', topic_last_poster_name='$user_login', topic_last_post_id='$t->post_id' WHERE topic_id = '$t->topic_id'");
}
endif;
echo "<br> tt" . __('Done calculating last posters.');
}fel64
MemberI think that the
capabilitiesentry is wp’s capabilities entry. Does that refer to the member id you have when you publish a post?(Hmm, bum)
There are duplicate topics made? That’s interesting. Can you check bb_topicmeta to see if it’s added anything there? It should have done.
The error in line 275 arises directly because of the error in line 271, so it can be ignored for now
wduluoz
MemberOk.
The warning prints every time I post or save. I realize it doesnt actually crash the website, but that warning is the only thing that appears.
This is what is inserted into the user_meta. Its inserted when published or saved. It doesnt seem to be duplicated again after I save it if its already in there, but if I delete the listing, then it is re added
capabilities a:1:{s:6:"member";b:1;}oddly enough it is not putting the bb_ in front of capabilities which may be a clue to whats happening.
(I dont have $bb_roles in the config.php)
Also a new post is put in bbpress each time it syncs.
From what I gather: line 275 of capabilities.php is looking for an array to loop through which should have the capabilities.
Wilbur
wduluoz
Memberok – using bbpress 0.8.2.1, wpmu (which is wp 2.2.1), and I have the users integrated.
When I post through WP, it makes both the WP post and the bbpress post correctly, but this error appears. From what I can tell, the actually the usermeta information is being duplicated in the database for the person posting and it then crashes because it cant successfully get the capabilities.
here is the crash:
Warning: array_filter(): The second argument, 'Array', should be a valid callback in bb-includes/capabilities.php on line 271
Warning: Invalid argument supplied for foreach() in bb-includes/capabilities.php on line 275
Warning: array_filter(): The second argument, 'Array', should be a valid callback in bb-includes/capabilities.php on line 271
Warning: Invalid argument supplied for foreach() in bb-includes/capabilities.php on line 275
Warning: array_filter(): The second argument, 'Array', should be a valid callback in bb-includes/capabilities.php on line 271
Warning: Invalid argument supplied for foreach() in bb-includes/capabilities.php on line 275
Warning: array_filter(): The second argument, 'Array', should be a valid callback in bb-includes/capabilities.php on line 271
Warning: Invalid argument supplied for foreach() in bb-includes/capabilities.php on line 275
Warning: Cannot modify header information - headers already sent by (output started at bb-includes/capabilities.php:271) in /wp-includes/pluggable.php on line 338Ive trimmed the server path a little.
I am wading through it trying to understand how you set it up. It nicely done, but I dont understand why this is happening.
Wilbur
July 11, 2007 at 1:22 am #58910In reply to: infobox ie/firefox difference
fel64
MemberI think that IE7 does not recognise the
<br clear="all">as it should – kakumei was designed pre-IE7, I think? Try playing around with the HTML; can’t test it myself unfortunately since the problem is in IE. Maybe<br style="clear: both;"/>will work?July 11, 2007 at 1:04 am #58933In reply to: Forum links in wp_list_pages() ?
fel64
MemberIs there a wp hook in wp_list_pages()? That would be the first place to start.
You could always create custom page templates which redirect the user when they visit that page using http://uk2.php.net/header. There’s a wp tutorial in their codex to creating custom page templates. You’d need one for each forum.
July 11, 2007 at 12:59 am #58932fel64
MemberHi you
Try this if your blog is integrated.
echo $bb->wp_home;Don’t forget the php tags to do it in HTML.
I think it would be safe to code your navigation bar now.
fel64
MemberHey peoples, was on holiday for a week – sorry!
WDuluoz (Wilbur?), when it referenced functions.php originally what was the reference and what version were you using? You fixed this by adding the
global $bbdb, ...;declaration in config.php?Can you be more specific about your strange problems? Where are you posting, wp or bb? What do you see on your screen after you make the post? What is ‘member inserted’, and how do you know? When does it crash, how do you know it crashes trying to pull up the capabilities array? I need error messages and warnings.
starrett, where are you using that? I think you need to add this line just above line #493 (in Notepad, press Ctrl + G to go to a certain line):
require_once( $opshuns['bbpath'] );Line #493 is the one that says
$topic_id = ...;. At least I think that’s the problem, that would explain why I didn’t catch it.July 10, 2007 at 6:42 pm #57787In reply to: Just launced – integrated with WPMU
macbis
MemberI never could get wpmu to run on top of bbpress. Evertime I tried wpmu would think I wanted to create a blog named boards instead of load the installation of bbpress in the directory called boards. (If anyone has a solution for that PLEASE point me in the right direction)
My friend (atomAstro on here) figured this out. In your
wpmu-settings.phpfile you need to add some code around line 119.This:
if( $blogname == 'bbpress' ){
return true;
}Should be added right above this:
if( is_array( $pages ) == false )
return false;Change $blogname = ‘bbpress’ to whatever your bbPress directory is called.
July 9, 2007 at 10:35 am #57451In reply to: *seamless* wordpress integration
airdrawndagger
MemberOk, solved that as well

Now, for my next problem. What do I type so it knows when I’m browsing a forum page? If you look at my site I have highlighted tabs for my different sections. I need the forum tab to be highlighted while in the forum and for the start tab not to be! I use is_home for the start tab
http://www.doublepeace.se/forum
Please help!
July 8, 2007 at 4:09 pm #58882In reply to: Link to profile edit from wordpress header
airdrawndagger
MemberThank you for the help! Actually I solved it just now, I had to put
global $current_user; echo $current_user->ID;to get it right!
July 8, 2007 at 4:07 pm #55233In reply to: Favourites
_ck_
ParticipantHeh, thanks for the compliment but I am completely self-trained and rather unprofessional in my code (translation: I’d make a mess)
I just seem to have a knack at code, I learn very quickly from examples and can figure out how to apply them. Also, exhaustive hours at hacking pre-2.0 wordpress taught me a lot.
ps. what “serious” issues – I might have a go… maybe…
July 8, 2007 at 3:59 pm #58881In reply to: Link to profile edit from wordpress header
_ck_
ParticipantJust an untested guess on my part but what you want is something like this?
<a href="/forum/profile.php?id=<? echo $user_ID; ?>">your profile</a>July 8, 2007 at 3:44 pm #58901In reply to: Why “favorites” ? Bad terminology choice?
_ck_
ParticipantYeah I’ve already hacked the core code to make it say “Track this topic in your forum favorites” to make it sound different than adding to your bookmarks which every site nags the visitors to do and so they ignore it.
Too much hacking needed to change the term “favorites” everywhere unfortunately and it was the first thing I sadly had to touch the core for. After hacking up wordpress so much that I cannot easily upgrade it, I swore not to do that on BBpress, especially since it’s so early in alpha/beta
It’s also going to be a problem eventually that a tracking level is not set for each “favorite”, so now they can only get every topic emailed, or none at all.
When in doubt, study vbulletin as a model I suggest…
July 8, 2007 at 2:51 pm #58884Detective
MemberThis is what i do to solve the problem:
function wpbb_add_user_role_rk($user_id) {
$user = new WP_User($user_id);
$user->set_role(get_option('default_role'));
}
add_action( ‘bb_new_user’, ‘wpbb_add_user_role_rk’);
July 8, 2007 at 2:36 pm #58859In reply to: plugin request: allow admins any markup override
Trent Adams
MemberI would just add this as a request in TRAC because I think that is important as well as I have currently 5 plugins (I know I could combine them to 1) to allow code. Maybe a checkbox in the admin?
Trent
July 8, 2007 at 12:27 pm #55231In reply to: Favourites
_ck_
ParticipantHere’s a function I whipped up to grab the number of users who call any particular topic a favorite.
If you don’t send it a topic id, it return the currently displayed topic’s favorite count
function get_topic_favorites_count( $topic_id=0) {
global $bbdb, $topic;
if (!$topic_id) $topic_id = (int) $topic->topic_id;
return $bbdb->get_var("SELECT COUNT(*) FROM ".$bbdb->usermeta." WHERE meta_key='bb_favorites' AND meta_value REGEXP ':<:".$topic_id.":>:'");
}use it this way:
<? echo get_topic_favorites_count(); ?>within your topic.php template
July 8, 2007 at 11:24 am #56708In reply to: Plugin: Avatar Upload
LMD
ParticipantThe error sounds like it’s trying to call the
add_action()function when either the file containing the function (wp-functions.php) isn’t included for some reason, or the plugin is being called before it has been included.I do not know why this might occur, although the fact you are using an integrated WordPress/bbPress combo might be a factor. We really need somebody who knows more about the internals of both system to help.
Anyway, by commenting out the
add_action()function all you have done is prevent the plugin from automatically creating an identicon for newly registered users. So, it’s not such a biggie while trying to solve the problem.Feel free to hack the script however you see fit — I realise I have been rather too strict with the filenames, especially as it is really only a first-stage precaution (the file gets renamed n the server anyway). Also, I believe some browsers add the whole path to the uploaded filename (something I neglected to address).
A solution I am adding to the next version will be to extract the actual filename from the path before checking.
$img_name = basename($img['name']);Then, the number of necessary characters to allow is greatly reduced. I just prefer to approach it from the other end, block everything except what I explicitly allow. But as I said, feel free to hack it to suit your needs.
I was completely unaware that you could enter a URL into a file input (“browse”) field? You indicate that it forces Windows to download the file, but I am wondering whether it is a browser specific feature and whether it is supposed to work like that? I would not rely on it.
The mime-type comes from the uploaded file in
$_FILESwhich, you are right should not be trusted. I’m experimenting with checking whether the uploaded file is areally an image doing something likeimagecreatefromjpeg()– obviously using the appropriate function for the reported file extension (so if it’s all wrong/missing/forged an error will result). Alternatively, a simple solution might be to usegetimagesize()(just the one function for all types), which I already use later in the code.July 8, 2007 at 8:26 am #57831In reply to: Usernames with spaces do not work
howtogeek
MemberI should mention that my code is a horrible hack… hopefully they’ll fix the problem in the core.
July 8, 2007 at 7:50 am #58858In reply to: plugin request: allow admins any markup override
_ck_
ParticipantWell with wordpress, the override is right in the code but obviously to leave the bbpress core alone it would have to be a plugin. (Kinda wondering what all these plugins are doing to the supposedly high performance of BBpress).
I’d like to see admin/mods have zero limits on what they put into their posts. So to write a plugin I need to find out how to check the user level, then figure out what filter to attach it to (probably pre_post)
-
AuthorSearch Results