Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,326 through 29,350 (of 32,481 total)
  • Author
    Search Results
  • #59854
    vlp
    Member

    I change it, know there is no error, but no favorite forum shows up.

    The deal is that my favorites dissaper, if I point my browser to http://www.tasty.sk/forum/profile/username/favorites, it redirects me to http://www.tasty.sk/user/username//favorites

    It worked before, but probably I changed something so I thought maybe I create another favorites page :)

    #59853
    so1o
    Participant

    yup use it in wordpress.. if i understand you right.. you want to show it on the wordpress profile page right? the one which is

    <you website.com>/wp-admin/profile.php

    try changing the code to

    <?php if ($topics): foreach ( $topics as $topic ) : ?>

    ..

    ..

    ..

    ..

    ..

    <?php endforeach; endif; ?>

    #2214

    Topic: Add New Post Link

    in forum Plugins
    howtogeek
    Member

    Figured I’d throw this out there… I made a tiny function to generate a “reply” link anywhere in the topic. I’m using it in the post meta area to let the user quickly go to the post reply box.

    function geek_post_reply_link(){
    global $topic;
    echo '<a href="'.get_topic_link($topic->topic_id,get_page_number( $topic->topic_posts )) . "#postform".'">Reply</a>';
    }

    I couldn’t find anything else similar, so I thought I’d share.

    #59852
    vlp
    Member

    So if I understand right, I should use this code as a WP plugin?

    I tried that and I get an error:

    Warning: Invalid argument supplied for foreach() in /home/tasty.sk/tasty.sk/www/wp-content/plugins/bbpress-favorites.php on line 30

    It is shown in profile main page…it is possible to create another separate page for that?

    #59248
    Null
    Member

    hmmm nice, i miss a download button :) (in the plugin list to download the latest files)

    #59851
    so1o
    Participant

    here is the hacked code.. this will show the favorites on profile page in the admin section of wordpress. I haven’t tested it but this is the basic idea.

    please note that the wordpress must be integrated both ways before you can do this. visit this for more

    add_action('show_user_profile',
    'my_plugin_show_favorites');

    function my_plugin_show_favorites() {
    $topics = get_user_favorites( $user->ID, true );
    ?>
    <br clear="all" />

    <table width="99%" border="0"
    cellspacing="2" cellpadding="3">
    <tr>
    <th><?php _e('Topic'); ?></th>
    <th><?php _e('Posts'); ?></th>
    <th><?php _e('Freshness'); ?></th>
    <th><?php _e('Remove'); ?></th>
    </tr>

    <?php foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    <td><a href="<?php topic_link(); ?>">
    <?php topic_title(); ?></a></td>
    <td class="num"><?php
    topic_posts();
    ?></td>
    <td class="num"><small><?php
    topic_time();
    ?></small></td>
    <td class="num">[<?php
    user_favorites_link(
    '',
    array('mid'=>'x'),
    $user_id
    );
    ?>]</td>
    </tr>
    <?php endforeach; ?>
    </table>

    <div class="nav">
    <?php favorites_pages(); ?>
    </div>
    <?php

    }

    #59850
    _ck_
    Participant

    Actually, it would be fairly easy to do.

    All we need to do is hook into the header or footer.

    My initial idea was javascript popups but those are bad because they stop all webpage loading at that point. If we hook the header we can insert a z-indexed hover div with the information.

    The service would be passed a user_id, the message, and an action url. Optionally instead of a user_id, it could be the term “administrator” or “moderator” where it would alert all at that level.

    The box would have a close button to ignore it and all the messages would then be accessible as a list under your profile under a new tab.

    You’d have an option to be emailed anytime an alert was generated but typically you can keep that off unless you don’t visit the site often.

    I was going to do this for my “report this post” plugin but I really needed the report feature right away so I got lazy and just used email.

    Sounds like I have a new plugin to code next weekend.

    :D

    #59811
    fel64
    Member

    Can you link us to it?

    The login functions that logs you into bb redirect you to the forums. It may be possible to change that behaviour but I’m not immediately sure how – probably using an action or filter, possibly the action bb_user_login.

    #59825
    _ck_
    Participant

    Remember that the date will be relative to worldwide visitors unless you list the timezone (which will be meaningless to people far outside the timezone).

    What I do on some code is list the freshness in plain english but make the title of the element the original time.

    ie.

    <span class=timetitle title="<?php echo date("r",strtotime($topic->topic_time)); ?>"><?php topic_time(); ?></span>

    Then when you mouse over the “3 days ago” it will show you the original time (in mysql format which can be changed). Then use CSS to make a light underline so the user knows it has some kind of function.

    #59824
    Ziyphr
    Member

    http://uk3.php.net/manual/en/function.date.php

    Don’t have access to the code right now so not sure where in bbPress you need to edit.

    #59848
    _ck_
    Participant

    Looking quickly at the code, I can’t believe this a no action hook when a post is spammed or a user is bozoed. Bad planning. So we can’t make a plugin for that directly. But we could periodically scan for both situations, or check after every post is done.

    Actually what I want is more fancy, an internal popup alert system when certain actions have occurred so email isn’t even needed and is just optional. As you are browsing your site, you’d find out instantly if something like that happened and given a link to look at/take care of it. Plugin authors would be able to add to the alert queue instead of just emailing. Both mods and admin could be alerted individually based on situations.

    #59716
    _ck_
    Participant

    A really neat trick would be not to have a physical template at all but pass it data. My entire template just consists of

    <? bb_get_header();bb_list_plugins();bb_get_footer(); ?>

    Which seems silly to have a physical file.

    I guess I could try to hook it after the init and bypass the bb_load_template entirely.

    #59715
    Sam Bauers
    Participant

    I’m pretty sure you can call any file using the bb_load_template() function, so you can keep your files all neatly bundled up in your plugin directory.

    There are various was you can work out where your plugin is located, and if your template file has a predictable location relative to that, it should be easy to refer to it in the bb_load_template() function.

    #51598

    In reply to: Google Adsense

    fel64
    Member

    Look for blank lines or spaces before the starting <?php and after the ending ?> as they can cause that problem.

    #2211
    Inquirer
    Member

    What is the code to change the Freshness of post format to the Date – Hours – Minutes ?

    #59714
    _ck_
    Participant

    Yup! Solved it… and a nice way too…

    To have a custom template attached to a view, ie.

    /forums/view/listplugins

    function view_listplugins($view) {
    if ($view=="listplugins") {bb_load_template( 'list-plugins.php'); exit();}
    } add_action( 'bb_custom_view', 'view_listplugins' );

    function view_listplugins_filter( $views ) {
    global $views;
    $views['listplugins'] = "List Plugins Used";
    return $views;
    } add_filter('bb_views', 'view_listplugins_filter');

    Now the question is, will this work in the trunk since they completely changed how views are done…

    THE ANSWER IS YES! WOOHOO!

    http://bbpress.nfshost.com/forums/view/list-plugins

    So we have a way to attach any custom page to bbpress.

    The only catch is it will show up in the views list.

    But you can filter the views list for admin/mods, etc.

    I think I can make my “my-views” plugin work with the trunk with this “feature”.

    #59713
    _ck_
    Participant

    s010, that’s very clever.

    Unfortunately it doesn’t work.

    Not certain if slugs would translate either,

    ie. /action/listplugins

    I think the shortest shortcut is a universal loader could be made for all future extensions, ie.

    /forums/option/listplugins

    where option is really option.php in the bbpress root and it just passes to the template listplugins.php

    This would have to be made in the the bbpress core of course.

    ooooh I just had an idea… where is the hook for bbpress’s internal 404…

    er, no i guess that won’t work either…. BUT

    take a look at view.php in the bbpress root

    you can hook bb_custom_view

    basically since there will not be any view name, it won’t do the mysql call, then after you catch it on the do_action(‘bb_custom_view you can exit() after your own custom page load.

    ie. /forums/view/listplugins

    Let me try to code something working…

    #59711
    so1o
    Participant

    this is what i think can be done.. very hacky and very primitive

    create a plugin which filters ‘bb_template’ for template ‘front-page.php’. check for $_GET == listplugins. if so return list-plugins.php

    that will load list-plugins.php is the user goes to

    go to <bbinstall>/index.php?action=listplugins

    here is the plugin

    add_filter(‘bb_template’,’my_plugin_change_template’);

    function my_plugin_change_template($template) {

    return ( ‘listplugins’ == $_GET ) ? ‘list-plugins.php’ : $template;

    }

    kapish?

    #2204
    _ck_
    Participant

    From within a plugin I wanted to attach a new template/page name within the bbpress structure but I cannot figure out how to do it?

    For example:

    Let’s say I want to have a custom page called “list-plugins”

    http://bbpress.nfshost.com/forums/list-plugins

    The only way I was able to do this was to create new file in the bbpress root like this and save it as list-plugins.php

    <?
    require('./bb-load.php');
    $bb_db_override = false;
    do_action( 'bb_index.php_pre_db', '' );
    do_action( 'bb_index.php', '' );
    bb_load_template( 'list-plugins.php');
    ?>

    Then that would load list-plugins.php in my template folder.

    But can’t I attach a fake template name to bbpress via it’s rewrite system without having a physical file?

    #59377
    fel64
    Member

    That sort of thing is usually when you’re not closing divs or li and each successive one falls into the previous, but that should show up in FF and IE too. I looked for that but couldn’t see it, so I can’t help you. Maybe have a look around for Safari bugs that could cause this?

    #59809
    fel64
    Member

    It does indeed require a deeper level of integration. You want to load bb when you load wp, so open wp’s wp-config.php and add the following line:

    require_once('./bbpress/bb-load.php');

    where /bbpress/ should be the subdirectory of wordpress that bb is in. If that works you should now be able to call any bb function from wp.

    #59803
    howtogeek
    Member

    That got me thinking… why reinvent the wheel when I can just use the bbcode plugin.

    What I did was change the current quote plugin to insert the quote with

    Quote:
    instead of the other syntax, as well as strip out any blockquotes from the original post that you are quoting, which eliminates the multiple levels of quoting.

    So here’s my new bb_quote_message() function:

    function bb_quote_message() {
    global $bbdb, $topic;
    $post_id = (int)$_GET['quote'];
    if ($post_id) {
    $row = $bbdb->get_row("SELECT * FROM $bbdb->posts WHERE post_id={$post_id} AND topic_id={$topic->topic_id} AND post_status=0");
    $row->post_text = preg_replace( '(<p>|</p>)', '', $row->post_text );
    $ret = preg_replace("/<blockquote>((.|[nr])*?)</blockquote>/", "",$row->post_text);
    if ($row) echo htmlentities('
    Quote:
    '.$ret.'
    ', ENT_COMPAT, 'UTF-8');
    }
    }

    So far it works great… except it’s annoying that the cursor isn’t positioned at the end of the textbox… I’m gonna look for some javascript to fix that.

    #59802
    _ck_
    Participant

    Just remember some people use the bbcode plugin so it would have to peacefully get along with that.

    #59801
    howtogeek
    Member

    I’d think it would work out much better to use something other than blockquote… that’s the whole idea behind the

    Quote:
    tag… it should be accepted by bbpress perfectly fine, and not used for any other reason.

    There’s no reason to have full bbcode support if you don’t need it, all we need is the

    Quote:
    tag.

    One of the problems with using blockquote is that somebody might already use blockquote in their posts. It would also make any old posts using blockquote completely incompatible with the new plugin.

    Otherwise you could use another tag, but then you have to modify the bbpress allowed tags list.

    And the issue here is that we are trying to indicate to the system that we are quoting something, not just trying to format the display. It’s this that gives us the ability to filter out the first quote in a multiple-quote scenario that probably happens very often.

    #59800
    _ck_
    Participant

    Well you’d have to use an existing html tag like blockquote and map it to a bbcode tag via another plugin.

    But blockquote can have made-up attributes.

    ie.

    <blockquote post="1824" author="_ck_">blah blah</blockquote>

    But it’s much more simple to start with non-intelligent quoting. You can place the post reference but to look for it and analyse it is much more difficult.

    Stripping nested blockquotes will be very easy.

    Well fairly easy.

Viewing 25 results - 29,326 through 29,350 (of 32,481 total)
Skip to toolbar