Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 26,851 through 26,875 (of 32,481 total)
  • Author
    Search Results
  • #4014
    andersson
    Participant

    Is there a way to extend BB_Locale?

    Today, BB_Locale calls init and that’s that. No hooks/event handling at all, as far as I can tell.

    In method init, among other things, the following loads:

    $this->datetime_formatstring['datetime'] = __('F j, Y - h:i A');

    $this->datetime_formatstring['date'] = __('F j, Y');

    $this->datetime_formatstring['time'] = __('h:i A');

    The Question

    What if anything can I do if I want to have a datetime_formatstring['special-date'] = __('Y F j - h'); added to BB_Locale. I’m using the three existing formats as listed above already and I want to add a fourth alternative without adding a row in core BB-files.

    Just to be clear, I want to be able to do this:

    _e("Today's date, formatted in a special way is:") . bb_datetime_format_i18n( bb_current_time(), 'special-date' );

    Am I missing something obvious here or is the only solution right now to modify the locale.php file?

    Appreciate the help.

    #67697
    gimperdaniel
    Member

    Thanks chrishajer.. I will take a look. bbSync seems good.. i just read too many comments of people complaining about it… but maybe they don’t know how to use it :)

    I will give it a try this next couple of weeks and let you know of results.

    #67698
    chrishajer
    Participant

    If you include bb-load.php in that file, you will have access to bbpress functions. Why not do something like this in that page:

    require_once(/full/path/to/bbpress/bb-load.php)

    #4012
    #67690

    In reply to: My code is showing :P

    chrishajer
    Participant

    It’s not there now. Maybe you resolved it?

    The bb-config.php might have been missing the beginning <?php or maybe the web server was not configured to parse .php files?

    #67692
    _ck_
    Participant

    It’s because you are destroying $user_id

    This is wrong:

    $user_id = bb_get_user( $user_id );
    $bb_twitter = $user_id->social_twitter;

    You should do:

    $user = bb_get_user( $user_id );
    $bb_twitter = $user->social_twitter;

    $user_id holds the id number, not the entire user object.

    #4010

    Hi,

    I can not figure out what is causing one function in a plugin I am trying to make (modify) to cancel out another function from the same plugin on the same page.

    OK, did that make sense.

    Here are my examples.

    bbSocialize – IF (and this is only an example) I want to display all the information from bbSocialize at the top of the profile and at the bottom of the profile, then it is ONLY displayed at the top (canceling the one one the bottom).

    Avatar Upload – I can put the code in to display my avatar as many times as I want and it shows all of them.

    I am not understanding why the bbSocialize code or functions are causing the second one to cancel out.

    That is basically my problem.

    I have modified bbSocialize in the sense that I have added A LOT to it including customizable fields. What I would like to do is have 2 or 3 functions pulling out certain information so that instead of all that info (or whatever you choose) being displayed in one area, you could break it up on the profile page and put some up top, some down on bottom, some in the middle or possibly floating to the right…..whatever. And of course the main function would be available to display all your selections.

    I hope I made that clear enough.

    Almost like the functions are not closing properly — but I really don’t know.

    Ok, here is the basic bbsocialize funtion to display on the profile page.

    // The following function can be used to display profiles on user-profile-page
    function get_socialize() {
    global $user_id, $bb_current_user, $bb_socialize;

    $user_id = bb_get_user( $user_id );

    $bb_twitter = $user_id->social_twitter;

    echo '<div class="socialize_wrap">';
    if ( $bb_socialize['twitter'] == true ) { if ( !empty( $bb_twitter ) ) { echo '<dd><img src="'.$bb_socialize['images_url'].'/bb_twitter.png" width="16" height="16" border="0" /> <a href="http://twitter.com/'.$bb_twitter.'" title="User Twitter account" rel="'.$bb_socialize['links_rel'].'"><span>'.$bb_twitter.'</span></a></dd>'; } }

    echo '</div>';
    }

    #67643
    _ck_
    Participant

    Remember, the problem with MATCH AGAINST is it will not do partial words or words under 4 characters.

    It’s not too hard to replace the search, you just have to decide which way you want to go. The regular expression will at least do 3 character words which I find is more common than you’d imagine.

    The problem is that the time for any way without an index is going to increase dramatically once you start adding sorting and other options that cause full table scans. You can see this happen if you try to add a simple option to the regex demo like sorting by reverse post_id (which is a trick that should be a little faster than sorting by date).

    SELECT * FROM bb_posts WHERE post_text LIKE '%test%' LIMIT 5 ORDER BY post_id DESC;

    and

    SELECT * FROM bb_posts WHERE post_text LIKE '%test%' AND REGEXP ':<:%test%:>:' LIMIT 5 ORDER BY post_id DESC;

    You might want to test a worse case scenario by using three character nonsense words that will cause a cache-miss like “zzz” and “aaa”. Change them each time so mysql cannot cache the results and give you faster times.

    If the above example returns in an acceptable amount of time you can just replace bbpress’s built in search with that simple method. By parsing a query you can also AND words together instead of bbPress’s default OR which to me is incredibly annoying and useless (you’ll notice no major search engine like Yahoo or Google does OR by default).

    #4009
    supermitten
    Member

    Some of the code for bb-config. php is showing at the top of my bulletin board.

    http://www.comicbooksyndicate.com/syndicatebb/

    How do I get rid of this?

    #67266
    meitershaker
    Member

    please, i would like to understand my error in the code :(

    #67642
    Mark Barnes
    Member

    @_ck_:

    I currently have:

    have_query_cache: YES

    query_cache_limit 1048576

    query_cache_min_res_unit 4096

    query_cache_size 16777216

    query_cache_type ON

    query_cache_wlock_invalidateOFF

    though I’ve got plenty of RAM to tweak this. I don’t want to just throw RAM at poorly optimised queries though.

    The simple query you mentioned takes 2 seconds for me (uncached). MATCH AGAINST with a full-text index takes 0.3 seconds. Keeping a full-text index only increased the database size by 30% in my case. That’s well worth while in the days where disk space is so cheap. The regular expression executes even quicker (0.2s), but as you say does not do partial words.

    There’s no reason why the core can’t have an option for full-text in the settings page, with two different search methods depending on what is chosen. It would only take 20 or so lines of code.

    #67687
    _ck_
    Participant

    Well you have a point in that it’s important to you and you are expressing your feedback in the feedback section, however again, it’s an alpha issue so I can’t be motivated.

    Oh and I would never actually delete you.

    It was a just my own “feedback” you might say ;-)

    So don’t take it personally.

    #67641
    _ck_
    Participant

    Oh and looking at a MySQL performance guide for text search, apparently bbPress’s search is using ALL of the slowdown triggers:

    order by

    group by

    and worst of all SQL_CALC_FOUND_ROWS

    How long does this query take without the modifiers:

    SELECT * FROM bb_posts WHERE post_text LIKE '%test%' LIMIT 5;

    because that’s as fast as it can possibly get without an index and should be used as a baseline.

    Looking at the original query, I believe they are causing a FULL scan of the entire table to rank and group it first. That’s going to be insanely slow.

    You might be able to just use LIKE with a simple sort by post date DESC.

    The largest bbPress install I have access to has nearly 100,000 rows and still only takes 0.04 seconds for that trimmed query. The original queries you posted take 0.5 seconds so that’s 10x slower.

    #67685
    _ck_
    Participant

    If I had the ability to delete accounts it would be for people who insist their “missing feature” is the most important ;-)

    Fortunately they are smart enough to not let me delete accounts, lol. Your missing feature is the least needed feature for thousands of other people.

    Let me express this for the 100th time (not just to you, to everyone). 1.0 is *alpha* – it’s not stable, it’s not final, it’s not even close to final. They are adding and changing things daily. Sam just changed something this morning.

    The bb-sync author (fel64?) did a fantastic job. But bbPress changing is not their fault (or their problem unless they want it to be).

    If they go and spend hours to make it work now under 1.0 alpha, it may break again tomorrow. And the day after that. They are still changing 1.0 alpha and will change it again.

    You running 1.0 alpha right now for a live, active site is exactly one person’s problem, yours.

    #67683

    In reply to: Hackers?

    _ck_
    Participant

    I think that’s one of the default javascripts scripts loaded in the topic.php page.

    It only shows in mini-track because it’s generated by a php file.

    Most of the javascript in bbPress can be disabled and makes for faster loading pages (ajax goes away however).

    So the answer is no, it’s not hacking. But you will see the attempts sooner or later – there are thousands of bots out there scanning sites and most people are unaware.

    I’ll put in some code to exclude bb-includes in the next mini-track.

    #67664
    Clicknathan
    Participant

    So here’s what I found, though I wasn’t personally able to get it to work myself, I’m almost positive that someone with a bit more PHP knowledge would have been able to:

    This plugin: https://bbpress.org/plugins/topic/forum-last-poster/#post-1538

    + _ck_’s advice in this post: https://bbpress.org/plugins/topic/forum-last-poster/#post-1546

    He details how, using substr, you can truncate the amount of words being pulled from the any piece of content. Theoretically you could use:

    post_text(forum_last_topic_id());

    But with the truncation method he mentions. I, unfortunately, just don’t know how. :(

    #66091
    nekita
    Member

    Chris,

    thanks for your reply. You are right, there’s not much general sense in that problem to begin with.

    Unfortunately the issue already starts with the use of a relative vs. an absolute path because the absolute variant isn’t even recognized. The only two options available seem to be either the relative take with

    require_once(‘../wp-blog-header.php’);

    or something that could be called absolute, but is pretty inconvenient to use:

    define(‘WPPATH’, dirname(dirname(__FILE__)) . ‘/’);

    require_once(WPPATH . ‘wp-blog-header.php’);

    Both of these result in the availability of WP commands like get_header etc. which would be needed to visually integrate bbP with WP, but with the major problem that all my accounts in bbP are Inactive for some weird reason.

    Every other attempt where the path to wp-blog-header.php would really be false would just result in the forum link to not work any longer. Therefore it does seem much more likely that different elements of bbP are more or less able to deal with this way of WP integration or access to that file. I would love to give you more detailed error information about the 500 error but I’m not sure where to aquire it.

    Furthermore, that problem with Inactive accounts doesn’t seem to be entirely new. I did some research via google and it does pop up every now and then, here’s an example even from way back in 2006: http://comox.textdrive.com/pipermail/bbdev/2006-September/000719.html

    > > > There is an issue with posting:
    > > > bbpress shows the users (admin) as Inactive. This lets me login, but
    > > > I cannot post since the post form is hidden.
    > >
    > > You must have integrated an old bbPress install with WP (that is, you
    > > must have run the bbPress install script before integrating the
    > > two). If that's the case, none of your bbPress users exist anymore
    > > (they're not defined in WP's user table), and your admin account is
    > > inactive. To fix your admin account, you'll have to change the usermeta
    > >
    > > bb_capabilities = a:1:{s:8:"inactive";b:1;}
    > >
    > > to
    > >
    > > bb_capabilities = a:1:{s:9:"keymaster";b:1;}
    > >
    > > for your admin account. (Where 'bb_' is your $bb_table_prefix.)

    Unfortunately the usermeta in my database is already set as a:1:{s:9:”keymaster”;b:1;}, but it’s still acting as if users are inactive.

    It really is pretty tiresome and after many many database restores and bbP reinstalls I come to the conclusion that integration of WP Functions is somewhat poorly treated so far.

    For now my best bet seems to be to either try and replicate my WP scheme within bbP which would take a lot of double work and maintenance when I apply changes to my blog or go with a different forum solution altogether. : /

    #67673

    In reply to: bbPress 1.0 Stable

    _ck_
    Participant

    That roadmap is wildly inaccurate and just guesses.

    Not only does 1.0 gut huge sections of code that were perfectly working under 0.9 and need to be replaced but it also replaces entire concepts (like the new object cache). There is a huge amount of work to do and I don’t envy Sam and Michael’s jobs right now. Then it will need lots of testing and debugging.

    Then there is plugin stability since everything is in a state of flux. I can’t even keep up with the changes anymore, I’ve stopped updating my plugins until things settle down a bit.

    Sam is currently working on trackbacks (pingbacks) now which was suppose to be the big new “feature” for 1.0 IMHO it’s a huge waste of time that could be spent elsewhere in the code but pingbacks on forums was something Matt wanted, so he gets what he wants obviously. However it will be the first feature I delete (not just disable, but delete) since XML-RPC was the #1 security problem with WordPress over the years. It’s also going to be a spammer’s delight.

    #67635
    _ck_
    Participant

    Actually, the best thing to do is completely replace the search facility. That’s what I do in Super Search. bbPress’s search is very weak, so weak that there wasn’t even a link to it on any page in 0.9 (it’s similar to WordPress’s search, which also sucks, it’s the ugly truth no one seems to talk about).

    I assume you are using the bb-benchmark plugin to watch those queries happen (if not, you should be).

    Stupid question but you DO have the mysql cache turned on? I only ask because on many server configs (like CPANEL) it’s turned off by default. What does your my.cnf look like? (do a cat /etc/my.cnf in your shell)

    Try going into phpmyadmin (or command line) and test that first test query against adding AND post_text REGEXP ':<:%test%:>:' to the query like so:

    SELECT p.*, 0 AS search_score, MAX(post_time) AS post_time FROM bb_posts AS p JOIN bb_topics as t ON ( t.topic_id = p.topic_id ) WHERE p.post_text LIKE '%test%' AND p.post_text REGEXP ':<:%test%:>:' AND p.post_status = '0' AND t.topic_status = '0' GROUP BY t.topic_id ORDER BY p.post_time DESC LIMIT 5;

    I suspect in the end due to your huge db size you are going to need to completely replace the search functions with something like this http://sphinxsearch.com which has a PHP api. Fortunately in bbPress it’s very simple to hook the internal search and bypass it entirely without even template hacks. A quick google shows that a few WordPress plugins have sphinxsearch support so that would be easy to copy over to bbPress. If you find the keyword “sphinxsearch” on this source for example, you can see how it’s done: http://svn.scriblio.net/plugin/trunk/scriblio.php

    #67672

    In reply to: bbPress 1.0 Stable

    cartmanffc
    Member

    I hope we’ll get the stable version from Santa ;)

    #66090
    chrishajer
    Participant

    Hmm – that makes no sense to me. What is the exact error you get if you do not include the if (file_exists statement?

    #67670
    Clicknathan
    Participant

    My fault, the problem is that I’m a big dumb idiot. :)

    I had an if statement that wasn’t being closed at the right spot. Thanks for your help chris!

    #67633
    Mark Barnes
    Member

    I tested this on a very large database under very low load. The standard bbpress search creates two queries, namely:

    SELECT p.*, 0 AS search_score, MAX(post_time) AS post_time FROM bb_posts AS p JOIN bb_topics as t ON ( t.topic_id = p.topic_id ) WHERE p.post_text LIKE '%test%' AND p.post_status = '0' AND t.topic_status = '0' GROUP BY t.topic_id ORDER BY p.post_time DESC LIMIT 5;

    and

    SELECT t.*, MIN(p.post_id) as post_id, GROUP_CONCAT(p.post_text SEPARATOR ' ') AS post_text, 0 AS search_score FROM bb_topics AS t JOIN bb_posts as p ON ( t.topic_id = p.topic_id ) WHERE t.topic_status = '0' AND p.post_status = '0' AND ( (t.topic_title LIKE '%test%') OR p.post_text LIKE '%test%' ) GROUP BY t.topic_id ORDER BY t.topic_time DESC LIMIT 30

    I ran both queries five times with different search terms. On my very large database, with no optimisation, the first query took (167s, 104s, 36s, 29.7s, 24s), the second (33s, 21s, 22s, 20s, 21s).

    #67671

    In reply to: bbPress 1.0 Stable

    meitershaker
    Member
    #66088
    chrishajer
    Participant

    Nekita – the reason that works is because it’s not including the wp-blog-header.php (can’t find it), but it doesn’t error out because you’re saying “if it’s there, then include it”: otherwise, just continue on, but it’s not included.

    So, it errors out when you don’t have the conditional, but with the conditional there, do you have access to WordPress functions, or you can just access specific theme files? Accessing the theme files would not require integration. But using the functions like get_header, get_sidebar, get_footer would all rely on integration being correct.

    This assumes that the errors are the same as doyle640:

    PHP Fatal error: require_once() [function.require]:

    Failed opening required '../wp-config.php'

Viewing 25 results - 26,851 through 26,875 (of 32,481 total)
Skip to toolbar