Search Results for 'code'
-
AuthorSearch Results
-
March 27, 2010 at 10:24 pm #33856
Topic: Get last page in bb_init
in forum Pluginszaerl
ParticipantHi there. I’m writing a small plugin and I need to check if the actual page is the last page of a topic. I’ve seen that this is the standard way:
if(bb_current_user_can('write_posts') && bb_is_topic())
{
global $topic, $page;
$add = topic_pages_add();
$last_page = get_page_number( $topic->topic_posts + $add );
if($last_page == $page) do whatever you want
}but I want to use this code during the bb_init callback. It doesn’t work and after some simple tests I’ve seen that $topic isn’t defined (yet). Is there a way to get last page during this callback?
Thanks in advance.
March 27, 2010 at 8:09 pm #85701kevinjohngallagher
MemberThis is fairly simple to do, but you have to define exactly what you want it to do.
i.e. Are you looking for forum topics that include any of the Tags in the blog post? This means that there will be no ordering or weighting on relavancy.
This line of WP code will help you on your way too:
$tags = wp_get_post_tags($post->ID);
March 27, 2010 at 4:45 pm #86105In reply to: https problem?
royho
ParticipantAlthough this is the code for WordPress it might be universal to BB Press as well. Open up your bb-config.php and add this line:
define('FORCE_SSL_ADMIN', true);March 27, 2010 at 3:04 pm #86247In reply to: how to increase topic length bbpress
absolutex
Membersimple
—> how to increase topic length bbpress (2 posts) (2 voices)
Topic title length
March 27, 2010 at 1:28 pm #85911In reply to: bbPress Deep Integration / Installation Tutorial
Kevin Ryman
ParticipantSomething people always seem to be asking around here… Integrating bbPress to an existing overall page design. In other words, how to create a matching bbPress theme for your site.
March 27, 2010 at 11:33 am #86123In reply to: bb_rel_nofollow – Does not work !
Gautam Gupta
ParticipantOr you may use this, if the above doesn’t work for you:
<?php
function unset_arel( $tags ) {
unset( $tags['a']['rel'] );
return $tags;
}
add_filter( 'bb_allowed_tags', 'unset_arel', -1 );
?>March 27, 2010 at 11:29 am #86122In reply to: bb_rel_nofollow – Does not work !
Gautam Gupta
ParticipantPut this in your theme’s function.php (create one if it is not there):
<?php
function change_dofollow_to_nofollow( $content ) {
return str_replace( array( ' rel="dofollow"', " rel='dofollow'" ), ' rel="nofollow"', $content );
}
add_filter( 'post_text', 'change_dofollow_to_nofollow', -1 );
?>Kevin Ryman
ParticipantYou probably haven’t miss anything…
March 26, 2010 at 5:54 pm #86199In reply to: Subforum not accessible
royho
ParticipantTry this, in your CSS, put a statement like this.
table#forumlist tr.bb-child {
text-indent:50px !important;
}That will indent out the sub-forums…
March 26, 2010 at 4:35 pm #65338In reply to: New Theme: Genealogías
Kevin Ryman
ParticipantI know this is an old topic but this theme is available for download at http://www.bbpressthemes.net/genealogias/
March 26, 2010 at 4:04 pm #76031In reply to: Linking back to main website.
juboe
MemberOkay, so I found it. I opened it in WordPad, added my link code after this:
<div id=”header” role=”banner”>
saved it, and closed WordPad.
I then browsed back to the forum and nothing has changed. Can someone shed some light on this?
Thanks,
juboe
March 26, 2010 at 11:23 am #85766In reply to: Display name restriction
zaerl
ParticipantHi Tom, thank for your answer. Unfortunately I cannot took out the display name feature because my mother language isn’t english and in my idiom it’s impossible to write significant portion of text without using characters outside the ASCII base and as far as I know unicode characters can’t be used in login names.
Anyway I think that I will hack the core even if I know that this isn’t a good thing. I think that I will add an extra check in
$wp_users_object->update_user()which in turn call_put_user.March 26, 2010 at 7:02 am #85765In reply to: Display name restriction
deadlyhifi
ParticipantI was having this problem on my forum so I took out the display name feature.
See https://bbpress.org/forums/topic/help-with-basic-command-to-add-new-profile-fields#post-65468
And delete
'display_name' => array(1, __('Display name as')),March 26, 2010 at 4:26 am #86187In reply to: Can't get it to work :Could not establish a database
absolutex
Memberok i get it to work

find in meta database and change this table
meta key
user_bbdb_name
and
user_bbdb_user
March 25, 2010 at 9:38 pm #86084In reply to: Umlaut in member name
Dailytalker
MemberI solved the problem by adding the following additional code to the plugin:
add_filter( 'get_user_display_name', 'rk_display_name' );function rk_display_name($name, $ID = 0) {
if ( !seems_utf8( $name ) )
return utf8_encode( $name );
return $name;
}
March 25, 2010 at 8:07 pm #86168In reply to: problem with users upgrade 1.2
radovanx
Member0.9 yes i use template where i can put le code for this ? thanks
March 25, 2010 at 5:55 pm #54441In reply to: Add nofollow to links
Process of Illumination
ParticipantHi,
since i have the forum in a different frame of my page, i’d have to add the attribute “target_top” to every link.
The code below is only for target_blank, or would it be possible to replace every “blank” with “top” and have it working?
https://bbpress.org/forums/topic/add-nofollow-to-links#post-17523″
And how do you make the code into a plugin? you copy and paste into a text file, save it as *.php and upload the file in the bbpress plugins folder?
Thank you very much, every help is very appreciated!
The Process
March 25, 2010 at 4:57 pm #86128In reply to: integrating BBpress as a WP page
gerikg
Member“manage the bbpress forum via the same admin login as the primary WP install.”
https://wordpress.org/extend/plugins/bbpress-admin/
“…main wp widgetized sidebar”
If you did the deep integration you just have to stick
<?php getsidebar() ?;>somewhere in you bbpress theme file then mess with you bbpress css to make it fit.“..same sort of functionality with editing php and css templates, etc. in bbpress as with WP”
no such thing
March 25, 2010 at 4:34 am #86120In reply to: hundreds of spam users…
fifthhouse
MemberThanks everyone! I should be able to work this out with these plugins and guidelines. Cheers
March 25, 2010 at 12:38 am #85909In reply to: bbPress Deep Integration / Installation Tutorial
Kevin Ryman
ParticipantOnce again, nice video tutorial. Keep them coming!
March 24, 2010 at 8:33 pm #86118In reply to: hundreds of spam users…
johnhiler
MemberThere’s a nice Mass Delete Users plugin that lets you batch delete members:
https://bbpress.org/plugins/topic/mass-delete-users/
I’ve used it before, and it’s great!
Just make sure to backup your data first, just to be on the safe side.

I think there are also plugins you can install to disable registration. Let me know if you are interested, and I can try to track one down!
March 24, 2010 at 5:44 pm #85778Kevin Ryman
ParticipantEven though you changed your mind, this question of yours may come in handy to someone else. Thank you for asking.
March 24, 2010 at 8:20 am #85880In reply to: Ping Gautam: Revisiting bb-attachments
Gautam Gupta
ParticipantIn the bb Attachments FAQ, it is written:
if you get
error: denied mimeon every upload,mime_content_type functionorshell accessmust exist to verify mime types – otherwise you can force all types to be allowed by editingbb-attachments.phpand adding'application/octet-stream'to each of the$bb_attachments['allowed']['mime_types']And as I can see in the dump you pasted, neither
mime_content_typeis enabled, norshell access, so you would need to add'application/octet-stream'to each of the$bb_attachments['allowed']['mime_types']inbb-attachments.php.March 23, 2010 at 11:15 pm #86080In reply to: Umlaut in member name
Dailytalker
MemberI looked a bit around and found a peace of code with which I was able to create a plugin.
<?php/*
Plugin Name: UTF-8 usernames
Description: This plugin enables utf-8 characters in usernames. Mbstring must be enabled in the php.ini.
*/
function sanitize_user_mbstring( $raw_username, $username, $strict = false ) {
$raw_username = $username;
$username = strip_tags($username);
// Kill octets
$username = preg_replace(‘|%([a-fA-F0-9][a-fA-F0-9])|’, ”, $username);
$username = preg_replace(‘/&.+?;/’, ”, $username); // Kill entities
// Usage of ‘mb_ereg_replace’ instead of ‘preg_replace’ to preserve accents.
if ( $strict )
$username = mb_ereg_replace(‘|[^a-z0-9 _.-@]|i’, ”, $username);
return apply_filters(‘sanitize_user_mbstring’, $username, $raw_username, $strict);
}
add_action(‘sanitize_user’, ‘sanitize_user_mbstring’, 0, 3);
?>
Unfortunately it doesn’t work properly. When it displays correctly in bbpress it doesn’t in wordpress and reverse. I don’t have access to the php.ini. Could it be, that the thing with “mbstring” is the problem?
March 23, 2010 at 7:38 pm #77528In reply to: All RSS Feeds Broken?
Dailytalker
MemberI solved the problem!
I removed all “
»” in the rss.phpReplace the code of your rss.php with the following code and it should work:
<?php<br />
require('./bb-load.php');</p>
<p>// Determine the type of feed and the id of the object<br />
if ( isset($_GET['view']) || bb_get_path() == 'view' ) {</p>
<p> // View<br />
$feed = 'view';<br />
$feed_id = isset($_GET['view']) ? $_GET['view'] : bb_get_path(2);</p>
<p>} elseif ( isset($_GET['topic']) || bb_get_path() == 'topic' ) {</p>
<p> // Topic<br />
$feed = 'topic';<br />
$topic = get_topic(isset($_GET['topic']) ? $_GET['topic'] : bb_get_path(2));<br />
$feed_id = $topic->topic_id;</p>
<p>} elseif ( isset($_GET['profile']) || bb_get_path() == 'profile' ) {</p>
<p> // Profile<br />
$feed = 'profile';<br />
$feed_id = isset($_GET['profile']) ? $_GET['profile'] : bb_get_path(2);</p>
<p>} elseif ( isset($_GET['tag']) || bb_get_path() == 'tags' ) {</p>
<p> if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {<br />
// Tag recent topics<br />
$feed = 'tag-topics';<br />
} else {<br />
// Tag recent posts<br />
$feed = 'tag-posts';<br />
}<br />
$feed_id = isset($_GET['tag']) ? $_GET['tag'] : bb_get_path(2);</p>
<p>} elseif ( isset($_GET['forum']) || bb_get_path() == 'forum' ) {</p>
<p> if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {<br />
// Forum recent topics<br />
$feed = 'forum-topics';<br />
} else {<br />
// Forum recent posts<br />
$feed = 'forum-posts';<br />
}<br />
$forum = bb_get_forum(isset($_GET['forum']) ? $_GET['forum'] : bb_get_path(2));<br />
$feed_id = $forum->forum_id;</p>
<p>} elseif ( isset($_GET['topics']) || bb_get_path() == 'topics' ) {</p>
<p> // Recent topics<br />
$feed = 'all-topics';</p>
<p>} else {</p>
<p> // Recent posts<br />
$feed = 'all-posts';</p>
<p>}</p>
<p>// Initialise the override variable<br />
$bb_db_override = false;<br />
do_action( 'bb_rss.php_pre_db' );</p>
<p>if ( !$bb_db_override ) {</p>
<p> // Get the posts and the title for the given feed<br />
switch ($feed) {<br />
case 'view':<br />
if ( !isset($bb_views[$feed_id]) )<br />
die();<br />
if ( !$bb_views[$feed_id]['feed'] )<br />
die();<br />
if ( !$topics_object = new BB_Query( 'topic', $bb_views[$feed_id]['query'], "bb_view_$feed_id" ) )<br />
die();</p>
<p> $topics = $topics_object->results;<br />
if ( !$topics || !is_array($topics) )<br />
die();</p>
<p> $posts = array();<br />
foreach ($topics as $topic) {<br />
$posts[] = bb_get_first_post($topic->topic_id);<br />
}</p>
<p> $title = esc_html( sprintf( __( '%1$s View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] ) );<br />
$link = get_view_link($feed_id);<br />
$link_self = bb_get_view_rss_link($feed_id);<br />
break;</p>
<p> case 'topic':<br />
if ( !$topic = get_topic ( $feed_id ) )<br />
die();<br />
if ( !$posts = get_thread( $feed_id, 0, 1 ) )<br />
die();<br />
$title = esc_html( sprintf( __( '%1$s Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title() ) );<br />
$link = get_topic_link($feed_id);<br />
$link_self = get_topic_rss_link($feed_id);<br />
break;</p>
<p> case 'profile':<br />
if ( bb_get_option( 'mod_rewrite' ) === 'slugs' ) {<br />
$user = bb_get_user_by_nicename( $feed_id );<br />
} else {<br />
$user = bb_get_user( $feed_id );<br />
}<br />
if ( !$user ) {<br />
die();<br />
}<br />
if ( !$posts = get_user_favorites( $user->ID ) ) {<br />
die();<br />
}<br />
$title = esc_html( sprintf( __( '%1$s User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_login ) );<br />
$link = bb_get_profile_link($feed_id);<br />
$link_self = get_favorites_rss_link($feed_id);<br />
break;</p>
<p> case 'tag-topics':<br />
if ( !$tag = bb_get_tag( $feed_id ) )<br />
die();<br />
if ( !$topics = get_tagged_topics( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )<br />
die();</p>
<p> $posts = array();<br />
foreach ($topics as $topic) {<br />
$posts[] = bb_get_first_post($topic->topic_id);<br />
}</p>
<p> $title = esc_html( sprintf( __( '%1$s Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name() ) );<br />
$link = bb_get_tag_link($feed_id);<br />
$link_self = bb_get_tag_topics_rss_link($feed_id);<br />
break;</p>
<p> case 'tag-posts':<br />
if ( !$tag = bb_get_tag( $feed_id ) )<br />
die();<br />
if ( !$posts = get_tagged_topic_posts( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )<br />
die();<br />
$title = esc_html( sprintf( __( '%1$s Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() ) );<br />
$link = bb_get_tag_link($feed_id);<br />
$link_self = bb_get_tag_posts_rss_link($feed_id);<br />
break;</p>
<p> case 'forum-topics':<br />
if ( !$topics = get_latest_topics( $feed_id ) )<br />
die();</p>
<p> $posts = array();<br />
foreach ($topics as $topic) {<br />
$posts[] = bb_get_first_post($topic->topic_id);<br />
}</p>
<p> $title = esc_html( sprintf( __( '%1$s Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );<br />
$link = get_forum_link($feed_id);<br />
$link_self = bb_get_forum_topics_rss_link($feed_id);<br />
break;</p>
<p> case 'forum-posts':<br />
if ( !$posts = bb_get_latest_forum_posts( $feed_id ) )<br />
die();<br />
$title = esc_html( sprintf( __( '%1$s Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );<br />
$link = get_forum_link($feed_id);<br />
$link_self = bb_get_forum_posts_rss_link($feed_id);<br />
break;</p>
<p> // Get just the first post from the latest topics<br />
case 'all-topics':<br />
if ( !$topics = get_latest_topics() )<br />
die();</p>
<p> $posts = array();<br />
foreach ($topics as $topic) {<br />
$posts[] = bb_get_first_post($topic->topic_id);<br />
}</p>
<p> $title = esc_html( sprintf( __( '%1$s Recent Topics' ), bb_get_option( 'name' ) ) );<br />
$link = bb_get_uri();<br />
$link_self = bb_get_topics_rss_link();<br />
break;</p>
<p> // Get latest posts by default<br />
case 'all-posts':<br />
default:<br />
if ( !$posts = bb_get_latest_posts( 35 ) )<br />
die();<br />
$title = esc_html( sprintf( __( '%1$s Recent Posts' ), bb_get_option( 'name' ) ) );<br />
$link = bb_get_uri();<br />
$link_self = bb_get_posts_rss_link();<br />
break;<br />
}<br />
}</p>
<p>bb_send_304( $posts[0]->post_time );</p>
<p>if (!$description = esc_html( bb_get_option('description') )) {<br />
$description = $title;<br />
}<br />
$title = apply_filters( 'bb_title_rss', $title, $feed );<br />
$description = apply_filters( 'bb_description_rss', $description, $feed );<br />
$posts = apply_filters( 'bb_posts_rss', $posts, $feed );<br />
$link_self = apply_filters( 'bb_link_self_rss', $link_self, $feed );</p>
<p>bb_load_template( 'rss2.php', array('bb_db_override', 'title', 'description', 'link', 'link_self'), $feed );</p>
<p>?> -
AuthorSearch Results