Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Try Vanilla Forums Cloud product



Last Active
  • Re: Report Missing Localization Strings Here

    I've written a small script which searches for all calls of T(string) in the code and extracts those string, which are not in Transifex, i.e. which are not known in the localization file:

    $vanilla_dir = '.'; // path to the vanilla directory, default is the current directory
    $locale = 'vf_de'; // use this locale to check if the string exists in transifex
    $dirs = array('applications', 'library', 'themes'); // search in these directories only
    $pcre = <<<'EOT'
    $cmd = 'grep -Prohi '.escapeshellarg($pcre); // you need to have grep installed
    $locale_dir = $vanilla_dir.'/locales/'.$locale.'/';
    exec('cd '.escapeshellarg($vanilla_dir).';'.$cmd.' '.implode(' ', $dirs), $matches);
    foreach($matches as $match) {
            $string = substr($match, 4, -2);
            $c = substr($match, 3, 1);
            $string = str_replace('\\'.$c, $c, $string);
            if(!array_key_exists($string, $Definition)) {
                    echo $string."\n";

    Currently, it produces a list of 282 missing strings for the vanilla code at GitHub. All these strings have to be added to Transifex. Due to the length, I'm not posting them here -- you can run the script on your local site with the current code and localization files from transifex to get the list of missing strings.

    @Todd, could you please add these strings to transifex?

  • Re: DiscussionsTable: display error if there is no comment

    I've debugged this issue and came to a solution. Is this the right place to discuss such issues on this coding level or should I write an issue on Github for that?

    Debugging the Problem

    The table layout is realized in applications/vanilla/views/discussions/table_functions.php in the function writeDiscussionRow(...). In line 49, there is a special case for discussions without comments:
    if ($Discussion->LastUserID) $Last = UserBuilder($Discussion, 'Last'); else { $Last = $First; }

    However, in some cases $Discussion->LastUserID is set, even there is no comment and even the row LastUserID in the database is set to null. This is due to the function DiscussionModel->Calculate(...) which has also a special case for discussions without comments (applications/vanilla/models/class.discussionmodel.php line 719):
    if ($Discussion->LastUserID == null) { $Discussion->LastUserID = $Discussion->InsertUserID; $Discussion->LastDate = $Discussion->DateInserted; }

    As you can see, only LastUserID and LastDate is set, and not also required attributes Name, Photo and Email. However, these attributes are set by calling Gdn::userModel()->joinUsers(...).

    Strangely, the functions Calculate (typically indirect by calling DiscussionModel->addDiscussionColumns()) and joinUsers is not always called in the same order:

    • CategoriesController->index(...) calls DiscussionModel->getWhere(...) which calls Calculate at first and therefore provides correct results.
    • DiscussionsController->mine(...) as well as TaggingPlugin->discussionsController_Tagged_create(...) call DiscussionModel->get(...) which calls joinUsers before calling calculate and therefore provide erroneous results.

    Suggestions for Bugfixes

    There are several ways for fixing this issue. Since I'm relatively new to the code of vanilla, I can't estimate the side effects of a bugfix. Therefore, I'm listing all possibilities I can spot. However, one solution is sufficient.

    a) Fixing DiscussionModel->get(...)
    applications/vanilla/models/class.discussionmodel.php line 316:
    move this line
    Gdn::userModel()->joinUsers($Data, array('FirstUserID', 'LastUserID'));
    5 lines downwards after the line
    Now, the user data is gathered also for the (fake) last user ID. However, this change of function call might have also to be done in other situations, e.g. in DiscussionModel->getID(...).

    b) Fixing DiscussionModel->Calculate(...)
    applications/vanilla/models/class.discussionmodel.php line 719
    Remove the following lines:
    if ($Discussion->LastUserID == null) { $Discussion->LastUserID = $Discussion->InsertUserID; $Discussion->LastDate = $Discussion->DateInserted; } Now, there is only one source for the special case for discussions without comments (applications/vanilla/views/discussions/table_functions.php line 49). However, this could be problematic for other layouts than table layout. But I didn't checked this.

    I would be happy, if someone integrates a bugfix into the vanilla code :awesome:

  • Re: Vanillicon Proxy: Suggestion for more Privacy and Reliability

    I've implemented your suggestions, released a new version and published it as project on GitHub.

  • Re: Bugfixing RSS-Feeds for Tagging plugin in Vanilla 2.2

    I've provided these issues as pull request on Github.