Forum Replies Created
-
In reply to: Disable posting and registration
1. remove /register.php or redirect it to somewhere, or replace it with your page (tell visitors your forum temporarily doesn’t accept new registrations) then you can skip step 2.
2. remove register link from your login-form.php in you template folder.
3. Use this. You may need these
$roles['member']['capabilities'] = array('read' => true);
$roles['moderator']['capabilities'] = array('read' => true);
$roles['administrator']['capabilities'] = array('read' => true);In reply to: Plugin: GravatarI think there is no need to delete yours. Your porting plugin should have more features than mine. I am too lazy, therefore my Gravatar plugin only has the functionalities that I need. However I will add a feature if someone asks and I agree that is a general need.
In reply to: Adding tekst in a new custom page, hyperlinks brokenecho make_clickable($content);
If you pull posts from database, then trying to make it possible to use template functions may be a better solution.
In reply to: Wrong number displaying in Current FavoritesSame problem? https://trac.bbpress.org/ticket/710
In reply to: Show funny characters in usernamesI only tested one case, the dollar sign ‘$’ on my testing forum with commenting out the entire
function bb_user_sanitize
except last line. I can register with ‘$’ in username, post with that account and the username is showed correctly.In reply to: No New posts for membersI made my modifications to the original theme Kakumei. If you have any questions about my modifications, you are welcome to ask me.
In reply to: Show funny characters in usernamesadd a filter for
bb_user_sanitize
to allow those characters you need (choose carefully!). Check line 114 in formatting-functions.php for the parameters which you can use in your filter.I personally don’t agree to allow users having fancy or funny usernames. You may encounter more problems that you have never thought.
In reply to: No New posts for members<?php
/*
Plugin Name: NoNewsPostsForMembers
Plugin URI: https://bbpress.org/forums/topic/no-new-posts-for-members
Description: No New posts for members
*/
function NoNewsPostsForMembers($roles) {
$roles['member']['capabilities']['write_posts'] = false;
return $roles;
}
add_filter('get_roles', 'NoNewsPostsForMembers');
?>Put it in
my-plugins
with any filename.php you like. Activate it. Then this should work.In reply to: Paginated search resultsI made some changes to have paginated search results on relevant post. However, I am not sure is this what you need. You need to modify two files: search.php in root of bbPress and search.php of your template files.
Replace
if
block start at line 9 in search.php of root of bbPress with:if ( $q = stripslashes( $q ) ) {
add_filter( 'bb_recent_search_fields', create_function( '$f', 'return $f . ", MAX(post_time) AS post_time";' ) );
add_filter( 'bb_recent_search_group_by', create_function( '', 'return "t.topic_id";' ) );
$bb_query_form->BB_Query_Form( 'post', array(), array( 'per_page' => 5, 'post_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_recent_search' );
$recent = $bb_query_form->results;
$bb_query_form->BB_Query_Form( 'topic', array( 'search' => $q ), array( 'post_status' => 0, 'topic_status' => 0, 'search', 'forum_id', 'tag', 'topic_author', 'post_author', 'count' => 'found_rows' ), 'bb_relevant_search' );
$relevant = $bb_query_form->results;
global $relevant_round_rows;
$relevant_found_rows = $bb_query_form->found_rows;
$q = $bb_query_form->get( 'search' );
}I added a query parameter
'count'=>'found_rows'
to second$bb_query_form
for retrieving total post count. And I added global $relevant_found_rows to pass to template search.php (you can use bb_load_template to do same thing).Insert the following code just before second
<?php endif; ?>
from bottom in template search.php<div class="nav">
<?php
$uri = $_SERVER['REQUEST_URI'];
if (false !== $pos = strpos($uri, '?')) {
$uri = substr($uri, 0, $pos) . '?q=' . urlencode($q) . '%_%';
if (!isset($page))
$page = 1;
global $relevant_found_rows;
echo paginate_links(array('base' => $uri, 'format' => '&page=%#%', 'total'=>ceil($relevant_found_rows/$bb->page_topics), 'current'=>$page));
}
?>
</div>Should look like:
<?php if ( $relevant ) : ?>
<h2><?php _e('Relevant posts')?></h2>
<ol class="results">
<?php foreach ( $relevant as $bb_post ) : ?>
<li><h4><a href="<?php post_link(); ?>"><?php topic_title($bb_post->topic_id); ?></a></h4>
<?php echo bb_show_context($q, $bb_post->post_text); ?>
<small><?php _e('Posted') ?> <?php bb_post_time( __('F j, Y, h:i A') ); ?></small>
</li>
<?php endforeach; ?>
</ol>
[insert the code above here]
<?php endif; ?>You can find
paginate_links
in bb-includes/wp-functions.php.In reply to: 404 when clicking “View your profile” linkWhat does the link to your profile look like?
Have you tried to refresh the page which has the link to your profile?
In reply to: Blank screen after installing bbPressI see. Then that would be
require_once '../wp-blog-header.php';
In reply to: Add a “page” to my templateHi,
Here is a quick php for it(Use this method at your own risk), you need pretty permalink to use it.
Save the following code in bbPress root folder as
page.php
<?php
require_once('./bb-load.php');
if (preg_match('/.*/page/(.*)/', $_SERVER['REQUEST_URI'], $matches)) {
$file = bb_slug_sanitize($matches[1]) . '.php';
if (file_exists(bb_get_active_theme_folder() . "/static/$file")) {
bb_load_template("static/" . $file);
exit(0);
}
}
wp_redirect(bb_get_option('uri'));
?>Put your static pages in a new
static
folder under your template folder, they should looks like<?php bb_get_header(); ?>
The static content here.
<?php bb_get_footer(); ?>Then you can access a static file. For example, access
test.php
(bb-templates/yourtemplate/static/test.php) at http://yoursite.com/bbpress/page/testRemember: Use this method at your own risk
In reply to: Blank screen after installing bbPressmajea,
You used
require_once
in a wrong way. If you installed WordPress in /path/to/wordpress and bbPress in /path/to/bbpress, then you should userequire_once '../wordpress/wp-blog-header.php'
.You normally use
require/include
for local .php.PS. I don’t use WordPress and bbPress together.
In reply to: Plugin: GravatarTrent
Thanks for liking it. I already requested, I know it need sometime to get approval.
In reply to: Plugin: GravatarOops…
I changed my mind. bbPress doesn’t check the validity of new email address and confirm the user really own that new email address.
In reply to: Plugin: GravatarAha… I just realized that I didn’t know users can change their registered email. (I use a Key Master to edit normal user’s profile…)
I should remove this Gravatar Email field to make code simpler and add another field
Use Gravatar?
. Maybe add some other features as well.I am also waiting Gravatar to allow larger avatar. Once it allow, I will put a new version out.
In reply to: Internal Server ErrorThat’s weird…
Did you modify the code by your hands?
[17-Oct-2007 20:53:46] PHP Warning: mysql_get_server_info() [function.mysql-get-server-info]: Access denied for user ‘unrprus1’@’localhost’ (using password: NO) in /home/unrprus1/public_html/wp02/forums/bb-includes/db-mysqli.php on line 80
According your log, that’s
mysql_get_server_info
notmysqli_get_server_info
.The patch changed the function from
mysql_get_server_info
tomysqli_get_server_info
(there is an additional letter i). Could you read thedb-mysqli.php
again?I have this error before on my hosting server, once I modified that code. It totally fixed I only modified line 80.
In reply to: Internal Server ErrorHave you tried this this
to modify line 80 in
db-mysqli.php
?In reply to: Internal Server ErrorHi JRussell,
Although, I don’t use WordPress and bbPress in the same time. But I think if you can provide web server logs like error.log from your hosting service provider. We will have more clues.
In reply to: Change the default ‘Member’ role title?I made another approach to fit this need and used it on my forum.
function ChangeRoleDisplayName() {
global $bb_roles;
$bb_roles->role_names['keymaster'] = "Toilet Cleaner";
[...]
}
add_action('bb_got_roles', 'ChangeRoleDisplayName', 10, 0);
?>The complete code is in role-display-name.php.