Search Results for 'code'
-
AuthorSearch Results
-
September 8, 2009 at 2:53 pm #78762
In reply to: Display the latest discussions titles into a webpage
Adam Harley (Kawauso)
MemberHaha or that
I work with a server that’s almost completely firewalled in most of the time, makes doing anything that easy impossible
September 8, 2009 at 2:51 pm #78761In reply to: Display the latest discussions titles into a webpage
kirpiit
MemberI got it!
You just download a folder [1] into your server and make a call with the proper parameters.
Templates are trivial to edit.
Looks the right thing for dummies like me

So, the raw problem is solved.
Now let’s go bor a better solution, if there is any.
I’ll try your code, kawauso, and let you know.
—-
[1]
http://www.feedforall.com/free-php-script.htmSeptember 8, 2009 at 2:29 pm #78759In reply to: Display the latest discussions titles into a webpage
Adam Harley (Kawauso)
MemberAh the plugin is intended for WordPress installs only I’m afraid.
A quick way of doing it:
In your bbPress directory, make a file called
javascript.phpcontaining:<?php
// Taken from index.php
// Load everything up
require('./bb-load.php');
do_action( 'bb_index.php_pre_db' );
$forums = bb_get_forums(); // Comment to hide forums
if ( $topics = get_latest_topics( false, $page ) ) {
bb_cache_last_posts( $topics );
}
bb_load_template( 'html_include.php' );
?>then in your template directory, make a file called
html_include.phpcontaining:<?php if ( $forums && $topics ) : ?>
<table id="latest_discussions">
<tr>
<th><?php _e('Topic'); ?></th>
<th><?php _e('Posts'); ?></th>
<!-- <th><?php _e('Voices'); ?></th> -->
<th><?php _e('Last Poster'); ?></th>
<th><?php _e('Freshness'); ?></th>
</tr>
<?php foreach ( $topics as $topic ) : ?>
<tr>
<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
<td class="num"><?php topic_posts(); ?></td>
<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td>
</tr>
<?php endforeach; // $topics loop ?>
</table>
<?php else : ?>
No discussions.
<?php endif; ?>and finally, in the page where you want to load the list, put something like:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>$.get("javascript.php", { rand: Math.random() }, function(data){ document.getElementById('latest').innerHTML = data; } );</script>
<div id="latest"></div>Old-fashioned way of loading the HTML in there and use a local copy of jQuery or whatever library you use, but that’s the general idea really.
html_include.phpis just a cut down version offront-page.phpso you can edit it the same as any other template.javascript.phpdoesn’t load in stickies, but that’s just how I felt like doing things, it’s a cut down version ofindex.phpso it’s easy enough to put back.Even more cut down version of
html_include.php(so you really do just get a list):<?php if ( $forums && $topics ) : ?>
<ul>
<?php foreach ( $topics as $topic ) : ?>
<li><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></li>
<?php endforeach; // $topics loop ?>
</ul>
<?php else : ?>
No discussions.
<?php endif; ?>September 8, 2009 at 2:03 pm #78758In reply to: Display the latest discussions titles into a webpage
kirpiit
MemberInstead, that /rss/topics thing looks promising: if I only could find the source of that page, and throw away most of the code, just to keep the last 5 or so entries with no formatting, that would be more than enough.
There is a rss.php file inside the bbpress folder, but there is too much code and I get lost into it.
September 8, 2009 at 1:47 pm #78757In reply to: Display the latest discussions titles into a webpage
kirpiit
MemberThey could surely be worth inspecting, if I only really knew anything about coding.

So, you mean that if I place this piece of php code [1] into any web page I’ll show a list of entries? I tried but it doesn’t seem to work at all.
So, the idea of just swapping wordpress variables with bbpress ones is not enough.
No. I’m afraid it would be beyond my skills.
—-
[1]
https://bbpress.org/plugins/topic/wordpress-latest-post/September 8, 2009 at 1:31 pm #67525In reply to: Plugin suggestions
Olaf Lederer
Participantlol I guess I read the opening post only 11 month ago

edit: btw I will publish the geshi plugin later on my website
September 8, 2009 at 1:23 pm #78710In reply to: Change position for post inputfield
Adam Harley (Kawauso)
MemberHmm… easy way of doing that

function bb_reset_newpostlink() {
global $link, $topic_id;
$link = get_topic_link( $topic_id );
}
add_action( 'bb-post.php', 'bb_reset_newpostlink' );Put that in either
functions.phpor a plugin, it’ll overwrite the redirect link with the general topic one.September 8, 2009 at 1:02 pm #78776In reply to: integration problems after upgrad
Adam Harley (Kawauso)
MemberWhat bbpress integration plugin are you using? You should be able to integrate 2.8 and 1.0 without any plugins installed in either, just set the bbPress up with the same settings as WordPress under
Settings -> WordPress Integrationin the bbPress admin.September 8, 2009 at 12:45 pm #78755In reply to: Display the latest discussions titles into a webpage
Adam Harley (Kawauso)
MemberThere’s the latest topics RSS feed at
/rss/topicsand the WordPress Latest Post plugin: https://bbpress.org/plugins/topic/wordpress-latest-post/, either of those help?September 8, 2009 at 8:13 am #78689In reply to: call register form via php tag
Olaf Lederer
ParticipantI think a sitewide form is easier to integrate using the full code inside the functions.php file (like comment list on wordpress)
September 8, 2009 at 7:58 am #67522In reply to: Plugin suggestions
Olaf Lederer
Participant@chandersbs, this topic is about geshi syntax highlighting
September 8, 2009 at 7:25 am #78688In reply to: call register form via php tag
Adam Harley (Kawauso)
MemberFor a start…
<script>is for JavaScript code, not PHP
You could avoid using a separate template for that one call anyway and use the function directly instead, or put it in functions.php. You might have to register template files though, but I’m not sure.September 8, 2009 at 7:11 am #78777In reply to: can i use the login system for my own script
Shagalaga
Memberbbpress is opensource
September 8, 2009 at 4:26 am #78748In reply to: Plugin to display photos and html
Olaf Lederer
Participantyou can put html in code tags like
<h3>Hello World</h3>September 7, 2009 at 8:56 pm #78741In reply to: Private Messaging
Olaf Lederer
ParticipantHi,
personal messaging is not a default function in bbpress, bbpress is great because of other features
September 7, 2009 at 8:52 pm #67520In reply to: Plugin suggestions
Olaf Lederer
ParticipantI get it working!
I added those two replace function before the geshi object is created:
$code = str_replace("& lt;", "<", $code);
$code = str_replace("& gt;", ">", $code);and I use the default priority for the filters. Are the replacements a problem?
September 7, 2009 at 8:44 pm #78687In reply to: call register form via php tag
johnnydoe
Memberjust a another one quick…
i’d like to create a sidebar.php , and i’d like to add
<?php bb_get_sidebar(); ?>to a particular page (so not a global call to all pages).my experiment was:
<script>
function bb_get_sidebar() {
bb_load_template( 'sidebar.php' );
}
</script>in header.php (inside head).
2.
<?php bb_get_sidebar(); ?>(inside body).but no success, what am I doing wrong?
September 7, 2009 at 7:55 pm #67518In reply to: Plugin suggestions
Olaf Lederer
ParticipantI worked on the wp-syntax plugin but it doesn’t parse the code

do you have an idea what’s missing?
function allow_syntax_tag($tags) {
$tags['pre'] = array('lang' => array(), 'line' => array(), 'escaped' => array(), 'style' => array(), 'width' => array());
return $tags;
}
add_filter('bb_allowed_tags', 'allow_syntax_tag');
include_once("geshi/geshi.php");
if (!defined("BB_PLUGIN_URL")) define("BB_PLUGIN_URL", bb_get_uri() . "/my-plugins");
function wp_syntax_head()
{
$css_url = BB_PLUGIN_URL . "wp-syntax/wp-syntax.css";
echo "n".'<link rel="stylesheet" href="' . $css_url . '" type="text/css" media="screen" />'."n";
}
function wp_syntax_code_trim($code)
{
// special ltrim b/c leading whitespace matters on 1st line of content
$code = preg_replace("/^s*n/siU", "", $code);
$code = rtrim($code);
return $code;
}
function wp_syntax_substitute(&$match)
{
global $wp_syntax_token, $wp_syntax_matches;
$i = count($wp_syntax_matches);
$wp_syntax_matches[$i] = $match;
return "nn<p>" . $wp_syntax_token . sprintf("%03d", $i) . "</p>nn";
}
function wp_syntax_line_numbers($code, $start)
{
$line_count = count(explode("n", $code));
$output = "<pre>";
for ($i = 0; $i < $line_count; $i++)
{
$output .= ($start + $i) . "n";
}
$output .= "</pre>";
return $output;
}
function wp_syntax_highlight($match)
{
global $wp_syntax_matches;
$i = intval($match[1]);
$match = $wp_syntax_matches[$i];
$language = strtolower(trim($match[1]));
$line = trim($match[2]);
$escaped = trim($match[3]);
$code = wp_syntax_code_trim($match[4]);
if ($escaped == "true") $code = htmlspecialchars_decode($code);
//$code = clean_pre($code);// new
$geshi = new GeSHi($code, $language);
$geshi->enable_keyword_links(false);
do_action_ref_array('wp_syntax_init_geshi', array(&$geshi));
$output = "n<div class="wp_syntax">";
if ($line)
{
$output .= "<table><tr><td class="line_numbers">";
$output .= wp_syntax_line_numbers($code, $line);
$output .= "</td><td class="code">";
$output .= $geshi->parse_code();
$output .= "</td></tr></table>";
}
else
{
$output .= "<div class="code">";
$output .= $geshi->parse_code();
$output .= "</div>";
}
$output .= "</div>n";
return $output;
}
function wp_syntax_before_filter($content)
{
$content = preg_replace_callback(
"/s*<pre(?:lang=["']([w-]+)["']|line=["'](d*)["']|escaped=["'](true|false)?["']|s)+>(.*)</pre>s*/siU",
"wp_syntax_substitute",
$content
);
return $content;
}
function wp_syntax_after_filter($content)
{
global $wp_syntax_token;
$content = preg_replace_callback(
"/<p>s*".$wp_syntax_token."(d{3})s*</p>/si",
"wp_syntax_highlight",
$content
);
return $content;
}
$wp_syntax_token = md5(uniqid(rand()));
// Add styling
add_action('bb_head', 'wp_syntax_head');
// We want to run before other filters; hence, a priority of 0 was chosen.
// The lower the number, the higher the priority. 10 is the default and
// several formatting filters run at or around 6.
add_filter('post_text', 'wp_syntax_before_filter', 0);
// We want to run after other filters; hence, a priority of 99.
add_filter('post_text', 'wp_syntax_after_filter', 99);September 7, 2009 at 7:55 pm #31668Topic: WPMU 2.8.4a deep integration breaks RSS feed
in forum TroubleshootingGreg
ParticipantI have BP 1.0.2 and WPMU 2.8.4 with deep integration (I call wp-blog-header.php in ‘bb-config.php’).
All of the forum RSS feeds work, except the top level feed of all new posts across the forum: <site URL>/<forum name>/rss/
This is true for FF, IE and Safari.
In IE, I see the error:
Invalid xml declaration.
Line: 13 Character: 3
<?xml version="1.0" encoding="UTF-8"?>Viewing the source, it looks like WPMU is inserting an XML header above the bbPress XML header:
<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.8.4" -->
<rss version="0.92">
<channel>
<title>[SITE NAME] » Page not found</title>
<link>[SITE URL]</link>
<description>Just another [SITE NAME] weblog</description>
<lastBuildDate>Sun, 06 Sep 2009 14:07:54 +0000</lastBuildDate>
<docs>http://backend.userland.com/rss092</docs>
<language>en</language>
</channel>
</rss>
<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
ETC...Does anyone else have this issue.
I have repo’d something very similar on a previous version of the site that is using WPMU 2.2.
September 7, 2009 at 7:46 pm #78745In reply to: Plugin to display photos and html
kirpiit
MemberFor images you might want to try https://bbpress.org/plugins/topic/allow-images/
As for the html I’m not sure I understand your question.
Plain html should work
<img src="http://image-location.jpeg" />September 7, 2009 at 7:35 pm #77519In reply to: All RSS Feeds Broken?
Greg
Participant@kawauso, that line in the error is the source on line 13: “<?xml version=”1.0″?><!– generator=”bbPress” –>”
I should have looked at the source though. It seems that the xml has two headers. Could this be related to deep integration?
<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.8.4" -->
<rss version="0.92">
<channel>
<title>[SITENAME] » Page not found</title>
<link>http://[HOST]</link>
<description>Just another [HOST] weblog</description>
<lastBuildDate>Sun, 06 Sep 2009 14:07:54 +0000</lastBuildDate>
<docs>http://backend.userland.com/rss092</docs>
<language>en</language>
</channel>
</rss>
<?xml version="1.0"?><!-- generator="bbPress" -->
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<channel>
<title>[SITENAME] Forum » Recent Posts</title>
<link>http://[FORUM URL]b/</link>
<description>[SITENAME] » Recent Posts</description>
<language>en</language>
<pubDate>Mon, 07 Sep 2009 19:27:36 +0000</pubDate>
<item>September 7, 2009 at 7:34 pm #77518In reply to: All RSS Feeds Broken?
kirpiit
MemberOk, I got it! Or close to that…
I happen to have this patch on my system
https://bbpress.org/forums/topic/updated-to-desmond-but-theme-not-working#post-4254As I disable that, the magic is done and rss comes back to life!
While I cannot say “what” is wrong with such a patch, I’m happy to confirm that just eliminating it does the trick. In case anybody else has the same issue…
Thanks for the kind help to everybody, with a special thank to kawauso
September 7, 2009 at 7:01 pm #78735In reply to: Where to put adsense code?
fl00r97
MemberBrilliant!
I copied the code into header.php and tweaked it a bit to show the ad. Here’s the result: http://www.qtext.nl
Thank you so much.
P.s.: ik zie net in je profiel dat je ook uit Nederland komt!
September 7, 2009 at 6:34 pm #77517In reply to: All RSS Feeds Broken?
Adam Harley (Kawauso)
MemberAh crap, everything is breaking today

@Reboot Now: That looks like a different issue. Could you post line 13 of the broken RSS feed (view source)?
September 7, 2009 at 6:26 pm #77516In reply to: All RSS Feeds Broken?
Greg
ParticipantNot sure whether this is the same issue, but thought I’d post it here just in case. Before and after the above patch, I get exactly the same result. All of the RSS feeds display correctly, except the feed for all posts across the forums, that is, “<forum URL>/rss/”, which displays a blank page.
This is true for Firefox and IE7. On the problem page, IE gives the message “feed code error”, with the following details:
Invalid xml declaration.
Line: 13 Character: 3
<?xml version="1.0" encoding="UTF-8"?>[update] One difference between before and after the patch is the IE error. *Before* the patch it says:
Invalid xml declaration.
Line: 13 Character: 3
<?xml version="1.0"?><!-- generator="bbPress" -->One interesting thing: if I browse to “<forum URL>/rss.php” (note the php extension I added), then the top level feed displays fine.
Here are the details of the pages I browsed and the results. All well, except for the top level feed.
<forum URL>/rss/ [blank page] – this is the published feed
<forum URL>/rss [blank page]
<forum URL>/rss/topic/<topic name> [correct feed displays]
<forum URL>/rss/forum/<forum name> [correct feed displays]
<forum URL>/rss/forum/<forum name>/topics [correct feed displays]
But…
<forum URL>/rss.php [correct feed displays]
-
AuthorSearch Results