Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 30,176 through 30,200 (of 32,491 total)
  • Author
    Search Results
  • #1877

    Topic: localizing plugins

    in forum Plugins
    nicola86
    Member

    Hi,

    I’ve localized a plugin with

    $ xgettext --keyword=__ --keyword=_e -j --from-code=UTF-8 -o plugin.pot *.php

    I translated it all and made the .mo file from the .po

    $ msgfmt plugin-it_IT.po -o plugin-it_IT.mo

    Now, what I have to write in the plugin file? With this line the plugin outputs in english, instead of italian:

    load_plugin_textdomain('onlinelist','my-plugins/');

    #57705
    fel64
    Member

    About two lines of your plugin are counting posts, and if you didn’t write the query into a variable first it would be one. Far more code is taken up with anything else, hence it’s not just a modification.

    In my opinion a neat and efficient solution would be to hook onto the new and delete posts hooks, recalculate title, set in usermeta, and let bb grab that title when it’s needed exactly the same as now. This means an additional database query and calculation of the new title only when new posts are made. Your method means that you do that extra work every time a post is fetched.

    To make this also be neat, you should have the possibility of setting titles and corresponding post count values in bb admin rather than having to change values across several lines to get the desired modifications (changing/adding one line of code would still be acceptableish, I suppose). You should also (in my opinion, yeah) use a far neater method of comparing the post count and setting the title from a code perspective; I dislike a long list of elseifs (at least use cases if you have to do it in this sort of way). I would, off the top of my head, use

    //$postcount already found
    foreach( $possibletitles AS $postcountrequired => $title ) {
    if( $postcount >= $postcountrequired ) {
    $newtitle = $title;
    }
    }

    because that’s like five lines of code and it doesn’t matter how many different post count/title combinations are set, it does not increase in complexity. Putting $possibletitles together from the bb admin would not be difficult either.

    So the three or four things you have to do to make this plugin as I like it are counting posts, bb admin panel set up, comparing postcount and possible titles and setting this in the usermeta. “All this hate” comes from the fact that I thought I’d just explained that you can’t just modify the post count plugin to have this functionality – you need way more code than there is in counting posts to do all this – and then you came along and said that all you need to do is just modify the post count plugin. That irritated me.

    Sam, I don’t agree with this approach in all cases either but I prefer the very small amount of extra (unnecessary) data in the database (maximally one new record per member with one post or more) to re-querying and recalculating every time a post is displayed. :)

    #57766
    Sam Bauers
    Participant

    Try:

    alert(commodAjax.transport.responseText);

    I’m not sure if it will work though.

    Would it be too insulting to refer you to the source code of the WPAjax class? There are answers there if you are able to interpret the code.

    Also, if you are not actually returning some output at the page you are requesting, then it might be returning undefined. Again I’m not sure, being that I (like fel64) volunteer my time to answer queries here, I am not necessarily able to fully troubleshoot your issue (especially since you only present half of the equation – i.e. the client side AJAX request).

    You catch more flies with honey. Etc., etc.

    #57765
    M
    Member

    I find it a bit insulting that all I get is Google links. Don’t get me wrong… for most people who don’t search the forums that’s a great solution. I have searched the forums and Google extensively however, and I’m not seeing a whole lot of helpful stuff when it comes to WordPress’s custom wpAjax class. I’ve gone over prototype tutorials, documentation pages, and more and I haven’t found a solution.

    Also, please explain yourself a little further regarding your “function call” comment. Are you referring to commodAjax.request(commodAjax.url);? Because I believe that’s correct. At least that’s how other people have been doing it. If you’re talking about alert(commodAjax.responseText); that was for debug purposes only. I’m trying to get the value. That’s my original request.

    #57702
    M
    Member

    Wow, so much hate… I’m not trying to insult anyone’s sense of intelligence by making this appear easier than it is. It’s just dead simple. I see no great complexity in it. It’s still a “basic MySQL query.”

    Why muck around in the usermeta? That’s far too much work if you ask me.

    Perhaps I’m wrong.

    function get_user_title( $id ) {
    global $bbdb;

    $pc_query = "SELECT COUNT(post_id)
    FROM $bbdb->posts
    WHERE poster_id = $id
    AND post_status = 0";
    $post_count = $bbdb->query( $pc_query );

    if( $post_count <= 10 ) {
    $title = "Noob";
    } elseif( $post_count <= 20 ) {
    $title = "Might stick around";
    } elseif( $post_count <= 30 ) {
    $title = "Title for 30";
    } elseif( $post_count <= 40 ) {
    $title = "Over the hill";
    .
    .
    .
    } elseif( $post_count <= 90 ) {
    $title = "Post whore";
    } elseif( $post_count > 100 ) {
    $title = "Regular";
    } else {
    $title = "Error";
    }

    return $title;
    }

    This way you don’t have to mess around with updating anything… it’s generated on the fly.

    Do take note that I haven’t tested the code. I wrote it in about 5 minutes, so I didn’t get around to testing. It’s the concept I’m talking about though.

    #57426
    Vili
    Participant

    Just to make sure, you don’t actually use “require_once(‘path/to/wp-blog-header.php’);”, but rather have the “path/to/” bit modified to correspond with the correct folder path to your WordPress installation, right?

    As far as I can see (and I am no real coder, either), somehow your current setup still fails to connect to WordPress, and therefore the WP functions, including get_header, are unavailable to bbPress.

    #1875
    M
    Member

    Here’s the code:

    var commodAjax = new WPAjax( false, 'post-'+postid );
    commodAjax.options.parameters += '&action=rate_post&id=' + postid + '&rate=' + rate;

    // Execute Order 66
    commodAjax.request(commodAjax.url);
    alert(commodAjax.responseText);

    Here’s the response: undefined

    According to FireBug, I am successfully sending postdata and getting a response of “1”. I’d like to take the response and make use of it, but it’s not working.

    I’m writing an extension that allows post rating (user moderation) and this is the final hitch I’m running into. I want to make sure that if the request is not sucessful (ie, it returns 0 or -1) that the browser doesn’t continue executing stuff.

    Sorry, it’s a bit borked, I’ll post more code if necessary.

    #1873
    Vili
    Participant

    If you have integrated your bbPress with WordPress, you must have at least once thought about the problem of your users having two separate interfaces for modifying their profile settings.

    Furthermore, if your bbPress and WordPress both use a good deal of plugins, you end up with a situation where some settings (say, email notifications for new WordPress posts) have to be set on a WordPress profile page, whereas other settings (for example email notifications for new forum topics or replies) must be set through the bbPress interface. This will confuse your average user so much that they will simply not use any of your website’s fancy features at all.

    It would therefore be good to have just one user profile page that would merge everything from the two together. Preferably, this should also be a page that could be displayed within the website template, so that it would really look like being part of the website, and not behind a completely different-looking interface as is the case with WordPress user pages. (Those also scare people.)

    Would this be doable?

    I am personally not much of a coder, so I don’t know all the details of what is going on when the WordPress and bbPress profile pages get served, and how various plugins get to modify that process by adding new fields and buttons on those pages.

    I assume, however, that the most difficult thing for a “one profile page to rule them all” sort of an approach that I am thinking about here would be to keep track of additions to those profile pages. It should somehow be able to notice that some new bbPress or WordPress plugin has modified one of those user profile pages, and incorporate those changes to the merged profile page that is actually displayed to the end user.

    I would love to hear some input from those of you who know more than I do about the behind-the-scenes activity when it comes to user profiles in bbPress and WordPress. What do you think, how difficult would a plugin like this be to code?

    #57667

    In reply to: Tags not separating

    Arlo
    Member

    Ok, I changed line 1255 in functions.php to:

    $words = explode(' ', $tags);

    And this seems to allow both spaces AND commas in new post tags. If there’s a better way to do this, I’d like to know :)

    #57517
    tecfre
    Member

    finally i was able to do it myself .. hehehe :D … Still more things need to be added. it was all from avatar_upload plugin and memberlist plugin. I just tried to modified some code and it worked …

    :-D

    check out

    http://www.tecfre.com/memberlist/ (hosted on wordpress)

    http://www.tecfre.com/forum/mlist.php (on forum)

    davidbaldiwn
    Member

    This is what the config file looks like:

    <?php

    // ** MySQL settings ** //

    define(‘BBDB_NAME’, ‘turner_wrdp3’); // The name of the database

    define(‘BBDB_USER’, ‘***********’); // Your MySQL username

    define(‘BBDB_PASSWORD’, ‘*****************’); // …and password

    define(‘BBDB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value

    // Change the prefix if you want to have multiple forums in a single database.

    $bb_table_prefix = ‘bb_’; // Only letters, numbers and underscores please!

    // If your bbPress URL is http://bbpress.example.com/forums/ , the examples would be correct.

    // Adjust the domain and path to suit your actual URL.

    // Just the domain name; no directories or path. There should be no trailing slash here.

    $bb->domain = ‘http://forums.ppacp.org&#8217;; // Example: ‘http://bbpress.example.com&#8217;

    // There should be both a leading and trailing slash here. ‘/’ is fine if the site is in root.

    $bb->path = ‘/’; // Example: ‘/forums/’

    // What are you going to call me?

    $bb->name = ‘Professional Photographers Againsts Copying Photographs’;

    // This must be set before running the install script.

    $bb->admin_email = ‘*********@ppacp.org’;

    // Set to true if you want pretty permalinks.

    $bb->mod_rewrite = false;

    // The number of topics that show on each page.

    $bb->page_topics = 30;

    // A user can edit a post for this many minutes after submitting.

    $bb->edit_lock = 60;

    // Your timezone offset. Example: -7 for Pacific Daylight Time.

    $bb->gmt_offset = -4;

    // Change this to localize bbPress. A corresponding MO file for the

    // chosen language must be installed to bb-includes/languages.

    // For example, install de.mo to bb-includes/languages and set BBLANG to ‘de’

    // to enable German language support.

    define(‘BBLANG’, ”);

    // Your Akismet Key. You do not need a key to run bbPress, but if you want to take advantage

    // of Akismet’s powerful spam blocking, you’ll need one. You can get an Akismet key at

    // http://wordpress.com/api-keys/

    $bb->akismet_key = ‘*************’; // Example: ‘0123456789ab’

    // The rest is only useful if you are integrating bbPress with WordPress.

    // If you’re not, just leave the rest as it is.

    $bb->wp_table_prefix = ‘wp_’; // WordPress table prefix. Example: ‘wp_’;

    $bb->wp_home = ‘http://ppacp.org&#8217;; // WordPress – Options->General: Blog address (URL) // No trailing slash. Example: ‘http://example.com&#8217;

    $bb->wp_siteurl = ‘http://ppacp.org&#8217;; // WordPress – Options->General: WordPress address (URL) // No trailing slash. Example: ‘http://example.com&#8217;

    /* Stop editing */

    if ( !defined(‘BBPATH’) )

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

    require_once( BBPATH . ‘bb-settings.php’ );

    ?>

    #56978
    Vili
    Participant

    Hmm. Actually, the code that I copy-pasted from the above seems to be different from what I have on my hard drive. At least a number of “<p>” tags appear to be missing.

    #56977
    Vili
    Participant

    There’s something odd there, as the code is 193 lines long, i.e. the line 193 includes only “?>”.

    Anyway, I’ll send you the code in a sec by email.

    #56697

    In reply to: Plugin: Avatar Upload

    fel64
    Member

    Anaon, delete the old files from this plugin, download the plugin again and put the files back where they belong. Hopefully that will work. If not, download the latest version of bb and replaces the files on your server with new ones. It’s a strange error which seems to indicate to me that loading bb-load.php did not succeed fully.

    If a required file requires another file and that fails, does the original requirement also fail or generate a warning/error?

    #57649
    fel64
    Member

    I don’t know. I doubt it, because bbdb (the object used to do any database stuff) is hardcoded all over the place and you need a new bbdb object for every database you connect to, as far as I’m aware. So integration – which consists of sharing the users and usermeta table I think – would be impossible, unless you changed all references to the user tables to use your second bbdb object.

    Why do you want to?

    #56696

    In reply to: Plugin: Avatar Upload

    anaon
    Member

    Hello,

    I’m installing this plugin for my forum. Evering goes well, I have the default avatar, the avatar tab but I can’t upload anything: when I click on the avatar tab, I have this error:

    Fatal error: Call to undefined function: bb_get_current_user_info() in /home.13/s/p/l/spleenar/www/forum/avatar-upload.php on line 24

    Can you help me?

    #57647

    In reply to: limited functions

    fel64
    Member

    I think it’s possible using a cleverly-written plugin that will kill the postform to reply to a thread if you’re not a mod or admin. It hasn’t been done, though, so you’d need to make it yourself.

    To make mods or admin, the best thing is to let people register and then go to their Profile > Edit and change their role to mod or admin. :)

    #57237
    fel64
    Member

    How does this crazy devlist thing work? Signed up but got no emails, so I assume no-one’s talking. I send an email to bbdev@lists.bbpress.org? I don’t want to completely break etiquette or somesuch first time, so I thought I’d wait and see but there isn’t that much to see.

    #57561
    fel64
    Member

    Yup. I think it is, I heard about it in the context of bb a while back. No news, no secrets, although there seems to be some code for view management in the bb-includes which may mean that a proper views system will be introduced (… sometime).

    #56975
    dyaddydad
    Member

    WordPress. I have deleted Dan’s. When I try to activate it or on every single page when it is activated. Can you e-mail me the code so that I have the exact version or post it in the plugins bit. Awgandrews ATHIS gmail.com .

    Same again through:

    Parse error: parse error, unexpected $ in /homepages/27/d120217802/htdocs/wp-content/plugins/cmdavatar.php on line 193

    I haven’t intergrated it with bbpress yet, but since I can’t get it to activate, this doesn’t seem to be the problem.

    Thanks!

    #51020
    Robert
    Member

    I had the same partial 404-links.

    For me the right htaccess solved the issue.

    It was really the missing Options +MultiViews in the .htaccess (root or bbpress-folder – both works). So maybe You’ve a further look?

    #57630
    fel64
    Member

    Manually query the category database and output it? Not that it matters. :P

    #56974
    Vili
    Participant

    Is this on a WordPress or a bbPress page, dyaddydad? Have you done a full bbPress integration, including the “functions” section? Do you use the $forumpage variable as suggested in my post with the code? Did you uninstall Dan’s plugin before uploading mine?

    #57628
    fel64
    Member

    I would’ve thought the duplicated code wouldn’t be more than some basic HTML; CSS can easily be linked to and you have a different API anyway. I can’t say I really know, I haven’t done it. Your function to create the links could easily check if it was called from bb or WP automatically and respond appropriately, but I understand needing the WP API.

    bbolman: https://trac.bbpress.org/timeline

    #57626
    atomastro
    Member

    Few things regarding the wordpress header. The main reason for this is that I want access to the wordpress functions. This is because the sidebar has bbPress user account functions, such as view / edit profile. I need to know what the user’s wordpress id is in order to create these links when bbPress isn’t running. Granted, I could just send them to the wordpress profile, however I don’t care for the wordpress user profile page. It takes them completely out of the site. In addition to this, I dont really want them on the dashboard, for any reason. I eventually plan to extend the profile pages to include user comment activity in addition to forum activity, etc. I couldn’t do that without both systems running. As for the rest of the general integration, faking this functionality by copying and pasting code and duplicating everything seems lazy and sloppy.

Viewing 25 results - 30,176 through 30,200 (of 32,491 total)
Skip to toolbar