Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,301 through 29,325 (of 32,491 total)
  • Author
    Search Results
  • #55053

    In reply to: Japanese translation

    JOTAKI, Taisuke
    Participant

    Hi,

    I have made ja translation based on yours. Thank you!

    http://bbpress-ja.googlecode.com/svn/tags/0.8.2.1/

    #59595

    In reply to: Limit long words

    howtogeek
    Member

    Here 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');
    ?>

    #59897
    Sam Bauers
    Participant

    I’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..

    #53833

    In 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.

    #59873
    _ck_
    Participant

    It’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.

    #59863

    In reply to: bbMenu 1.2 released!

    Null
    Member

    Adding 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

    #57318

    In reply to: Plugin: bb-Topic-Views

    mazdakam
    Member

    :D _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;

    #59896
    Null
    Member

    Okay

    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 :)

    #59895
    Sam Bauers
    Participant

    I 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.

    #59894
    Null
    Member

    Hi,

    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

    #58845
    suff
    Member

    Well…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 :D I just didn’t read the instructions too carefuly :D

    #58844
    suff
    Member

    I have the same problem… :(

    #59893
    Sam Bauers
    Participant

    From 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.

    #59899
    _ck_
    Participant

    I 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:

    https://bbpress.org/plugins/topic/23

    http://www.la-school.com/2006/bbpress-notification/

    #53828

    In reply to: k2 for bbpress

    fel64
    Member

    Find 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.

    #2224
    Null
    Member

    Heya 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 :)

    #59818
    MaryJane
    Member

    Yea after i tried posting it in there a few times i figured that out. Will do boss! ^_^

    #59817
    fel64
    Member

    If 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.

    #59892

    In reply to: Always login

    fel64
    Member

    I 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;
    }
    }

    #59816
    MaryJane
    Member

    This is what i have for my wp login. I want my users to login/register from the wp side. So i have this snippet of code i gathered from various forum posts as well as some of it was in my current theme.

    It says Welcome guest when you arent logged in or registered and it gives the link to register. If your signed in or sign in it says Welcome username and shows the forum avatar you have set. Based on your user level it shows you different links for each thing you can do. Like make a post in WP or your profile and favorites in the forum.

    I have a redirect page setup that when you login from this form it just directs you back to the index page instead of going automatically to the dashboard as this confuses most people and the links are on there if your signed in to show you what you can do.

    ** I didnt write this i just gathered it up from various sources on the internet in different forum posts and edited it to suit my needs. Part of it was already wrote into the theme i bought for my wp. **

    pastebin url to it: http://pastebin.ca/651318

    The redirect part is a file i named redirect.php and placed in my wp main directory with a redirect link to the main page. You can see that bit here :

    http://pastebin.ca/651326

    If you have your bbpress intergrated well with wp you should be able to use the same form on your forum. That is what i use.

    #57317

    In reply to: Plugin: bb-Topic-Views

    _ck_
    Participant

    Ah I know what it is after studying the code a bit.

    They never planned on $topic_id being null or not set, so it’s being inserted into the query as blank.

    mysql is getting something like

    SELECT meta_value FROM $bbdb->topicmeta WHERE topic_id = AND meta_key='views'

    see the blank before AND? It’s unacceptable to mysql, needs to be a value.

    hack

    function get_view_count ( $topic_id )

    and

    function initialize_view_count( $topic_id )

    and make a new first line for each that says

    if (!$topic_id) return;

    Should be a dirty workaround until the author can take a look.

    #59889

    In reply to: bbPress database error

    _ck_
    Participant

    Ah I know what it is after studying the code a bit.

    They never planned on $topic_id being null or not set, so it’s being inserted into the query as blank.

    mysql is getting something like

    SELECT meta_value FROM $bbdb->topicmeta WHERE topic_id = AND meta_key='views'

    see the blank before AND? It’s unacceptable to mysql, needs to be a value.

    hack

    function get_view_count ( $topic_id )

    and

    function initialize_view_count( $topic_id )

    and make a new first line for each that says

    if (!$topic_id) return;

    Should be a dirty workaround until the author can take a look.

    #59891

    In reply to: Always login

    Null
    Member

    Can this be used as a plugin? The real questions should be: Can you overide normal bbpress functions with a plugin? And if so, how would this plugin look like?

    And can a function like this be added:

    If user logged-in = false -> redirect to login.php (or register.php)

    #59815
    Detective
    Member

    Hi!

    I don’t use BBPress in that site, i’m installing it on another site, and there the code i posted works :)

    #59814
    avatarx
    Member

    Hey Detective, thanks for the code snipet. I checked out your site and I see it on your sidebar in the forums but not on your main WP sidebar? BTW, nice looking site. :)

Viewing 25 results - 29,301 through 29,325 (of 32,491 total)
Skip to toolbar