Please upgrade here. These earlier versions are no longer being updated and have security issues.

BBCode input formatter does nothing

If I add the following to my configuration: $Configuration['Garden']['InputFormatter'] = 'BBCode'; and create a new post containing [b]bold[/b] then it will show up, verbatim, as "[b]bold[/b]" in the post body.

«13

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Is there "BBCode" in column "Format" of table GDN_Discsussion/GDN_Comment in your database?
    What version of Vanilla are you using (look at /index.php)?
    Have you tried it with all plugins deactivated?


    hgtonightUnderDog
  • @R_J said:
    Is there "BBCode" in column "Format" of table GDN_Discsussion/GDN_Comment in your database?

    Yes

    What version of Vanilla are you using (look at /index.php)?

    2.0.18.10

    Have you tried it with all plugins deactivated?

    Yes

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    You're the one who cannot enable themes, right? :|

    If BBCode is not working although it should (from your answers there is no reason why it should not!) and you have also other problems with standard Vanilla that no one else has, I would assume that your installation is incomplete or buggy. I suggest you back up what you have and just copy a fresh download of Vanilla to your server.


  • BilgeBilge New
    edited January 2014

    I can copy the files as many times as you like but it doesn't change anything. The same problems occur with every deployment.

  • you could try a different server host or make a local installation on your home pc, and see if you run into the same problems.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • By the way, when you do a fresh installation, isn't the "Vanilla" application supposed to be enabled by default? Both times I've tried to deploy this software I had to enable it manually. Since I'd never used this software before it was the source of much frustration when trying to figure out why visiting root gave a "page not found" error.

  • @Bilge said:
    By the way, when you do a fresh installation, isn't the "Vanilla" application supposed to be enabled by default? Both times I've tried to deploy this software I had to enable it manually. Since I'd never used this software before it was the source of much frustration when trying to figure out why visiting root gave a "page not found" error.

    yes you are correct. the application should be enabled automatically. A few people other people have had the same problem with config not being written to properly during install. Something with the config.php not being able to be written to for some unknown reason. It would be nice to know what the common factor is that results in this. php version, os version, server host, permission and ownership settings applied by host, etc.

    We need to tie those other discussions together to see if there is one common reason.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • BilgeBilge New
    edited January 2014

    Ubuntu 12.04.4 LTS
    PHP 5.5.8
    Apache/2.4.6

    There are no "settings applied by the host". I have a dedicated server. All software and settings are my own and all software works perfectly except Vanilla.

  • peregrineperegrine MVP
    edited January 2014

    with respect to installation problems.

    try php 5.3 or 5.4 if you can, just for grins.

    and install nginx and see if it gives you different results.

    also you can use version check plugin http://vanillaforums.org/addon/versioncheck-plugin to see who the web process owner is and make sure all files and folders have that ownership.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Could you save the code below as file /plugins/ET/class.et.plugin.php and activate the plugin "et" in the dashboard? You have a problem with your config, I think, so you might have to add $Configuration['EnabledPlugins']['ET'] = TRUE; to your config.php manually in order to enable it.

    The plugin will add some lines of information above each comment. Would you mind sharing that information with us? It might be helpful to find the error.

    <?php if (!defined('APPLICATION')) exit();
    
    $PluginInfo['ET'] = array(
        'Name' => 'ET',
        'Description' => 'ErrorTest',
        'Version' => '0.1',
        'Author' => 'Robin'
    );
    
    class ETPlugin extends Gdn_Plugin {
       public function DiscussionController_BeforeCommentBody_Handler($Sender) {
             decho('Reading content of config.php: '.C('Garden.InputFormatter', 'No Config Found!'));
             decho('Using config cache? '.Gdn_Configuration::Caching());
             // reset config caching
             decho('Resetting config caching...');
             Gdn_Configuration::Caching(0);
             decho('Reading content of config.php again: '.C('Garden.InputFormatter', 'No Config Found!'));
             // reload config from file
             $Config = new Gdn_Configuration;
             $Config->Caching(0);
             $Config->Load(PATH_LOCAL_CONF.DS.'config-defaults.php', 'Use', 'Configuration');
             decho('Value of InputFormatter in config-defaults.php: '.$Config->Get('Garden.InputFormatter', 'No Config Found!'));
             $Config->Load(PATH_LOCAL_CONF.DS.'config.php', 'Use', 'Configuration');
             decho('Value of InputFormatter after reading config.php: '.$Config->Get('Garden.InputFormatter', 'No Config Found!'));
             decho('Manually calling format function: '.Gdn_Format::Auto('[s]strike through[/s]'));
             decho(PATH_CONF.'/config-defaults.php exists? '.file_exists(PATH_CONF.'/config-defaults.php'));
             decho(PATH_CONF.'/config.php exists? '.file_exists(PATH_CONF.'/config.php'));
             $Format = $Sender->EventArguments['Comment']->Format;
             if ($Format == '') {$Format = $Sender->EventArguments['Discussion']->Format;}
             decho('Comment format: '.$Format);
       }
    }
    


    Bilgehgtonight
  • BilgeBilge New
    edited January 2014

    DEBUG: Reading content of config.php: BBCode

    DEBUG: Using config cache?

    DEBUG: Resetting config caching...

    DEBUG: Reading content of config.php again: BBCode

    DEBUG: Value of InputFormatter in config-defaults.php: Html

    DEBUG: Value of InputFormatter after reading config.php: BBCode

    DEBUG: Manually calling format function: [s]strike through[/s]

    DEBUG: /home/www/boontex.com/wow/discuss/conf/config-defaults.php exists? 1

    DEBUG: /home/www/boontex.com/wow/discuss/conf/config.php exists? 1

    DEBUG: Comment format: BBCode

    [b]bold[/b]

    Note: I can enable plugins form the dashboard but I have to refresh the plugin page to see the change. When I click enable or disable and it reloads itself I see no change initially until I refresh it again manually a second or two later. If I refresh too fast it still doesn't update to show the plugin is enabled; I have to wait a second. I assume this is not how it's supposed to work.

    hgtonight
  • ShadowdareShadowdare π Moderator
    edited January 2014

    @Bilge said:
    Note: I can enable plugins form the dashboard but I have to refresh the plugin page to see the change. When I click enable or disable and it reloads itself I see no change initially until I refresh it again manually a second or two later. If I refresh too fast it still doesn't update to show the plugin is enabled; I have to wait a second. I assume this is not how it's supposed to work.

    Does this issue apply to the theme problem as well? Would you disable OPcache in the PHP configuration and see if doing so fixes the problems? Please be sure to verify that changes to the PHP configuration take place after a restart of the web server.

    Add Pages to Vanilla with the Basic Pages app

    hgtonightUnderDog
  • BilgeBilge New
    edited January 2014

    Why would touching the OPcache accomplish anything? It's a cache of OP codes, not pages.

  • x00x00 MVP
    edited January 2014

    OPcache like APC does cache scripts, like APC you can set it up so it doesn't automatically clear the cache, e.g. apc.stat = 0.

    If you are having trouble with persistence, or any setting not being applied straight away it would be natural to assume, that it has something to do with caching.

    grep is your friend.

    hgtonightShadowdareUnderDog
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Well, everything looks great, except for the output of the function that should give you formatted bbcode...

    I have no clue and would try to drill down into that "broken" function in order to see what is not working.
    The function that outputs formatted text is in /library/core/class.format.php. Could you add decho($Formatter); after

       public static function Auto($Mixed) {
          $Formatter = C('Garden.InputFormatter');
    

    in order to see if it outputs 'BBCode' correctly?

    If it does, it should call the function BBCode. In order to check that, please add a decho(__LINE__); before each return something in the function BBCode() in order to see where it escapes the function without applying the bbcode formatting


    hgtonightUnderDog
  • x00x00 MVP
    edited January 2014

    opcache.revalidate_freq/opcache.validate_timestamps are most likely the reason why your setting aren't being detected immediately.

    The isn't necessarily a problem though, where the production environment is set up how you like.

    Also caching where it is used effectively, is based on knowledge of what you want out of it. There is no caching solution that is just turn it on and forget about it, of course people do that, but that doesn't mean they are using it effectively.

    grep is your friend.

    hgtonightUnderDog
  • BilgeBilge New
    edited January 2014

    I understand that the OPcache could be the cause of not seeing changes applied to the settings immediately, since the settings are PHP code, but I do not see how it could solve the BBCode problem.

  • BilgeBilge New
    edited January 2014

    @R_J said:
    Well, everything looks great, except for the output of the function that should give you formatted bbcode...

    I have no clue and would try to drill down into that "broken" function in order to see what is not working.
    The function that outputs formatted text is in /library/core/class.format.php. Could you add decho($Formatter); after

       public static function Auto($Mixed) {
          $Formatter = C('Garden.InputFormatter');
    

    in order to see if it outputs 'BBCode' correctly?

    If it does, it should call the function BBCode. In order to check that, please add a decho(__LINE__); before each return something in the function BBCode() in order to see where it escapes the function without applying the bbcode formatting

    I inserted die('dead'); at the top of the Auto function but it was not called. Auto() is never called.

    If I enable the ET plugin, it outputs: DEBUG: BBCode once per comment, immediately before the line DEBUG: Manually calling format function: [s]strike through[/s].

    hgtonight
  • I inserted die('dead'); at the top of the Auto function but it was not called. Auto() is never called.

    It is called, that script can be cached. It is illegal in php to have the same class name. so unless you are mysteriously overriding the autoloading, it must be called.

    However it depends on the context. In discussions Gdn_Format::To() is used becuase the format is determined by the Column.

    grep is your friend.

    hgtonightUnderDog
  • x00x00 MVP
    edited January 2014

    Note this line in Gdn_Format::BBCode()

             $Formatter = Gdn::Factory('HtmlFormatter');
             if (is_null($Formatter)) {
                return Gdn_Format::Display($Mixed);
    

    Have you removed the HtmLawed plugin? That plugin is needed even if you a re not using it as your formatter. it doesn't need to be enabled. It is used in general sanitation.

    That would be my first guess. Also check the view permissions.

    grep is your friend.

    hgtonight
«13
This discussion has been closed.