Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,626 through 29,650 (of 32,432 total)
  • Author
    Search Results
  • #59202
    fel64
    Member

    Don’t worry about it :)

    I’m sorry I wasn’t clearer, that was raw PHP code. So that PHP code runs, you have to put <?php and ?> tags around it.

    <?php
    global $page, $topic;
    $add = topic_pages_add();
    $last_page = get_page_number( $topic->topic_posts + $add );
    if( $page == $last_page ) {
    print( '<h2 class="post-form">POST A REPLY</h2>' );
    }
    ?>

    This just worked for me in my template’s topic.php.

    #59201
    outchy
    Member

    i didn’t know that :/

    i tried your code but i couldn’t get it to work because i didn’t fully understand it. i think i pieced it together wrong or left out something.

    do i just paste the whole thing into topic.php? or some other file?

    tisme
    Member

    > Probably better to say that not all functions have _hooks_ or _filters_, since pluggable refers to them being overwritable with another function (see bb-includes/pluggable.php). :)

    oh, yes right you are, thanks for pointing that out!

    so, evidently post_time() just doesn’t have a hook to callback our custom filter. I failed to modify it by the proper way.

    fel, could you please show me how it should be modified to have an apply_filter hook?

    PS

    couldn’t get the subtle difference between ‘filters’ and ‘actions’:

    > *Actions* Your plugin can respond to the event by executing a PHP function, which might do one or more of the following:

    Modify what is displayed in the browser screen (admin or end-user)

    > *Filters* are functions that WordPress passes data through, at certain points in execution, just before taking some action with the data (such as adding it to the database or sending it to the browser screen).

    which filter or action for instance could be added to the topic_class*() if any?

    #59200
    fel64
    Member

    It’s a very bad idea to edit template-functions.php or any other core files. What will you do when the next version comes? You should always put custom code in your template or plugin. Did my code not work in your template?

    fel64
    Member

    In principle it’s possible to do so by replacing all the template functions with custom functions that call a custom filter first, but it probably wouldn’t work out overall (not everyone would do it, plugins would still have to be written for forums without this, changes to the core would have to be replicated …).

    Probably better to say that not all functions have _hooks_ or _filters_, since pluggable refers to them being overwritable with another function (see bb-includes/pluggable.php). :)

    You could request this in trac I suppose. Might be quite a decent feature in the future.

    #59181

    In reply to: plugin: Markdown

    tisme
    Member

    > I don’t want to have to scroll through a wall of text looking for new paragraphs.

    Daring Fireball says:

    > Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

    ;-) anyway, that doesn’t seem to be a big issue as folks usually quote just 1-2 para to mantain a coherent (connected) dialog on web forums (like we do now ;-)

    basically, most used syntax is just as on http://programming.reddit.com/help/commenting and it works pretty well out there, although they have a threaded *nested* comments, which eases communications alots since there’s no need in usual for web-forums perverted form of addressing like “@username: …” etc.

    as I noted on misc web-boards its quite popular to use a JS to grab the quoted username. though, it doesn’t seem to me related to this kind of *text-formatting* plugins we’re discussing. as it is more like up to a higher-level of software — if it doesn’t have a “Reply” (to a particular post) function there’s nothing much can be done about it.

    your plugin is working just fine. I guess its syntax rules will be enough for the most folks. the only thing is just the same as with that ‘Markdown PHP’ — I think it would be logical to have deal only with its (markdownifed 8-) syntax _while editing a post_, not with HTML tags again — as it may produce some kind of schismo in non-savvy users minds ;-)

    once again, thanks for sharing!

    fel64
    Member

    Ooh. Probably. Nice idea.

    <?php
    /*
    Plugin Name: Freshlink
    Description: Turns freshness into a link to the latest post
    Author: tisme, fel64
    */
    function freshness_latestlink( $fresh ) {
    global $topic;
    $felgtlpl = get_topic_last_post_link($topic->topic_id);
    return "<a href='$felgtlpl'>$fresh</a>";
    }

    //add_filter('', 'freshness_latestlink', 101);
    ?>

    Unfortunately there doesn’t seem to be a filter for it – only for modifying the actual time, not the text output. Since topic_time() also directly writes to the HTML, you can’t modify it first. You have to change the template, from

    <?php topic_time(); ?>

    to

    <?php echo freshness_latestlink( get_topic_time() ); ?>

    #59180

    In reply to: plugin: Markdown

    fel64
    Member

    > I guess ‘>’ in front of every _paragraph_.

    It’s still annoying somewhat annoying :P. I don’t want to have to scroll through a wall of text looking for new paragraphs. Perhaps >>Quote …. << ? What would also be interesting is the ability to add the name of who you’re quoting. Name>>Quote<< or “Name blah”>>Quote<<? Although that’s starting to get a bit artificial.

    It is an option to make this plugin rewrite the posts as they’re being read, but I was worried about the extra server load (although it’s pretty light code) and it’s playing pretty badly with the Allow Images plugin.

    I don’t want to keep hosting it on my server, so I’ll take this down the next time I think about it. http://www.loinhead.net/files/felise

    http://www.loinhead.net/files/felise.php is a working, non-bb copy of the script so you can test it (note that >>Name[post#] doesn’t work). Ignore the sucky name, I hate naming things and needed something just temporarily :P

    #59198
    fel64
    Member
    <?php if( #conditional# ) {
    //some code
    } ?>

    Unfortunately determining if this is the last page is a little bit difficult. You need code like this (taken from template-functions.php):

    global $page, $topic;
    $add = topic_pages_add();
    $last_page = get_page_number( $topic->topic_posts + $add );
    if( $page == $last_page ) {
    //some code
    }

    which is way more code than it should be. You should be able to use (but can’t yet)

    if( bb_last_page() ) {
    // some code
    }

    so I’m submitting a trac ticket so that hopefully in the next version you can do that.

    In your case, the // some code should be:

    print( '<h2 class="post-form">POST A REPLY</h2>' );

    Worth noting, in PHP strings (ie. text in code) are marked by opening and closing with ' or ". If you open a string with ' then " will be ignored and the other way round, too. So you could have used

    print( "<h2 class='post-form'>POST A REPLY</h2>" );

    Also in PHP functions have to be like this: function_name( #arguments );

    where #arguments can be things like a string, or a variable you set earlier. Some functions do without the brackets but all of them work fine with brackets, so it’s best to always use them. :)

    #59179

    In reply to: plugin: Markdown

    tisme
    Member

    thanks a lot, fel!

    It’ll be interesting to see it. (“You have reached the download-limit for free-users. Wait 55 minutes” ;-)

    >> I’ll put in some syntax for blockquotes, even if having to put > in front of every line sounds tiresome.

    I guess ‘>’ in front of every _paragraph_.

    #58902
    tisme
    Member

    you can also see an endless related thread on [wp-hackers] Re: Blogroll, Bookmarks, Links?

    I’d say something like: “Add/[book]Mark/Save this topic as your watched thread/to the list of your watched threads”.

    OT: what are reasons/purpose of:

    'name' => __('Key Master'),
    'capabilities' => array(
    ...
    'edit_others_favorites' => true,

    is it ethical?

    #59173
    Sam Bauers
    Participant

    You’ll need to dig into the the index.php file in the root of the code (not a template file). All the prep to retrieve the forums from the database is done there.

    #59178

    In reply to: plugin: Markdown

    fel64
    Member

    http://rapidshare.com/files/43804950/felise.php.html

    Hmm. Still don’t know about a name. Ignore the name there and upload, activate.

    In addition to what I said last post,

    *bolded stuff* => bolded stuff

    _italic words_ => italic words

    **notbold** => *notbold*

    __notitalic__ => _notitalic_

    link@http://somerealurl… => link

    “link text blah”@http://somerealurl… => link text blah

    #, *, -, (1, 2, 3), (a, b, c) => <ul/ol><li> .... </li> .... </ul/ol> (Numbers, letters need to be in order. Any punctuation after it will also be accepted.)

    >>Name[post#] => >> Name

    (Not italicised or bolded in: u*blah*, _ blah_)

    I believe that covers everything. I’ll have a look at Markdown, see if it does anything cool that I’d want too. :P

    The last one is pretty neat but mostly for another plugin that I have on my site that’s also unreleased. Might ask for plugin space for that one now I guess.

    Oh, also worth noting that standard behaviour for this plugin is ‘compiling’ the text when the post is saved. That means that it doesn’t make your forum any slower (all the work is done when the post is saved) and that if at any point you remove this plugin, old posts written with it will look exactly the same so you can do that anytime without problems.

    [Edit] Markdown is … complicated. When I wrote this, I wrote it to go along with bbPress, so it’s a lot simpler. It doesn’t support stuff like paragraphing because bbPress already does that. And I wrote it so you wouldn’t have to remember anything, but so that the stuff you’d write anyway is formatted nice. No need to think what the syntax is or anything like that. I like what it did with blockquotes. I’ll put in some syntax for blockquotes, even if having to put > in front of every line sounds tiresome. But what do people think about italicising or bolding inside words? I took it out to avoid unintentional formatting, but Markdown has it in (for stuff like un*fucking*believable) and now I’m not so sure.

    fel64
    Member

    I wrote a plugin to do that. Just upload and activate this.

    <?php
    /*
    Plugin Name: Page &raquo;
    Plugin URI:
    Description: Adds &raquo; to the end of topic titles, linking to latest post.
    Author: fel64
    Version: 0.7
    Author URI: http://www.loinhead.net/
    */

    if (!function_exists('is_tags')) {
    function is_tags()
    {
    return is_tag();
    }
    }

    if (is_front() || is_forum() || is_tags()) {
    add_filter('topic_title', 'fel_addlatestlink', 101);
    }

    function fel_addlatestlink($title)
    {
    global $topic;
    $felgtlpl = get_topic_last_post_link($topic->topic_id);
    $title = $title . ' <a href="' . $felgtlpl . '">&nbsp;&raquo;&nbsp;</a>';

    return $title;
    }
    ?>

    #59175

    In reply to: plugin: Markdown

    tisme
    Member

    hello fel,

    some name suggestions:’bbMark’, ‘markMini’ etc and possible permutations ;-)

    italic, bold, blockquote and link is basically what I need.

    ck removed a lot of filters, I’ve tried remove them too — works better, but his plugin is for admin user level, isn’t it?

    I just can’t dig it: how do I encode HTML back to Markdown at ‘edit_text’?

    PS a bit of documentation on “bbPress text flow” (something like: http://www.michelf.com/img/blog/wordpress1.5-text-flow.png) wont hurt ;-)

    #59221
    M
    Member

    And here I imagined the secret to be some way to transport chocolate through the internet! This is good too . . . just not as good. ;)

    #59163

    In reply to: Few questions..

    Trent Adams
    Member

    1) I would ‘t worry about the plugins to help out if you need it (small percentage) as they are intended to get it fixed which will eventually make it into the core. Those plugins would only require minor changes if something was changed in bbPress, but I doubt it would happen often.

    2) I had great luck with the phpbb converter myself and have stated in one of the threads which one I used. I would just look around a bit before choosing one.

    3) Since the upgrade process is so easy, there is no need to wait! As well, the changes scheduled for the next series of releases are small changes and no worth waiting for!

    4) So1o just released a new version of the private forums plugin that is exceptional and recently addressed the problems with the RSS feed being private. It is found in the ‘extend’ tab of this forum in the plugin browser!

    5) fel64 is absolutely right. mdawaffe is the head dev and he is working on wordpress code at the same time. They will always be compatible as they are working toward more shared function (at least not conflicting). Issues will be worked out as we go, but shouldn’t be a problem.

    Thanks,

    Trent

    #59192
    Trent Adams
    Member

    Please let me know what you would charge to make these changes.

    Please don’t do that people! Contact stuboo through their website or if you are reading this stuboo, leave a contact address as we don’t want to use the forums as a place to bid or bidding wars.

    Trent

    #59162

    In reply to: Few questions..

    fel64
    Member

    1. Some dudes do, yeah. But it seems to be a minority; who can tell? Maybe bbPress does just have a few new users a week :P

    2. Haven’t seen one. Believe there was some trouble with older converters somebody dug up.

    3. New version is in development, and I expect there will be new versions in development for a while. Don’t let that stop you getting it now. There’s no release planned for the next week as far as I know.

    4. It’s not in the core and there’s no indication that’s what’s being worked on right now. It’d have to be a plugin. Last I read they fixed their RSS problems? It will say in the plugin topic, anyway.

    5. It’s one of the wp devs that’s developing bb at the moment. They all work for the same small company. I don’t think one release would ever break the other.

    #59172
    fel64
    Member

    How did you do it on front-page? I reckon code like this (taken direct from kakumei’s front-page) should work everwhere but I haven’t tried it – if you already have, sorry.

    <?php if ( bb_forums() ) : ?>
    <h2><?php _e('Forums'); ?></h2>
    <table id="forumlist">

    <tr>
    <th><?php _e('Main Theme'); ?></th>
    <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th>
    </tr>
    <?php while ( bb_forum() ) : ?>
    <tr<?php bb_forum_class(); ?>>
    <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td>
    <td class="num"><?php forum_topics(); ?></td>
    <td class="num"><?php forum_posts(); ?></td>
    </tr>
    <?php endwhile; ?>
    </table>
    <?php endif; // bb_forums() ?>

    If it doesn’t work, chuck <?php bb_forums(); ?> somewhere before it and try again.

    #59174

    In reply to: plugin: Markdown

    fel64
    Member

    I don’t know. But do you know about the plugin I wrote that does things similar to markdown? No. No you don’t. Because I haven’t mentioned it yet. Basically it lets you italicise, bolden, and link in a very elegant way (although I think syntax-wise slightly different way to markdown). It respects code and it auto-converts the lists you only wrote casually (list items starting with #, -, *, (1, 2, 3 …), (a, b, c …)) into proper HTML. If I could think of a goddamned name I would have uploaded it yesterday. But it is a different, very likely smaller feature set to Markdown, and if you need Markdown then that’s no use at all to you. If you’re interested I’m happy to provide a copy of the script.

    Have you tried these filters ck removed? https://bbpress.org/forums/topic/new-plugin-admin-post-anything Check for the last post because he made some changes, but those should be all.

    #2124

    Topic: plugin: Markdown

    in forum Plugins
    tisme
    Member

    which bb filters ($tag, $func, $prio) I need to add/remove to get working [**PHP Markdown**]( http://www.michelf.com/projects/php-markdown/ )?

    quick and dirty:


    remove_filter('pre_post', 'balanceTags');

    add_filter('pre_post', 'Markdown', 1);


    doesn’t seem to be sufficient as HTML tags should be converted back to Markdown while ‘edit_text’, also extraneous P elements (paragraphs) ought to be stripped off.

    does it require anything else?

    PS and yes, I know about A.King’s ‘Quick Tags’.

    #59159
    gh3
    Member

    i have just tried to contact him by irc, but he was afk :(

    btw if you have got his email, try to send him a mail to ask for this

    #59158
    _ck_
    Participant

    We probably need to email mdawaffle and have them add me to the move-it plugin ;-)

    I think I have the email address around here somewhere or maybe Trent can do it?

    #58992
    papadoc
    Member

    Fel,

    I’ve managed to get the plugins mostly working, although not entirely well… but I’m asking for help on those in their relevant forums.

    As far as that code goes, it still works fine as far as displaying the last poster, but the profile link still isn’t working… Although I think we’re moving in the right direction, as now instead of linking to a fault page, or the forum index, it’s just not showing a link at all.

Viewing 25 results - 29,626 through 29,650 (of 32,432 total)
Skip to toolbar