Search Results for 'code'
-
Search Results
-
Topic: Help with a plugin
I wanted a way to let the topics listed under “Latest Discussion” expire after a while (eg., no longer show up if there has been no activity after a week), so I wrote this little plugin which works alright, except it messes up the forums. Each forum, when clicked, shows all posts no matter what forum they’re in.
Any help would be appreciated. This is a simple script, I just copied the $where code from functions.php and added the filter, then added my “expire after 7 days” addition. Any help would be appreciated, I’m probably just not seeing something simple.
function get_where_plugin() {
$forum = (int) $forum;
$where = 'WHERE topic_status = 0';
if ( $forum )
$where .= " AND forum_id = $forum ";
if ( !empty( $exclude ) )
$where .= " AND forum_id NOT IN ('$exclude') ";
if ( is_front() )
$where .= " AND topic_sticky <> 2 AND SUBDATE(NOW(), INTERVAL 7 DAY) < topic_time "; // 2nd part is my addition
elseif ( is_forum() || is_view() )
$where .= " AND topic_sticky = 0 ";
return $where;
}
add_filter ( 'get_latest_topics_where', 'get_where_plugin' );
To see how it’s misbehaving, you can go to http://www.rayd.org/forums/ and just click on either forum (General Chat or New Forum Discussion) and see that both contain the same data. However, it’s working great on the front page.
Topic: Private Forum script
I needed desperately a script that would restrict all access to unregistered users so I wrote one. But I am an absolute beginner so don’t know no nothin’ about elegance or whatnot but I just tested it in my installation and it works.
The thing is naturally bb_press has authentication scripts. but to make all you website protected you need to put this in your header.php. However bb-login.php, which your users need to login also use the header.php, so I had to make sure that this small script runs on all pages EXCEPT the login page.
Here’s the script:
<?php
$login_page = $bb->path . ‘bb-login.php’;
if ($_SERVER != $login_page) {
if ( !bb_is_user_logged_in() ) {
header(‘Location: ‘ . $bb->domain . $bb->path . ‘bb-login.php’);
} else { }
}
else { }
?>
How to Use it:
1. Copy paste the above code to your my-templates/header.php AT THE VERY TOP of the file. Make sure you leave no empty space before the <?php line (use something like TextPad – it’s free). So you header should look like:
<?php
$login_page = $bb->path . ‘bb-login.php’;
if ($_SERVER != $login_page) {
if ( !bb_is_user_logged_in() ) {
header(‘Location: ‘ . $bb->domain . $bb->path . ‘bb-login.php’);
} else { }
}
else { }
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” ….
That’s it. Since I use the values you provided in you BBPRESS setup all the paths should be correct.
Like I said I am complete newbie, so use at your own risk. BACKUP your header.php, or if something goes wrong just delete the script you just added.
Hope it works for you,
Caner
I’m not sure why, or what’s going on, maybe I missed something.. But, when trying to mark a thread [Resolved] in here, it doesn’t seem to show up as [Resolved].. like it does on the WordPress.org forums..? Is this supposed to happen, or.. ?
spencerp
Topic: bbpress and 2.1 alpha3
I know this might sound, or, be a stupid question, but.. it’s safe to install bbpress right along beside 2.1 alpha3 right? If so, great! If not, is there anything I should know ahead of time?
I just upgraded my main blog to 2.1 alpha3 a few hours ago, and wouldn’t mind meshing the two together. So, lay it on me peoples! I’m ready..
spencerp
Topic: Trouble posting
I have a rather strange problem. When I click the “Send Post”-button I get a 302 Found, with the following message:
The document has moved
- here
.
The link points to bb-post.php. When I click the link I get the following message:
You need to actually submit some content!
My .htaccess file that was generated from rewrite-rules.php is placed in the root of the bbpress-installation looks like this:
RewriteEngine On
RewriteBase /bbpress/
RewriteRule ^forum/([0-9]+)/page/([0-9]+)$ /bbpress/forum.php?id=$1&page=$2 [L,QSA]
RewriteRule ^forum/([0-9]+)$ /bbpress/forum.php?id=$1 [L,QSA]
RewriteRule ^topic/([0-9]+)/page/([0-9]+)$ /bbpress/topic.php?id=$1&page=$2 [L,QSA]
RewriteRule ^topic/([0-9]+)$ /bbpress/topic.php?id=$1 [L,QSA]
RewriteRule ^tags/(.+)/page/([0-9]+)$ /bbpress/tags.php?tag=$1&page=$2 [L,QSA]
RewriteRule ^tags/(.+)/?$ /bbpress/tags.php?tag=$1 [L,QSA]
RewriteRule ^tags/?$ /bbpress/tags.php [L,QSA]
RewriteRule ^profile/([0-9]+)/page/([0-9]+)$ /bbpress/profile.php?id=$1&page=$2 [L,QSA]
RewriteRule ^profile/([0-9]+)/([a-z]+)$ /bbpress/profile.php?id=$1&tab=$2 [L,QSA]
RewriteRule ^profile/([0-9]+)/([a-z]+)/page/([0-9]+)$ /bbpress/profile.php?id=$1&tab=$2&page=$3 [L,QSA]
RewriteRule ^profile/([0-9]+)$ /bbpress/profile.php?id=$1 [L,QSA]
RewriteRule ^view/([a-z-]+)/page/([0-9]+)$ /bbpress/view.php?view=$1&page=$2 [L,QSA]
RewriteRule ^view/([a-z-]+)$ /bbpress/view.php?view=$1 [L,QSA]
RewriteRule ^rss/$ /bbpress/rss.php [L,QSA]
RewriteRule ^rss/forum/([0-9]+)$ /bbpress/rss.php?forum=$1 [L,QSA]
RewriteRule ^rss/topic/([0-9]+)$ /bbpress/rss.php?topic=$1 [L,QSA]
RewriteRule ^rss/tags/([a-z]+)$ /bbpress/rss.php?tag=$1 [L,QSA]
RewriteRule ^rss/profile/([0-9]+)$ /bbpress/rss.php?profile=$1 [L,QSA]
The $bb->mod_rewrite is set to true.
The post is inserted into the database, when I look at the frontpage of bbpress, but it is not redirecting properly.
My webhost is one.com.
Has anyone else experienced this fenomenon?