Search Results for 'codes'
-
AuthorSearch Results
-
December 21, 2009 at 6:03 pm #32602
Topic: Bug in post count?
in forum InstallationhpguruMemberHi, i have very good bbPress forum. I like bbPress. I am use a bbPress 1.0.2 but i may found 1 new bug.
I go to my bbPress dashboard and see posts count, thats say: 4024 posts.
Then i go to bb-admin/posts.php and i see 1 – 20 / 4,121. This mean i have 4121 posts on my forum.
I try recounting without any help to this problem.
My plugins now:
Akismet
Human Test For bbPress
Topics Per Page
bbSmilies (maybe smilies from WordPress plugin, i change it name, when i modified smilies codes)
November 11, 2009 at 2:15 am #81301In reply to: Post_Text Front Page
DoobusMemberA bit surprised no one has chimed in yet, didn’t think it was that difficult to achieve.
Anyways here is the code that I found in another thread:
<?php
function get_post_teaser($chars = 200){
global $bbdb;
$topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic
$first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1");
$content = substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0, $chars); //gets the first 200 chars of the post
return $content;
}
?>I figured it’s the same basis, however since I’m pretty much brain dead in regards to php I can’t for the life of me make the post_text show fully. This code strips out html code so links don’t show, how can the code be altered to allow html? I figure this code is similar to WordPress’ content_excerpt. If there is another way, I’m open to suggestions.
Sorry for all the newbie questions, I assure you I’ve tried my best to track down my issues in the forum search before asking my questions, unfortunately due to lack of a codex and documentation I’m pretty much at a lost.
October 27, 2009 at 7:54 am #80920In reply to: Display Custom-Userfields in Forumposts
ArioMemberIt is possible I would think. I am going to do some experimenting on it but if you are looking for a good plugin to deconstruct and learn from (what I am doing since I lack the skill to make something from scratch) then try looking at the Gaming Codes plugin.
October 9, 2009 at 12:53 am #80307In reply to: Making `from` a link in Topic View
chandersbsMemberThanks for posting the solution also, I was looking at my codes if I could get a solution, but I couldn’t, when I looked back at this topic, I saw the solution already posted.
October 2, 2009 at 12:34 am #80011gerikgMemberThe way I did it was to duplicate kakamei theme (not the blue) and put it in the my-template.
Then started with the BB header, I copied what was in the WP header. I took everything out after the body tag except for the “main” div. The BB footer I did the same. I just made sure there were enough div closing tags. Then copied over the codes that apply for the header and footer from the WP css. Most WP theme has two column one main and one sidebar. I treated BB like it was wordpress, one side the main section and the other sidebar. I treated the MAIN div as the main section and View/Hottags as the sidebar. I know this is not the best explanation but I hope you get the idea. It just takes a lot of css work.
September 27, 2009 at 2:37 pm #50311In reply to: Combined Register + Post
Adam Harley (Kawauso)MemberOkay, after much lucky guessing with regards to the user object handling, I have an ALPHA VERSION of a plugin to do this. There’s nothing to stop spambots, this is purely a proof of concept, I’ll try adding a captcha or something later if necessary. Email verification sounds like a royal pain though. Save the files exactly where I’ve said and as ever, make sure you leave no whitespace around the PHP tags. Apart from that, please test it but it’s your own risk if you run it on a production server.
my-plugins/register-post/load.php:
<?php
/*
Plugin Name: Register & Post
Description: Allows a user to register and make a post at the same time.
Author: Kawauso
Version: Alpha
*/
// Add the post form
add_action( 'post_post_form', 'register_post_form' );
function register_post_form() {
global $h2, $forum, $topic;
if( bb_is_user_logged_in() )
return;
// Setup the register form
$profile_info_keys = bb_get_profile_info_keys();
unset( $profile_info_keys['first_name'], $profile_info_keys['last_name'], $profile_info_keys['display_name'], $profile_info_keys['occ'], $profile_info_keys['from'], $profile_info_keys['user_url'], $profile_info_keys['interest'] );
$bb_register_error = new WP_Error;
$user_login_error = $bb_register_error->get_error_message( 'user_login' );
?>
<style type="text/css">p#post-form-forum-container{display:none}</style>
<form class="postform post-form" id="postform" method="post" action="<?php bb_uri( 'my-plugins/register-post/create.php', null, BB_URI_CONTEXT_FORM_ACTION )?>">
<h2 class="postform">Register and post?</h2>
<fieldset>
<table width="100%">
<tr class="form-field form-required required<?php if ( $user_login_error ) echo ' form-invalid error'; ?>">
<th scope="row">
<label for="user_login"><?php _e('Username'); ?></label>
<?php if ( $user_login_error ) echo "<em>$user_login_error</em>"; ?>
</th>
<td>
<input name="user_login" type="text" id="user_login" size="30" maxlength="30" value="<?php echo $user_login; ?>" />
</td>
</tr>
<?php
if ( is_array($profile_info_keys) ) :
foreach ( $profile_info_keys as $key => $label ) :
$class = 'form-field';
if ( $label[0] ) {
$class .= ' form-required required';
}
if ( $profile_info_key_error = $bb_register_error->get_error_message( $key ) )
$class .= ' form-invalid error';
?>
<tr class="<?php echo $class?>">
<th scope="row">
<label for="<?php echo $key?>"><?php echo $label[1]?></label>
<?php if ( $profile_info_key_error ) echo "<em>$profile_info_key_error</em>"; ?>
</th>
<td>
<input name="<?php echo $key?>" type="text" id="<?php echo $key?>" size="30" maxlength="140" value="<?php echo $$key?>" />
</td>
</tr>
<?php
endforeach; // profile_info_keys
endif; // profile_info_keys
?>
</table>
<br />
<?php
bb_load_template( 'post-form.php', array('h2' => $h2) );
bb_nonce_field( bb_is_topic() ? 'create-post_' . $topic->topic_id : 'create-topic' );
if ( bb_is_forum() ) {
echo '<input type="hidden" name="forum_id" value="' . $forum->forum_id . '" />' . "n";
} elseif ( bb_is_topic() ) {
echo '<input type="hidden" name="topic_id" value="' . $topic->topic_id . '" />' . "n";
}
echo "n</fieldset>n</form>n";
}my-plugins/register-post/create.php:
<?php
require_once('../../bb-load.php');
$profile_info_keys = bb_get_profile_info_keys();
unset( $profile_info_keys['first_name'], $profile_info_keys['last_name'], $profile_info_keys['display_name'], $profile_info_keys['occ'], $profile_info_keys['from'], $profile_info_keys['user_url'], $profile_info_keys['interest'] );
$user_login = '';
$user_safe = true;
$bb_register_error = new WP_Error;
if ( $_POST && 'post' == strtolower($_SERVER['REQUEST_METHOD']) ) {
$_POST = stripslashes_deep( $_POST );
$_POST['user_login'] = trim( $_POST['user_login'] );
$user_login = sanitize_user( $_POST['user_login'], true );
if ( $user_login !== $_POST['user_login'] ) {
$bad_input = true;
if ( $user_login )
$bb_register_error->add( 'user_login', sprintf( __( "%s is an invalid username. How's this one? <strong>%s</strong>" ), esc_html( $_POST['user_login'] ), $user_login ) );
else
$bb_register_error->add( 'user_login', sprintf( __( '%s is an invalid username.' ), esc_html( $_POST['user_login'] ) ) );
}
foreach ( $profile_info_keys as $key => $label ) {
if ( is_string($$key) )
$$key = esc_attr( $$key );
elseif ( is_null($$key) )
$$key = esc_attr( $_POST[$key] );
if ( !$$key && $label[0] == 1 ) {
$bad_input = true;
$$key = false;
$bb_register_error->add( $key, sprintf( __( '%s is required' ), $label[1] ) );
}
}
if ( !$bad_input ) {
// Invoke non-user post checks here
if ( !$post_content = trim($_POST['post_content']) )
bb_die(__('You need to actually submit some content!'));
if ( isset($_POST['topic']) && $forum_id = (int) $_POST['forum_id'] ) {
$topic = trim( $_POST['topic'] );
if ('' == $topic)
bb_die(__('Please enter a topic title'));
} elseif ( isset($_POST['topic_id'] ) ) {
$topic_id = (int) $_POST['topic_id'];
bb_check_admin_referer( 'create-post_' . $topic_id );
}
if ( !topic_is_open( $topic_id ) )
bb_die(__('This topic has been closed'));
// Invoke registration
$user_id = bb_new_user( $user_login, $_POST['user_email'], null );
if ( is_wp_error( $user_id ) ) { // Error creating user
foreach ( $user_id->get_error_codes() as $code )
$bb_register_error->add( $code, $user_id->get_error_message( $code ) );
if ( $bb_register_error->get_error_message( 'user_login' ) )
$user_safe = false;
} elseif ( $user_id ) { // Registration success
foreach( $profile_info_keys as $key => $label )
if ( strpos($key, 'user_') !== 0 && $$key !== '' )
bb_update_usermeta( $user_id, $key, $$key );
do_action('register_user', $user_id);
// Create the current user object
$wp_auth_object->set_current_user( $user_id );
$bb_current_user = $wp_auth_object->current;
// Do last minute post/topic checks
if ( !empty($topic) && $forum_id = (int) $_POST['forum_id'] ) {
if ( !bb_current_user_can('write_posts') )
bb_die(__('You are not allowed to post. Are you logged in?'));
if ( !bb_current_user_can( 'write_topic', $forum_id ) )
bb_die(__('You are not allowed to write new topics.'));
if ( !bb_current_user_can( 'write_topic', $forum_id ) )
bb_die(__('You are not allowed to write new topics in this forum.'));
bb_check_admin_referer( 'create-topic' );
$topic_id = bb_new_topic( $topic, $forum_id, $tags );
}
if ( !bb_current_user_can( 'write_post', $topic_id ) )
bb_die(__('You are not allowed to post in this topic.'));
// Create the new post
$post_id = bb_new_post( $topic_id, $_POST['post_content'] );
$tags = trim( $_POST['tags'] );
bb_add_topic_tags( $topic_id, $tags );
$link = get_post_link( $post_id );
$topic = get_topic( $topic_id, false );
if ( $topic->topic_posts )
$link = add_query_arg( 'replies', $topic->topic_posts, $link );
do_action( 'bb-post.php', $post_id );
if ( $post_id )
wp_redirect( $link );
else
wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
exit;
}
}
}
// If you've reached this point, there must have been an error
$user_login_error = $bb_register_error->get_error_message( 'user_login' );
if( empty( $user_login_error ) ) // For some reason, error strings are not always available (i.e. for invalid emails)
$user_login_error = __( 'Something went wrong! Check what you entered and try again.' );
bb_die( $user_login_error );September 20, 2009 at 12:23 am #79508gerikgMemberand you need this for images https://bbpress.org/plugins/topic/allow-images/#post-6
September 20, 2009 at 12:02 am #79507sixyofoMemberThanks!!
September 19, 2009 at 11:57 pm #79506September 19, 2009 at 11:47 pm #31815Topic: Can I embed codes and show videos and pictures in bbPress
in forum PluginssixyofoMemberI’m trying to embed one in this topic
<object width=”560″ height=”340″><param name=”movie” value=”http://www.youtube.com/v/pM1Z1y4-Ylg&hl=zh_TW&fs=1&”></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/pM1Z1y4-Ylg&hl=zh_TW&fs=1&” type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”560″ height=”340″></embed></object>
NOt working.. > <
September 17, 2009 at 9:57 am #79227In reply to: Google Analytics
mba-studiumMemberI think you can track this seperataly with two codes.
September 4, 2009 at 5:27 pm #78614In reply to: Failing miserably at porting theme
gerikgMemberThis is how I’m doing it. Please, this is not the official how to on this.
PART 1
COPY Kakemi theme into my-template. Open Style.css and change this line, Theme Name: Kakumei
I changed it to Theme Name: Kakumei (Edited Theme)
Activate it, you’ll see Kakumei’s screen shot but Kakumei (Edited Theme) as it’s name.
Then open style.css of the Edited Theme and open the CSS of the WordPress theme. Their might be multiple css so look out. I make a line in the style.css at the bottom.
/*********************** WPTHEME *******************
Then start with Header.php and footer.php start copying over the codes from WP theme to BBpress theme. Slowly start looking at the classes it that the header uses and start bringing in the codes from the WP to BBpress CSS. BEWARE some of them uses the same class! so rename the WP one not the BBpress one!!! You will have to replace all the div tags and such. The only one I recommend to keep in the header is the
<div id="main">
at the end. The same with the footer. but remember to put an extra</div>
on the top to cover the<div id="main">
in the header. Start with that. If you can get the hang of it then you’ll be able to continue.August 28, 2009 at 9:18 pm #76608In reply to: cookie integration problem, another
gerikgMembertry add the same codes to bb-config without the Hash
August 25, 2009 at 3:50 am #78296In reply to: How to echo "nice_username" from post_author ?
gerikgMemberanandasama here’s acouple of codes that will help you. I think I know what you’re planning.
This will put the user’s name with link to their buddypress profile:
<?php echo post_author_link();?>
This will get the user’s login name:
<?php echo get_user_name( get_post_author_id() ); ?>
This is you can send message like PM but it uses message in Buddypress:
<a href="<?php echo get_option('home') ?>/members/
<?php global $current_user;get_currentuserinfo();echo($current_user->user_login);
?>/messages/compose/?r=<?php echo get_user_name( get_post_author_id() ); ?>">Send Message</a>August 24, 2009 at 7:00 pm #78336In reply to: inove theme has a bad suspected link
gerikgMember_ck_ they did it to your theme too.
https://bbpress.org/forums/topic/theme-hybrid-kakumeibbpressorg-template#post-56316
it’s that website adding codes to the header and removing the original author’s footer.
August 20, 2009 at 10:07 pm #78226In reply to: How do you paginate posts?
johnhilerMemberunholyfruitbat – Glad that we narrowed it down. Do you have a program to compare two text files? I use Beyond Compare and love it:
http://www.scootersoftware.com/download.php
You could use that to compare theme pages like front-page.php… and see what differences there are in your theme codes.
August 17, 2009 at 3:14 am #77788In reply to: Sometimes Less Is Just Less
chandersbsMemberI really love bbPress, but still wished some features existed by default. I know it’s doable via plugins, but default features are more cool, you can always turn it off. I really dislike the fact that some of the solutions I have seen on this forum, are related to “integrate your forum with WordPress, and use this plugin and it will work”, no, I don’t like that. bbPress should be able to do stuff on its own, without WordPress.
I don’t want to install WordPress for the sake of making some things work. I have been a WordPress user for so many years already, but still I refuse to do that. I have managed to convert my forum, which was originally SMF into bbPress (SMF > phpBB > bbPress), that was a lot of work, but I’m really happy I did that.
bbPress is by default very EMPTY, very very very empty. I was not used to a forum, with so less features and options. My users didn’t like it. I managed to add a lot of features via plugins. Now my users are a bit happy, I’m also very happy.
The best part I love so far is, that making changes not always is so difficult compared to SMF or phpBB. phpBB is the last forum software on this planet I’d want to use, OMG so difficult to make changes. SMF is one of the best out there, but has some limits due to their copyright system.
Some things I’d really love to see happening anytime very soon:
1. A codex page, with detailed instruction about the codes, just like its big brother WordPress has, at least a start, so we, the webmasters, can do more cool stuff
2. More features by default, such as:
a. Private message
b. Avatar upload
c. Memberlist
d. Quote option in topics
e. Smilies
These are some very basic options.
I’m sure bbPress will be one of the most professional forum software out there one day, it’s not so far yet, but I see it happen.
That’s why I’m a proud user of this software.
August 16, 2009 at 7:21 pm #78106In reply to: Bavatars doesn't work!
Marius-MemberAgain, I have no clue about permissions and codes and stuff. I just upload files to my server. And no, that directory does not exist. Atleast not as I can see.
August 13, 2009 at 8:35 pm #76987Marius-MemberThanks man. Can I post both codes without them conflicting each other?
Both border radius and mozilla codes?
And using border-radius, do you have input each of the four corners, like in the Moz-code? Or can you just specify one line like the one you gave me?
July 29, 2009 at 7:05 pm #56568In reply to: limit forums included in latest discussions
anandasamaMemberSomehow both of your codes doesnt work.
July 20, 2009 at 9:20 am #76617In reply to: show a snippet of the post under the topic title?
GautamMemberCreate a functions.php file in your theme folder, and write this in it:
<?php
function get_post_teaser($chars = 200){
global $bbdb;
$topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic
$first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1");
$content = substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0, $chars); //gets the first 200 chars of the post
return $content;
}
?>Then at the front page, put this where you need to display the post text (it should be inside the loop):
<?php echo get_post_teaser(200); ?>
You can change that 200 to anything, any number of letters you want. Default is 200.
I think, this should work.
July 17, 2009 at 10:24 am #75196In reply to: How to send forum posts to email
GautamMemberCan you give me the current source of the plugin you have made?
You can get the post text (of the first post of the topic) by:
global $bbdb;
$topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic
$first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1");
$content = urlencode(substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0,300));
$content = str_replace('+','%20', $content);
$content = str_replace("’","'", $content);
$post_summary = stripslashes($content);
July 15, 2009 at 1:06 pm #76122In reply to: How to insert ads other than google ads
Ipstenu (Mika Epstein)ModeratorI meant show code in the forums.
This is code, it's preformatted
so that I can space things out funny.AdSense For bbPress seems to be broken with bb 1.0.1, but seeing as the plugin tells you to edit your theme, you’re probably going to be best off just putting in your codes into your theme template files.
July 15, 2009 at 1:06 am #76121In reply to: How to insert ads other than google ads
birdy404Memberoh and in your response you’d mentioned something about wanting to show codes…no, i don’t want to show the codes. All i want is for the ads to show on the pages i want them to.
thanks!!
July 14, 2009 at 12:28 pm #76118In reply to: How to insert ads other than google ads
birdy404Memberi downloaded the plugins ADSENSE FOR BBPRESS and GOOGLE ADSENSE CONFIGURATION. The former gives an option to insert codes but when i put in my OpenX code nothing shows up. The latter, however, displays my OpenX ads, only problem is it shows up in the footer when i want it in the header and between posts. i tried inserting the html codes directly in my themes but it shows as html codes and not as an ad. am i doing something wrong? please let me know.
Also, can any of you please help me configure it to not only show up in the footer? here’s the coding for that plugin:
<?php
/*
Plugin Name: Simple Google Adsense
Plugin URI: http://www.strapontins.org/people/rentendre/simple-google-adsense-bbpress/
Description: Add Google Adsense code in your bbPress forum, in the footer All users are welcome to improve on it :p
Author: Frédéric Petit
Author URI: http://www.strapontins.org/
Version: 0.2
License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/
*/
add_action(‘bb_admin_menu_generator’, ‘bb_gad_configuration_page_add’);
add_action(‘bb_admin-header.php’, ‘bb_gad_configuration_page_process’);
function bb_gad_configuration_page_add() {
bb_admin_add_submenu(__(‘Google Adsense Configuration’), ‘use_keys’, ‘bb_gad_configurtion_page’);
}
function bb_gad_configurtion_page(){?>
<h2><?php _e(‘Google Adsense Configuration’); ?></h2>
<form class=”options” method=”post” action=””>
<fieldset>
<label for=”ga_key”>
<?php _e(‘Google Adsense User Id:’) ?>
</label>
<div>
<textarea class=”text” name=”ga_key” id=”ga_key” value=”<?php bb_form_option(‘ga_key’); ?>” ></textarea>
<?php _e(‘Put your adsense code, without the code of the script pagead2.googlesyndication.com/pagead/show_ads.js’); ?>
</div>
</fieldset>
<fieldset>
<?php bb_nonce_field( ‘ga-configuration’ ); ?>
<input type=”hidden” name=”action” id=”action” value=”update-ga-configuration” />
<div class=”spacer”>
<input type=”submit” name=”submit” id=”submit” value=”<?php _e(‘Update Configuration »’) ?>” />
</div>
</fieldset>
</form>
<?php
}
function bb_gad_configuration_page_process() {
if ($_POST == ‘update-ga-configuration’) {
bb_check_admin_referer(‘ga-configuration’);
if ($_POST) {
$value = stripslashes_deep( trim( $_POST ) );
if ($value) {
bb_update_option(‘ga_key’, $value);
} else {
bb_delete_option(‘ga_key’ );
}
} else {
bb_delete_option(‘ga_key’);
}
$goback = add_query_arg(‘ga-updated’, ‘true’, wp_get_referer());
bb_safe_redirect($goback);
}
if ($_GET) {
bb_admin_notice( __(‘Configuration saved.’) );
}
}
// Bail here if no key is set
if (!bb_get_option( ‘ga_key’ ))
return;
function createGAdCode($accountId) {
$code .= ‘<div class=’bbpress_adsense’>’ . “n”;
$code .= ‘ ‘ . $accountId . ‘ ‘ . “n”;
$code .= ‘<script type=’text/javascript’ src=’http://pagead2.googlesyndication.com/pagead/show_ads.js’></script>’ . “n”;
$code .= ‘</div>’ . “n”;
return $code;
}
function insertGAdCode() {
$accountId = bb_get_option(‘ga_key’);
if ($accountId != ”) {
echo createGAdCode($accountId);
}
}
add_action(‘bb_foot’, ‘insertGAdCode’);
?>
-
AuthorSearch Results