Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 15,301 through 15,325 (of 32,506 total)
  • Author
    Search Results
  • #119178
    elpix
    Participant

    Hi all,

    I ask your help beacause I’ve already tried everything that I knew before to make a query work in few seconds

    I’m on BP 1.5.5/

    Before, everything was working well, but one day, access to our forum became very very long (170 s average).
    After many tests, I think that it’s a cache problem.

    Here is two queries that make me think that :

    SELECT t.*, g.id AS object_id, g.name AS object_name, g.slug AS object_slug
    FROM wp_bb_topics AS t
    INNER JOIN wp_bb_posts p ON p.topic_id=t.topic_id AND p.post_time=t.topic_start_time
    JOIN wp_bp_groups AS g
    LEFT JOIN wp_bp_groups_groupmeta AS gm ON g.id = gm.group_id
    WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.STATUS = 'public' AND t.topic_status = '0'
    ORDER BY t.topic_time
    LIMIT 20

    And the same without the “LIMIT”

    SELECT t.*, g.id AS object_id, g.name AS object_name, g.slug AS object_slug
    FROM wp_bb_topics AS t
    INNER JOIN wp_bb_posts p ON p.topic_id=t.topic_id AND p.post_time=t.topic_start_time
    JOIN wp_bp_groups AS g
    LEFT JOIN wp_bp_groups_groupmeta AS gm ON g.id = gm.group_id
    WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.STATUS = 'public' AND t.topic_status = '0'
    ORDER BY t.topic_time

    The first (with LIMIT) take 150 secondes (At the beginning, it was working well).
    But the second (without LIMIT) takes 1.5 secones !!!!

    When I’m in PHPmyADMIN, the “show full processlist” tell “copy to tmp table” during the 150 secondes.

    So my question is :
    Is there a cache limit I’ve reache with my DB (20.000 topics) ?
    Where I’ve to modified (I think in my.cnf), and what is the value to put (I’ve make a lot of test, without good results)?

    Thank you very much !

    Bye

    #119176
    Shmoo
    Participant

    Sorry this forum doesn’t except the starting and closing PHP tags.

    bbp_topic_author_avatar( array( ‘size’ => ’80’ ));

    and

    bbp_topic_author_avatar( array( ‘size’ => 80 ));

    Both don’t work..

    #119175
    Shmoo
    Participant

    I’m just curious because i would like to edit the author’s gravatar and how it’s showed in the source to get more CSS options.

    bbp_topic_author_avatar

    bbp_get_topic_author_avatar

    When i use the bbp_topic_author_avatar() version inside the loop-single-topic.php file it shows a perfect 40 pixels gravatar like explained on the website with all possible bbPress code tags.
    Great but when i try to make this gravatar 80 pixels instead of the default 40 there is something wrong because the code doesn’t accept my array when i try do this.

     '80' )); ?>
    

    Even when i do this it doesn’t work.

     80 )); ?>
    
    #119174

    Topic: Editing a shortcode

    in forum Plugins
    mighty_fox
    Participant

    I have a page which uses the shortcode [bbp-topic-form]
    However I would like to comment out some things I don’t want to be viewed. Could anyone point me in the right direction in how to find the file which creates this short code.

    Thanks in advance.

    #119167
    Stephen Edgar
    Keymaster

    Add the code here to your themes functions.php file

    https://gist.github.com/3815686

    #119165
    Stephen Edgar
    Keymaster
    #119163
    Stephen Edgar
    Keymaster

    The default ‘separator’ for the forum list is a comma (that comma you see on your site).

    I see you have tweaked your forum list yourself so that each forum is on a new line.

    I can’t see how you did this at the moment as I am using my phone and no CSS inspector.

    Take a look at this https://gist.github.com/3797945 and add it to your functions.php of your theme or add it as a standalone plugin. Instead of a ‘comma’ I have a BR element there which if you removed the tweaks you have already made in your CSS for the forum list, this code snippet will give you the result you are looking for.

    #119161

    In reply to: RSS feeds broken

    Stephen Edgar
    Keymaster

    Thanks for this, sadly the code you have posted has been stripped in your post.

    Could you try posting it again and/or post the code to pastebin.com, a Gist on GitHub

    Better still you could create a ticket over at Trac and submit your patch directly for us.
    https://bbpress.trac.wordpress.org/

    #119152

    In reply to: security

    zaerl
    Participant

    “disable the ability to create new accounts”: Admin panel -> Settings -> General -> Anyone can register (no)

    “What’s the prefered way for a newbie to do that? “: Admin panel -> Forums -> All forums -> The selected forum -> right column (Visibility)

    “Are these the preferred plug-ins?”: yes indeed

    “Do I just copy the code that the author lists into my .htacess file?”: yes, those two vulnerabilities affect every single non-trivial piece of dynamic web software, not only WordPress

    #119151

    Topic: security

    mazcar
    Participant

    I am new to WordPress/BBPress and am coming from PHPBB.

    I am creating a bulletin board using the BBPress plug-in for WordPress. I’m not planning on really using WordPress (yet) for my website. It’s just a few static pages, a css file, and, soon, a forum.

    My board will be for just fifty people and I would like to create all the accounts myself so that I don’t have to worry about spam posts from bogus accounts.

    • In PHPBB, there is a control panel option to disable the ability to create new accounts? I don’t see that option in WP/BBPress. How would I do that?
    • I think I read on this forum that I can make my board invisible to non-members, but that is not a control panel option. What’s the prefered way for a newbie to do that?

    Also, I read an article on WP security, Top 5 WP Vulnerabilities and How To Fix Them.
    http://www.esecurityplanet.com/open-source-security/top-5-wordpress-vulnerabilities-and-how-to-fix-them.html

    Vulnerability # 1: SQL Injection & URL Hacking.
    Vulnerability # 2: Access to Sensitive Files.
    Vulnerability # 3: Default Admin User Account.
    Vulnerability # 4: Default Prefix for Database Tables
    Vulnerability # 5: Brute-Force Login Attempts

    3, 4, and 5 seem pretty obvious to me. However, for help with mitigating the threat of Brute-Force Login Attempts, the author refers to two plug-ins: Limit Login Attempts and Better WP Security. Are these the preferred plug-ins? Although, I really must ask you guys why these two plug-ins aren’t written into the core software in the first place? In fact, shouldn’t the control panel also allow me to limit the creation of new accounts, as well?

    I know BBPress, as a plug-in, is new, but WordPress has been around for ten years. Are the features that I list above planned for future releases, or is security not really an issue for the WP community, but rather up to each user?

    Before I forget, how do I implement the solutions to the first two vulnerabilities? Do I just copy the code that the author lists into my .htacess file?

    I don’t want to sound critical of WP/BBPress, or be the guy who is constantly comparing it to PHPBB. I just want to know the mentality behind it and, really, what I am getting myself into. I had a pretty secure PHPBB board that was easy to set-up and manage, but it was boring and looked like every other PHPBB board out there. I was told that WP/BBPress is customizable (some guy on your board showcases a beautiful board about Stratoliner motorcycles) and more secure than PHPBB. I hope to explore these features without becoming a full-time board developer nor becoming a php guru.

    Thanks. I really appreciate this forum. I have been reading all sorts of posts. So if these questions have been answered, please don’t flame me; it’s not for lack of searching.

    #119147

    In reply to: Change "posting order"

    AlexRayan
    Participant

    To whomever wonders how to switch the order of replies. This filter actually works well, just the code needs to be modified to change the array value in $query[‘order’].

    function bbp_reverse_reply_order( $query = array() ) {
        $query['order']='DESC';
        return $query;
    }
    add_fiter('bbp_has_replies_query','bbp_reverse_reply_order');
    

    Hope, it helps someone.

    Regards,
    Alex

    #119136
    Pippin Williamson
    Participant

    You will have to code it yourself then.

    Why are you opposed to using a plugin? There’s literally no difference between code in a plugin and code placed in a theme.

    #119132
    mostafaqanbari
    Participant

    well done michael! it looks like you did it! but i think there is a more simple way to do so(lets say another way instead of an easy way because your way is not difficult also!). when you install bbpress you can go to yoursite/topics and see list of all topics. in this page you can see similarities with items that you really need:
    http://dl.dropbox.com/u/65583116/topics1.JPG

    the only thing you need to do is find out what file in bbpress do this job. the file is:

    loop-single-topic.php

    and here is the codes related to what we want:enter link description here

    and finally the last thing is having a summary of topic content. that’s i dont know it yet! 😀

    #119124
    mighty_fox
    Participant

    I am using BBPress and in the header I have created an login/logout section for when a guest or user is logged in. I’m currently trying to create a “My Profile” link when a user is logged in but I’m unsure of the functions to achieve this (or if I am using the right functions currently). My code for this currently is:

    if(is_user_logged_in()) {
    global $current_user;
    get_currentuserinfo(); $text .= 'Hi '.$current_user->display_name.'!';
    echo $text;
    echo "#"'>My Profile | Logout"; }
    else{echo "You are currently not logged in!";
    echo "Register |
    Log in"; }

    • This topic was modified 13 years, 5 months ago by mighty_fox.
    • This topic was modified 13 years, 5 months ago by mighty_fox.
    #119122
    zaerl
    Participant

    I’ve checked the documentation of FORCE INDEX, forget the “solution” I’ve posted above. Actually speaking this snippet (maybe) work:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts FORCE INDEX (PRIMARY, post_parent) JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type IN ('post_topic') JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1 AND (wp_posts.ID = 647 OR wp_posts.post_parent = 647) AND wp_posts.post_type IN ('topic', 'reply') AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'closed') AND t.language_code='en' ORDER BY wp_posts.post_date ASC LIMIT 0, 15
    

    Notice the positioning of the FORCE INDEX. Unfortunately we can’t change that part of the query from ‘_bbp_has_replies_where’. We must use the ‘posts_join’ filter, check if WPML have injected its stuff and add the FORCE INDEX.

    #119118
    Shmoo
    Participant

    Another update:

    Switching the page.php template with the code of the page-front-forums.php doesn’t work either..

    It will output all forums twice.
    I really hope @JJJ or somebody else would comment on this because i can’t believe this is default bbPress and WordPress stuff.

    It has to be a bug.

    #119115
    Shmoo
    Participant

    Hi Tom,

    Well i don’t know much about Artisteer because WordPress is not like iWeb or RappidWeaver where you can drag&drop to make your lay-out, If you would like to build or customize your lay-out you need some understanding of HTML , CSS and a bit PHP.
    I’ve helped lots of people at the Dutch WordPress forums and most of them often had trouble with Artisteer because the software often didn’t supported some simple WordPress Codex.
    https://nl.forums.wordpress.org/profile/macpresss

    #119114
    tamarazuk
    Participant

    zaerl,
    Thank you for your help. Unfortunately, I now get a different but similar error (notice the addition of the ‘FOR’:


    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORCE INDEX FOR JOIN (PRIMARY, post_parent) WHERE 1=1 AND (wp_posts.ID = 647 OR ' at line 2]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type IN ('post_topic') JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 FORCE INDEX FOR JOIN (PRIMARY, post_parent) WHERE 1=1 AND (wp_posts.ID = 647 OR wp_posts.post_parent = 647) AND wp_posts.post_type IN ('topic', 'reply') AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'closed') AND t.language_code='en' ORDER BY wp_posts.post_date ASC LIMIT 0, 15

    I am still learning programming in WP and my SQL skills are pretty much non-existent.

    Shmoo
    Participant
    #119108
    Michael
    Participant

    It looks like the editor munged my code, so here’s a pointer to the code (in a .txt file): http://www.dalluva.com/temp/topic-excerpt.txt

    Cheers.
    Michael

    #119107
    Michael
    Participant

    Okay, I’ve made some progress with this, though it’s not quite where I want it to be. I’ve been playing around with the function calls in bbp-topic-template.php, and been able to create a block of code that creates excerpts of topics (though not replies to topics…yet).

    Here’s the resulting output: http://www.dalluva.com/temp/example-excerpt-block-getting-there.JPG

    And here’s the code block (so far):

    $max_shown = 3;
    $parent_forum = 'any';
    $excerpt_length = 200;
    $avatar_size = 60;
    
    $topics_query = array(
        'author'         => 0,
        'post_type'      => bbp_get_topic_post_type(),
        'post_parent'    => $parent_forum,
        'posts_per_page' => $max_shown,
        'post_status'    => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
        'show_stickes'   => false,
        'meta_key'       => '_bbp_last_active_time',
        'orderby'        => 'meta_value',
        'order'          => 'DESC',
        'meta_query'     => array( bbp_exclude_forum_ids( 'meta_query' ) )
        );
    
    $topic_query = new WP_Query( $topics_query );
    if ( $topic_query->have_posts() ) :
        $first_time = 1;
        ?>
    
            have_posts() ) :
                if ( $first_time == 1 ) : $first_time = 0;
                else : echo "" ;
                endif;
                $topic_query->the_post();
                $topic_id = bbp_get_topic_id( $topic_query->post->ID ); ?>
    
    
                    <a class="home-topics-a" href="" title="">
                    In Forum ""
                    By , Posted about 
    
    
                    <a class="home-topics-more more" title="Join the Conversation" href=""> READ MORE
    
    
         <?php
    endif;
    

    I'm going to keep working this and I'll post my final results in the coming days. Any comments/input are appreciated. Cheers. Michael

    #119102
    Michael
    Participant

    Checking the function code in bbp_topic_template.php, the call bbp_topic_excerpt() already accepts a $length argument; the default is 100, but it can be changed. Doh! It can be used as-is.

    Michael

    Shmoo
    Participant

    Just curious, i’ve worked with bbPress before but it looks like the WordPress Hierarchy is broken by bbPress.
    http://codex.wordpress.org/images/1/18/Template_Hierarchy.png

    Normally i could make a page template and call it page-forums.php to make sure WP would use this page template for a new page created by the slug forums

    But for some strange reason this doesn’t work anymore with bbPress 2.2.1 and WP 3.5 Beta and Twenty Twelve.

    How can i make sure WP or bbPress uses a different page template then page.php for showing the forums and category -index on the forums slug?

    I’ve tried everything, Copy/Paste the page-front-forums.php from the Extra’s folder to my Theme’s Root -> Created a new page inside my Dashboard and called it Forums… Nope doesn’t work.. Even when i use the Shortcode [bbp-forum-index] on that last created page.. It keeps using the page.php by default..

    Anybody who can help ?
    Because this it totally not very cool 🙂

    #119084
    venntom
    Participant

    Hi,

    Great forum plugin!

    I am however experiencing some annoying theme compatibility issues…

    My forum page (with [bbp-forum-index] shortcode) was wrongly picking up my theme’s css, instead of the bbpress css.

    Resulting in an unusable forum layout.

    I have applied the theme compatibility actions by copying the necessary bbp-theme-compat directory/files to my theme root.

    By setting the correct bbpress page template via its page attributes, the main forum page (now without shortcode) seems to pick up the bbpress css. But shortcodes are still picking up the wrong css via the default theme page template..

    Any suggestions to make shortcodes work with the bbpress css instead of the theme’s css?

    Are there any additional css styles available that work with the bbpress theme-compat templates?

    I am using wp 3.4.2, bbpress 2.1.2 and my theme is generated with Artisteer 4.

    Regard,Tom

    #119068
    Shane Gowland
    Participant

    Somewhere in your bbPress theme file there is an unneeded comma sitting between two quotation mark characters.

    Remove ", " …and you should be good.

    As for features; it really depends on what you’re looking for. GD bbPress Toolkit has some cool features; like attachments, signatures, custom views etc.

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