Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 24,226 through 24,250 (of 32,468 total)
  • Author
    Search Results
  • #76643
    chrishajer
    Participant

    What version of bbPress are you using? Those instructions are for 1.0.1. Also, are you using a stock theme?

    Basically, you need to find, in whatever template file you want to change, the bbPress function that shows that text (it won’t be immediately clear because the function has a default text which is used if you don’t send it anything else. The default text is set in the core file bb-includes/functions.bb-template.php.) Just look in the source of the generated page and try to get some context for where in your template file this function will be (top, middle, bottom, in a table cell, near a unique css id, etc). Then, try adding your text in comments inside the parentheses, instead of them being bare. So, from this:

    bb_do_whatever()

    to:

    bb_do_whatever('Add New Essay')

    #76641
    chrishajer
    Participant

    2. of my reply covers your second problem.

    <?php bb_new_topic_link('Add New Essay'); ?>

    bb_new_topic_link is called without parameters in your front-page.php template file, but if you pass it the string ‘Add New Essay’ you will see the text in your displayed site change. You are overriding the default text which is in the bbPress core.

    The reason you don’t find it in a template file is because it’s not there. The function is there, and is called without parameters. The default text is in the core, but you can override it in your template.

    1. I cannot help you with and I questioned the desire to even do something like that. Why would you want an “add new” page indexed when it has no content? What benefit does it give your site?

    I imagine you could probably do something to change that using mod_rewrite and your .htaccess file, but I don’t know how to do that.

    #76639
    chrishajer
    Participant

    1. I’m wondering what benefit there would be to indexing a page that has no content on it, just the ability to add a new topic?

    2. In version 1.0.1 of the software it’s in the template files. You want to find this function:

    <?php bb_new_topic_link(); ?>

    And make it look like this:

    <?php bb_new_topic_link('text Instead of Add New'); ?>

    Paul
    Member

    I have a link to my forum in my global nav by creating an empty page with a slug that is the same as the directory name as where I have bbpress installed.

    But I also load the wp-load.php file in my bb-config.php file

    define('WP_BB', true);
    if ( !defined('DB_NAME') ) {
    require_once( dirname(__FILE__) . '/../wordpress/wp-config.php');
    }
    $bb->wp_table_prefix = 'wp_'; // your wordpress db prefix is
    $bb->wp_home = 'http://www.trashfilmorgy.com/wordpress';
    $bb->wp_siteurl = 'http://www.trashfilmorgy.com';

    Then I went into my bbpress theme and changed every instance of bb_get_header() with get_header(), and bb_get_footer() with get_footer().

    Since I want to have my wordpress sidebars show up in the forum, too, I also added get_sidebar() right above the call to get_footer().

    I could also add other sidebars, too – the theme I use adds two columns below the main content area and uses the dynamic sidebar functionality to add them in to each page. I could see how adding other or more sidebars and going in to the templates could be really useful

    #76316

    In reply to: unescaped characters

    Paul
    Member

    Here are the installed plug-ins, but I should note that it has been doing this before I installed any plug-ins:

    Akismet v1.0

    Bavatars v0.4

    BBcode Lite v1.0.3

    BBVideo v0.24

    Post Count Titles v1.0.2

    Right on the forum front page, you can see this entry:

    Satan’s Cheerleaders Pictures 1 Paul Brown 9 hours

    That escaped apostrophe is what I’m talking about… were I to go in and edit that post, there would be two backslashes.

    #76620
    _ck_
    Participant

    No, no no, bb_is_admin is to detect if you are in the admin control panel

    First line should be

    <?php if (bb_current_user_can('administrate')) { ?>

    #76619
    Gautam
    Member

    Use this:

    <?php if(bb_is_admin()){ ?>
    <div id="useronline">
    <h3><?php _e('ONLINE TODAY'); ?></h3>
    <p><?php do_action('members_online_today',''); ?></p>
    </div>
    <?php } ?>

    This should work…….

    kickerman360
    Member

    Maybe this will work:

    <a href='<?php bb_uri(); ?>/profile/<?php topic_last_poster(); ?>"><?php topic_last_poster(); ?></a>

    Not 100% sure it would work since <?php topic_last_poster(); ?> grabs the display name, not the user name I think. Well there’s a start.

    #15763
    edwinfoo
    Member

    Hello,

    I was wondering if someone can point me in the right direction. Though I am a webmaster, marketing is my forte and cutting code is quite foreign to me but I get by.

    Have the members_online.php plugin installed and though I like to see who’s been online today, I don’t want potential advertisers seeing that information or indeed forum members as it can provide a distorted view of site traffic stats.

    Here is the snippet of code from the front-page.php file which generates the summary on the forum front page.

    <div id="useronline">
    <h3><?php _e('ONLINE TODAY'); ?></h3>
    <p><?php do_action('members_online_today',''); ?></p>
    </div>

    Can someone please tell me what to do to make that output visible only to admins?

    Thank you in advance

    #76606
    Arturo
    Participant

    yes Tom, and they correspond!!!! i’ve put the exact code from the bbpress integration plugin… any idea?

    #76617
    Gautam
    Member

    Create a functions.php file in your theme folder, and write this in it:

    <?php
    function get_post_teaser($chars = 200){
    global $bbdb;
    $topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic
    $first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1");
    $content = substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0, $chars); //gets the first 200 chars of the post
    return $content;
    }
    ?>

    Then at the front page, put this where you need to display the post text (it should be inside the loop):

    <?php echo get_post_teaser(200); ?>

    You can change that 200 to anything, any number of letters you want. Default is 200.

    I think, this should work.

    #76345
    Gautam
    Member

    I think, for the front page, where all topics are shown, you should put this:

    <?php
    $limit = bb_get_option('page_topics');
    $offset = ($page-1)*$limit;
    $all_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE topic_status = 0 AND topic_sticky = 0 ORDER BY topic_id DESC LIMIT $limit OFFSET $offset");
    $all_topic_posts = get_thread( $topic->topic_id);
    $topics = $all_topics;
    ?>

    Haven’t tested it, but should work.

    #76611
    infected
    Participant

    Hm… That might be work. But there´s no way to handle this like in wordpress? For example you can pass arguments before and after the tag and also define a separator. Like this: <php the_tags('Tags:', ', ', ''); ?>

    #76610
    deadlyhifi
    Participant

    functions.bb-template.php line 1866 shows the arguments that this functions can accept, including a before and after character. But it also states $args = null. You could add the | on line 1868 but this is editing the core :(

    Alternatively use an if ( bb_current_user_can( 'view_by_ip' ) ) { echo " | "; }.

    #76604
    deadlyhifi
    Participant

    You’d replace the topic_posts(); with the code that johnhiler wrote.

    Is it worth running through that calculation for every listed post though? People on your forum would soon become familiar with Number of Posts rather than Replies to Post statistics.

    #76519
    deadlyhifi
    Participant

    I’ve just reported this issue of HTML characters being displayed in edit post in Trac. (https://trac.bbpress.org/ticket/1158).

    It looks like a minor bug in bbP rather than an issue with the plugin… although it could affect people who are trying to type HTML characters out in their code examples. That rarely happens on my forum though.

    #76343
    deadlyhifi
    Participant

    This code won’t work on front-page.php but did you try it in forum.php? I’m running v1.0.1 and it’s working fine there.

    For the front page you need to find the SQL query that gets called and replace it with your own, and ORDER BY topic_id. Let me know how you get on. I’ll have a closer look tomorrow when I’m working from home.

    #15410
    infected
    Participant

    Hi!

    First of all, sorry for my bad english… I try to explain my intention as good as i can.

    I tried to show this ” | ” before or after a php tag in my own template. For example my post.php contains this code

    <div class="poststuff"><?php printf( __('Posted %s ago'), bb_get_post_time() ); ?> <a href="<?php post_anchor_link(); ?>">Permalink</a> <?php post_ip_link(); ?> <?php post_edit_link(); ?> <?php post_delete_link(); ?></div>

    What i want is that e.g. before <?php post_ip_link(); ?> is displayed the above mentioned character. If i insert it before the php tag it also displayed to “normal users”. Normally the ip link is only displayed for admins. And so i´d like to see the | only as admin.

    The output for normal users should look like this: Posted 38 minutes ago | Permalink

    The output for admins should look like this: Posted 38 minutes ago | Permalink | 127.0.0.1 | Edit | Delete

    If i add this “|” manually before the tags, for normal users it looks like this: Posted 38 minutes ago | Permalink | | |

    Any ideas how this can be done?

    #15409
    Arturo
    Participant

    Hi,

    i’ve installed WP (not mu) 2.8.1 and bbPress 1.0.1 with user and cookie integration, users work without problem but the cookie not.

    i’ve installed the bbpress integration plugin added the code to my wp-config.php but nothing change… the key are checked, i really don’t know how to resolve this… please help me… thanks!

    #76517
    deadlyhifi
    Participant

    Just noticed an issue when editing a post. If there is an apostrophe it get’s turned into HTML code. i.e. ' the preview code stops being generated… will look at this closer tomorrow. I suppose this only affects if the preview form has been added to edit post with (add_action('edit_form','add_live_comment_preview');)

    #15404

    On both Chrome and Safari (latest stable on both, and up-to trunk on Chrome) these do not work for me:

    – Adding/Removing from favorites ajax script within a viewed topic: Clicking on the span wrapped anchor shows animation but state unchanged.

    – keymaster removal of posts: input box and animation plays, upon refreshing page (Manual F5) posts re-appear.

    These situations do not occur with FireFox or I.E.

    I’ve also replaced jQuery 1.2.6 with jQuery 1.3.2 (without errors, and requires a few php changes to the script loader) but this does not work. I had thought maybe there were fixes to 1.3.2 ajax code.

    Still not discounting my own server config, and I haven’t fully debugged the javascript yet. I have jQuery debug up and running, just going to be a while.

    Stack is: WPMU 2.8.1 >> BBPress 1.0.1

    Anyone have similar issues?

    #76497
    kickerman360
    Member

    Hey thanks _ck_

    I found this snippet of code

    <?php global $user_identity;

    get_currentuserinfo();

    if ($user_identity == ”) {

    echo(‘Welcome Guest’);

    } else {

    echo(‘<img src=”/forum/avatars/’ . strtolower($user_identity) . ‘” alt=”avatar” />’);

    }

    ?>

    Which doesn’t cause an error but doesn’t display an image. I don’t think a file type is being declared which results in a 404 and then the alt text is displayed.

    I did however come up with this, which is a modded version (to be used on a homepage)

    <?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.jpg” />’); ?>

    <?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.png” />’); ?>

    <?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.gif” />’); ?>

    <?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.jpeg” />’); ?>

    I’m not sure how to find out the file extension via php so I just created 3 extra lines of code for the 4 types of files the form should accept.

    If anyone wants to clean up my code I’d greatly appreciate it, I’m only just learning php (noob :D ) after playing with CSS and (x)HTML for a while. I know, the code will not be valid.

    Thanks again, _ck_ ( I didn’t realize there was 2 help forums for that plugin)

    #76515
    deadlyhifi
    Participant

    good work.

    though I changed the preview button to <p name='live_comment_preview_button' id='live_comment_preview_submit' value='".$label."' onclick='sendPostToPreview("".$live_comment_preview_path."" )' />Preview Post</p>, styled accordingly with a cursor on hover and placed it on the post form itself (the submit button would try and submit the form).

    add_action('post_form', 'add_live_comment_preview');
    add_action('edit_form','add_live_comment_preview');

    also added it to the edit post form.

    #76341
    Gautam
    Member

    I think get_topic_start_time(); will not echo it. You need to put topic_start_time();

    Gautam
    Member

    I have fixed Live Comment Preview Plugin By Enrique Chavez aka Tmeister.

    I have also added some new features like:

    1) You don’t have to do any file editing, it will auto-insert itself.

    2) Now, it will auto-refresh itself after 10 seconds. You can edit this in the js file (last line).

    You can get it here:

    http://www.mediafire.com/file/znyxze2mefw/live-comment-preview.zip

    :-)

Viewing 25 results - 24,226 through 24,250 (of 32,468 total)
Skip to toolbar