Search Results for 'code'
-
AuthorSearch Results
-
August 12, 2007 at 10:38 am #2236
Topic: Plugin: bbPortal 1.3 released
in forum PluginsNull
MemberbbPortal 1.3 has some several bug fixes and minor code improvements:
– bbPortal now uses the bb_admin_add_submenu hook
– Topics that are marked as spam or are “deleted” will no longer show up at the portal page
– Textfields in the admin area will now return a value (if there is one) instead of leaving the fields blank
– Merged bbPortal and the bbMenu plugin. It’s no longer needed to have the bbMenu plugin installed
This is also the last version I release using the prototype libary. The next version will be jQuery based and smaller in size.
You can download bbPortal 1.3 here:
http://www.bbportal.org/bb-downloads/bbportal1.3.zip
More info: http://www.bbportal.org
_Null
August 12, 2007 at 5:23 am #2235Topic: My first attempt on BBpress
in forum Showcaseneilogic
MemberHi there, here’s my first attempt on BBpress , although I have been pretty good at making website’s with WordPress but this was my first attempt to have a forum’s at my very new blog.
Here’s the link to my forums powered by BBpress.
http://www.aguywitha.com/_main/forum
I had a choice of integrating it with wordpress using the wordpress header and footer … but in my case i felt that designing a bbpress in itself like my wordpress theme was a bit easy for me as I was having some difficulties with integrating it with my blog interface … so I managed to make the default kakumei theme look my original wordpress blog theme … and integrate the users …
Although there will always be small changes being made on the forums as this was the first time i went through the BBpress code and I just love the simplicity.
Thanks a lot …
August 12, 2007 at 2:45 am #53072In reply to: Request: Polls
mciarlo
MemberGreat news
.
August 12, 2007 at 12:50 am #58886neyoung
MemberWhere do I put this code? In bbpress/register.php somewhere I’m assuming?
August 11, 2007 at 9:28 pm #2223Topic: Using values from the db in your textfield/ddlb?
in forum TroubleshootingNull
MemberHi,
You can add values into a textfield like this:
<input type="text" name="number_of_topics" id="number_of_topics" value="<?php echo bb_get_option( 'bbp_number_of_topics' ); ?>"/>Now there will be a value when the texfield is loaded. But what if there is no value, how can I let it show 0 then? using
: 0wont work.Sec question:
Same tactics as above, but now with a ddlb. I can’t get this fixed. How can i show the value in a ddlb?
Got this:
<td><?php forum_dropdown(); ?></label></td>but where do I put that value thingy?Many thx
_Null
August 11, 2007 at 7:47 pm #59898Null
MemberI think I have figured it out, thanks.
But 1 more thing. What if I have 2 forms:
function myplugin_two() {
plugin_form1();
}and
function ????_???() {
plugin_form2();
}myplugin_two is the function that goes under tab 2. It now shows form1, but how can I let it show form2 also under tab 1?.I’ve enterd ???? now cause we can’t have 2 funtions with the same name.
…………. omg never mind…. I see it now. You can call both forms in the first function and just position them using html and stuff.
Okay thanks again, this problem is solved!
_Null
August 11, 2007 at 1:41 pm #55053In reply to: Japanese translation
JOTAKI, Taisuke
ParticipantHi,
I have made ja translation based on yours. Thank you!
August 10, 2007 at 9:30 pm #59595In reply to: Limit long words
howtogeek
MemberHere you are… ported from wp-chunk (literally only had to change the filter names)
<?php
/*
Plugin Name: bb-chunk
Description: Shortens the display of urls so they won't break your site theme. Ported from wp-chunk 2.0 ( http://www.village-idiot.org/archives/2006/06/29/wp-chunk/ )
Author: The How-To Geek
Author URI: http://www.howtogeek.com
Version: 0.1
*/
function make_chunky($ret)
{
// pad it with a space
$ret = ' ' . $ret;
$ret = preg_replace("#(^|[n ])([w]+?
/[w#$%&~/.-;:=,?@[]+]*)#is", "$1<a href='$2' rel='nofollow'>$2</a>", $ret);
$ret = preg_replace("#(^|[n ])((www|ftp).[w#$%&~/.-;:=,?@[]+]*)#is", "$1<a href='http://$2' rel='nofollow'>$2</a>", $ret);
//chunk those long urls
chunk_url($ret);
$ret = preg_replace("#(s)([a-z0-9-_.]+)@([^,< nr]+)#i", "$1<a href="mailto:$2@$3">$2@$3</a>", $ret);
// Remove our padding..
$ret = substr($ret, 1);
return($ret);
}
function chunk_url(&$ret)
{
$links = explode('<a', $ret);
$countlinks = count($links);
for ($i = 0; $i < $countlinks; $i++)
{
$link = $links[$i];
$link = (preg_match('#(.*)(href=")#is', $link)) ? '<a' . $link : $link;
$begin = strpos($link, '>') + 1;
$end = strpos($link, '<', $begin);
$length = $end - $begin;
$urlname = substr($link, $begin, $length);
/**
* We chunk urls that are longer than 50 characters. Just change
* '50' to a value that suits your taste. We are not chunking the link
* text unless if begins with 'http://', 'ftp://', or 'www.'
*/
$chunked = (strlen($urlname) > 50 && preg_match('#^(http://|ftp://|www.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -10) : $urlname;
$ret = str_replace('>' . $urlname . '<', '>' . $chunked . '<', $ret);
}
}
remove_filter('post_text', 'make_clickable');
add_filter('post_text', 'make_chunky');
?>August 10, 2007 at 2:46 pm #59897Sam Bauers
ParticipantI’m not sure I understand your question exactly…
Any function you declare in a plugin is callable from anywhere else in that plugin. So…
function myplugin_two()
{
myplugin_base('two');
echo '<br />Some more text<br />';
also_tab2();
}etc.. etc..
August 10, 2007 at 1:25 pm #53833In reply to: k2 for bbpress
linickx
Participant@schmitt, Thanks for the feedback

No I don’t have an SVN for the k2 BBPress theme, but what changes would you submit. Before posting please think about my following points.
(a) I have not yet implemented a “proper” tab bar , like the solution posted by Sabutay as “normal” users don’t like editing things…. what ever I implement as a template would be wrong for the majority of people.
(b) fam-fam icons, I do want to do, but I don’t want to unnecessarily bloat the theme, just installing a ccs file is kinda cool. Just using a css also makes the theme more “secure”, i.e. anyone who developed their theme from the original wordpress kubrick theme has had to keep releasing updates in order for the theme not to be vulnerable to XSS various attacks.
August 10, 2007 at 1:08 pm #59873In reply to: theme: hybrid kakumei+bbpress.org template
_ck_
ParticipantIt’s like that on purpose

That hosting only costs like $10 a year but it still costs.
Obviously if anyone wanted to use the template I’d either remove the ad entirely or put a space there if they wanted.
August 10, 2007 at 10:58 am #59863In reply to: bbMenu 1.2 released!
Null
MemberAdding new links will be supported in version 2, for now you will have to do it using phpMyAdmin or using a plugin

Excample plugin (not yet tested and the bbmenu plugin needs to be active/working):
<?php
/*
Plugin Name: add bbMenu tab
Plugin URI: http://www.bbportal.org/
Description: Adds a tab to the bbMenu list
Author: Maurice de Regt
Author URI: http://www.mauricederegt.nl/
Version: 1.0
NOTES:
- for xxxx use something normal like: "googletab" if you make a tab to the google.com page
- for 'YOUR-TITLE': This will be the text you can edit, make sure it is between the 'tags'
- for 'URL-OF-PAGE': This will be the page you'll go to when you click the menutab, make sure it's between the 'tags'
- These added tabs WILL NOT stay highlighted when you are on that page. This requires some more complex stuff
*/
// Check if the bbPortal menu tab exists
function xxxx_check_tab() {
global $bbdb;
$bbdb->hide_errors();
$bxxxx_tab = true;
if (!$bbdb->query("SELECT * FROM ~$bbdb->menu~ WHERE ~location~ = 'xxxx-page'")) {
return xxxx_add_tab();
}
$bbdb->show_errors();
return $xxxx_tab;
}
// If it doesn't, install the menu tab
function xxxx_add_tab() {
global $bbdb;
$query = "INSERT INTO ~$bbdb->menu~ VALUES
(DEFAULT, 'YOUR-TITLE', 'inactive', 'URL-OF-PAGE', 'xxxx-page', 0);";
$bbdb->query($query);
}
?>NOTES:
– for xxxx use something normal like: “googletab” if you make a tab to the google.com page
– for ‘YOUR-TITLE’: This will be the text you can edit, make sure it is between the ‘tags’
– for ‘URL-OF-PAGE’: This will be the page you’ll go to when you click the menutab, make sure it’s between the ‘tags’
– These added tabs WILL NOT stay highlighted when you are on that page. This requires some more complex stuff
REPLACE ALL ~ with backticks, since this forum filters them out
August 10, 2007 at 10:34 am #57318In reply to: Plugin: bb-Topic-Views
mazdakam
Member
_CK_ i could not udrestand what should i do you mean i found function get_view_count ( $topic_id )
and
function initialize_view_count( $topic_id )
and put this line above them?
if (!$topic_id) return;
August 10, 2007 at 9:05 am #59896Null
MemberOkay
function myplugin_one()
{
myplugin_base('one');
}Will appear under tab1
function myplugin_two()
{
myplugin_base('two');
}Will appear under tab2
Now I have another function (let’s call it
function also_tab2())I want under tab2, how do I get it in tab2? Sorry I just don’t see it
August 10, 2007 at 8:29 am #59895Sam Bauers
ParticipantI think the answer to all your questions is no. : )
I only pointed to the LDAP plugin for an example of processing a form in the admin area.
If you want to re-use the same function for all admin pages then you have to create functions that call the main function. E.g.
add_action( 'bb_admin_menu_generator', 'myplugin_add_admin_page' );
function myplugin_add_admin_page() {
bb_admin_add_menu(__('My plugin'), 'use_keys', 'myplugin');
bb_admin_add_submenu(__('My plugin sub menu item one'), 'use_keys', 'myplugin_one', 'myplugin');
bb_admin_add_submenu(__('My plugin sub menu item two'), 'use_keys', 'myplugin_two', 'myplugin');
}
function myplugin_base($number)
{
echo 'hello admin ' . $number;
}
function myplugin_one()
{
myplugin_base('one');
}
function myplugin_two()
{
myplugin_base('two');
}I think that’s what you are asking anyway.
August 10, 2007 at 7:47 am #59894Null
MemberHi,
Thanks, so the LDAP also uses more subtabs with different functions/forms in it?
I’ll take a look at it then. If I have more questions about it, I’ll post them here
Thanks for your time
Greetings
ps: is it also possible to name all the functions you want on tab1 to put them in the menu generator function?
Like:
bb_admin_add_submenu(__('My plugin sub menu item one'), 'use_keys', 'myfunctionname1', 'myfunctionname2','myfunctionname3','myplugin');Or put all functions in 1 parent function like:
bb_admin_add_submenu(__('My plugin sub menu item one'), 'use_keys', 'myplugin1', 'myplugin');Function name: myplugin1
this function contains 3 other functions
end function: myplugin1
August 10, 2007 at 7:38 am #58845In reply to: unable to log in to wp after installing bbpress
suff
MemberWell…I’ve resolved my (and maybe also your) problem… the problem was that I’ve used the same db prefix for both bbpress and wordpress… I feel like an idiot
I just didn’t read the instructions too carefuly
August 10, 2007 at 7:24 am #58844In reply to: unable to log in to wp after installing bbpress
suff
MemberI have the same problem…
August 10, 2007 at 4:05 am #59893Sam Bauers
ParticipantFrom what you have it is pretty easy.
Just create two functions that contain the content you want displayed, they need to be named after the third variable in the sub menu function:
... your code ...
function myplugin()
{
echo 'hello admin';
}
function myplugin_two()
{
echo 'hello again admin';
}Intercepting post data is another matter though. Then you need to add an action to “bb_admin_head” I think.
Check out my existing LDAP authentication plugin for some decent example code.
August 10, 2007 at 3:57 am #59899In reply to: Plugin Idea: Daily New Topics Digest
_ck_
ParticipantI guess you’ll see that the way it works around here is you get the idea, you volunteer to make the plugin

Start coding. But seriously, without cron jobs or pseudo cron it will be tricky to do this. A plugin would have to check the time of day each time it runs and then keep whatever user is currently visiting on a delay while it emails however many people. This can be problematic. What if the site is fairly idle at that time when it should email and noone is visiting? What if there are 100 emails to send, will the people be kept waiting over a minute or two?
Personally I’m just using yahoo rss to email alerts. It watchs the rss feed for you for changes.
But this plugin could be easily changed to have two checkboxes, one to just email a summary at end of day, vs when it happens:
August 9, 2007 at 9:39 pm #53828In reply to: k2 for bbpress
fel64
MemberFind the .post rule and add
overflow: auto;to it. That way there will be a scroll bar at the bottom if anything is too long.overflow: hidden;will simply hide it instead.Also, if you didn’t know bb does let you search.
Hit up http://www.nyquistcapital.com/forums/search.php . You can also add a search form to your template but I’m not sure just how.
August 9, 2007 at 9:32 pm #2224Topic: Question for SamBauers about the menu generator function
in forum PluginsNull
MemberHeya Sam,
Since you came up with the following function, I think you can help me answer a question about it.
The function:
add_action( 'bb_admin_menu_generator', 'myplugin_add_admin_page' );
function myplugin_add_admin_page() {
bb_admin_add_menu(__('My plugin'), 'use_keys', 'myplugin');
bb_admin_add_submenu(__('My plugin sub menu item one'), 'use_keys', 'myplugin', 'myplugin');
bb_admin_add_submenu(__('My plugin sub menu item two'), 'use_keys', 'myplugin_two', 'myplugin');
}This works, it will add 2 submenu’s to my new menu, but how to show up things like forms under each tab?
Let’s say I have submenu tab1 and tab2. Under tab1 I want to show form X and use some functions. Under tab2 I want to show form Z and again have some functions their to use the form etc. But how do I declare where it will show what? How do I get stuff under tab1 and how under tab2?
Do you understand what I mean? Can you give me an excample too?
Many thanks
ps. anyone can answer ofcourse
August 9, 2007 at 5:04 pm #59818In reply to: bbPress Login from WordPress
MaryJane
MemberYea after i tried posting it in there a few times i figured that out. Will do boss!
August 9, 2007 at 4:59 pm #59817In reply to: bbPress Login from WordPress
fel64
MemberIf you’d be so kind as to take all that code out of your post and put it in http://pastebin.ca/ then link to it, that’d be nice. Also, bb doesn’t by default use bbCode. Code is delimited by ` backticks.
August 9, 2007 at 4:56 pm #59892In reply to: Always login
fel64
MemberI think bb_cookie is in pluggable.php, so yes. Just look for wordpress documentation on overwriting functions like this (achieveable through plugins).
Also easy.

add_action('bb_init', 'chuck_out_lusers');
function chuck_out_lusers() {
if( !bb_get_current_user() && bb_get_location != 'login-page' ) {
header('Location: http://blah.example.com/bb-login.php');
exit;
}
} -
AuthorSearch Results