Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,676 through 29,700 (of 32,491 total)
  • Author
    Search Results
  • #2134
    kehlers
    Member

    I’m not sure if this is a bug, or just something I have wrong, but my husband noticed it right away. I missed it even though I’ve been working with bbPress for several weeks and have installed it on three different sites! LOL

    Anyhow, it’s a relatively minor issue, but has anyone seen this?

    When a user registers, the success message reads “Your registration as was successful…”. I thought it was a simple typo, but when I looked at the code it goes like this:

    <?php printf(__('Your registration as <strong>%s</strong> was successful. Within a few minutes you should receive an email with your password.'), $user_login) ?>

    BTW, I have the same result when I register on this support forum. I think the main issue is that the variable $user_login, created in register.php, is no longer available after bb_load_template( 'register-success.php' );.

    Does anyone know if there is a variable containing this info? Since the user is not logged in at that time, I can’t use any of the current user info. As I said, this is quite minor – the success message would be almost as good without the user login ID in there.

    tisme
    Member

    eh, sorry I was trying to say: “I’m not going to modify a production core” ;-)

    fel64
    Member

    yes, I’m not giong to modify a core

    buh – do I misunderstand you? You just modified a core file. template-tags.php is as core as anything else.

    But yes, submitting this as a feature request on trac I think is a good idea. :)

    #59040
    fel64
    Member

    Log In with the account you use here, then click New Ticket and describe the problem. :)

    #59207
    fel64
    Member

    Cool. You’ll find it is an improvement. :)

    That’s really simple. Just change post_form() to post_form('Take some Pizza') or whatever else you want in there.

    (The only reason I know this is I looked into template-functions.php and searched for post_form, then saw this:

    function post_form( $h2 = '' ) {

    which tells me it wants $h2 as an argument. $h2 is the <h2>text here</h2> as you can imagine.)

    #2133
    EgyptUrnash
    Member

    Hey all, I’m trying to commit a plugin I built and failing. Any help would be appreciated.

    I’m using the command-line client, version 1.4.2. This is the sequence I’m doing:

    > svn co http://plugins-svn.bbpress.org/textile/
    bbpress-textile

    A bbpress-textile/trunk
    A bbpress-textile/branches
    A bbpress-textile/tags
    Checked out revision 506.

    ( finder: copy my files from the bbpress directory
    I initially developed them in to bbpress-textile/trunk )

    > cd bbpress-textile/trunk
    > ls
    readme.txt textile textile.php

    > svn add *
    A readme.txt
    A textile
    A textile/classTextile.php
    A textile.php

    > svn ci -m "Initial commit." --username egypturnash
    --password [REDACTED]

    Adding trunk/readme.txt
    svn: Commit failed (details follow):
    svn: CHECKOUT of '/!svn/ver/490/textile/trunk':
    403 Forbidden (http://plugins-svn.bbpress.org)

    …and then I’m left puzzled, since I’m not _trying_ to do a checkout. I’ve fiddled with subversion on my local machine, but never tried doing a remote commit with it. Any suggestions? I get the same error if I try doing it up in the main source-controlled directory.

    (And yes, I did get the email saying my plugin hosting request has been approved. *grin*)

    tisme
    Member

    yay, now it works completely as a plugin without having to modify a template in several places! thank you.

    it’s interesting, I’ve tried to change echo output to:

    echo apply_filters('post_time', _bb_time_function_return( $time, $args ));

    but that gave me post time in the following format: 2007-07-19 00:00:00

    I would never get it myself that I should apply_filter() with a bogus (new, not used) tag (like ‘tpl_post_time’).

    topic_class() is called in the template just before topics list displayed (* is a typo).

    yes, I’m not giong to modify a core –> could possibly be a trouble on upgrade etc, I see.

    much better would be to submit a patch to post_time() ;-)

    #59206
    outchy
    Member

    i got the upgrade to work, thank you for your advice. and your php code worked great. now the only thing i need to know is, how do i change the word “reply” to “post a reply” without altering the template-functions.php? or any other predetermined text for that matter?

    fel64
    Member

    The difference between actions and filters is unclear. In principle, filters are supposed to let you modify data and actions give you a chance to respond to events. This is reflected most in the fact that with a filter, you have to return some data which will be used instead of the data given to you in the first place. For actions, you don’t.

    The syntax is this:

    do_action('action_name', [$argument1, [$argument 2 [...]]]);
    apply_filters('filter_name', [$argument1, [$argument 2 [...]]]);

    I don’t recommend making changes to the core, of course. But if you have to, you would change the last line of topic_time() from this:

    echo _bb_time_function_return( $time, $args );

    to this:

    echo apply_filters('template_time', _bb_time_function_return( $time, $args ));

    and then change the line in the plugin further up to this:

    add_filter('template_time', 'freshness_latestlink', 101);

    taking out the // that comment it out. Also, I’m not sure what topic_class*() is?

    But yeah, don’t modify the core. Much better to stick to the template change from above. :)

    #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. ;)

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