HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Problem with links in comments section (version 2.1)

Hi,

does anyone got a problem with links in comments section? With latest forum versions, links were created automatically after you put links with http:// but since version 2.1 does not. I was looking for any option but i didn`t found nothing. When i try to put links with http:// or mention about users in comments with @username it is not possible as was in older versions. Links and users that we mention are as text, not links at all. Do you know guys what can be the problem?

Thanks in case for reply!

Comments

  • In conf/config.php check which editor is set there. In phpMyAdmin in the discussions and comments tables check what is set at 'Format' column

    There was an error rendering this rich post.

  • warzydwarzyd New
    edited May 2014

    At first thanks for reply @UnderDog :)

    I have checked tables in phpMyAdmin and in both, format is "Html". But in conf/config.php file i got following plugins activated:

    // EnabledPlugins

    $Configuration['EnabledPlugins']['HtmLawed'] = 'HtmLawed';

    $Configuration['EnabledPlugins']['Emotify'] = TRUE;

    $Configuration['EnabledPlugins']['AllViewed'] = TRUE;

    $Configuration['EnabledPlugins']['Gravatar'] = TRUE;

    $Configuration['EnabledPlugins']['cleditor'] = TRUE;

    So i use standard WYSIWYG (CLEditor) Version 1.3.1 By Mirabilia Media

  • I`m not sure if i was clear but i realized one thing. When i mention on forum about someone, like @username i see notification that someone mentioned about me but this label is as regular text, not link. But when i try to put link, like: http://gmail.com it also shows as regular text and is not link. In previous version of vanilla, links were added automatically. So when i mentioned about someone or i added link, they appeared as a link, not text.

    One more thing! I don`t know if this is important but this happen only in comments. When i create topic, then all is fine. Mentioning about someone and links shows as link so it is fine. But in comments they not.

    Hope someone will be able to help me with this problem. Thanks!

  • peregrineperegrine MVP
    edited May 2014

    does it work properly using buttonbar instead of cleditor. I don't use cleditor because it is deprecated and will not be supported in future versions of vanilla, because it has too many 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.

  • warzydwarzyd New
    edited May 2014

    @peregrine‌ I have already tested "button bar" instead of "claeditor" and the same thing happen. I do not see any links in comments sections. Even if i turned them both, do not see links and i have no idea what happen. Settings are exactly the same as in previous version and in older everything works, but with 2.1 does not.

  • peregrineperegrine MVP
    edited May 2014

    check your console with firebug or webdeveloper in your browser to see if you have any js errors.

    also try disabling all your plugins via the dashboard and use the default theme and see if you have the same issue.

    once you do that. add a new comment and see if it works.

    also what inputformatter are you using. BBCode, Html , Markdown. etc.

    and is your forum embedded.

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

  • this what I use as a guide.

    solves or isolates the problem 99% of the time.

    http://vanillaforums.org/discussion/comment/199091#Comment_199091

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

  • hgtonighthgtonight ∞ · New Moderator

    Mention formatting (@warzyd is called a mention) can be overridden by plugins. Disable all plugins (temporarily) to determine if one of your plugins is overriding the mention formatting.

    Auto linking is the same way.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • warzydwarzyd New
    edited May 2014

    @peregrine‌

    Javascript console was the first thing i have checked :) No errors of course.

    I have already turned off all plugins and switched to default and theme and this was not helpful because nothing changed.

    Where i can check inputformatter? And what you mean forum embedded? I have plain installation only without any special things.

    So javascript is responsible for text recognition and if see link (http://) or mentioning (@) is making them as links?

    @hgtonight‌ I did what you wrote exactly and nothing changed.

  • peregrineperegrine MVP
    edited May 2014

    if ALL of your plugins are disabled
    (leave HtmlLawed alone and don't disable it).

    and you are using a clean default theme untouched.

    and problem is not fixed.

    I would do this.
    http://vanillaforums.org/discussion/comment/199091#Comment_199091

    especially downloading core files again and re-installing the files from downloaded zip (no need to re-insall the database). just re-copy the unzipped core files over your forum directory.

    inputformatter is in your config.php

    $Configuration['Garden']['InputFormatter'] = 'Html';

    if it isn't there you can add it (it won't hurt).

    you can set it to BBCode (ill-advised), MarkDown or Html (other options are available as well burt not recommended)

    Markdown or Html are the best to use.

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

  • @peregrine‌ I found the problem :) It is related with one small modification but have no idea what can be wrong. I don't know if i am tired but i do not see anything wrong. Will be great if you can look at http://pastie.org/9240333

    In older version i have used $Object->FormatBody which is not working in new version. In new i have used $Object->Body instead and that`s the problem. Do you have idea what i should use instead of $Object->FormatBody in new vanilla version?

  • Nevermind! Already fixed :) I should to use echo instead of object. So the right function is http://pastie.org/9240408

    Thanks for everything!

  • hgtonighthgtonight ∞ · New Moderator
    edited May 2014

    @warzyd‌ There is an event hook right there for you to make use of. So let's do it.

    Step 1 make a plugin.

    1. Create a new folder in /plugins called 'SignInForAnswer'
    2. Inside that folder create a new file called 'class.signinforanswer.plugin.php' with the following text:
        <?php if (!defined('APPLICATION')) exit();
        $PluginInfo['SignInForAnswer'] = array(
          'Name' => 'Sign In For Answer',
           'Description' => 'Replaces answers for guests with a message to sign in.',
           'Version' => '0.1',
           'RequiredApplications' => array('Vanilla' => '2.1'),
           'MobileFriendly' => TRUE,
           'Author' => 'warzyd',
           'AuthorUrl' => 'http://www.vanillaforums.org/profile/warzyd'
        );
    
        class SignInForAnswerPlugin extends Gdn_Plugin {
    
        }
    
    1. Go ahead and enable this new plugin in your dashboard
    2. Now you need to hook into that event you have listed. Use Base_BeforeCommentBody_Handler.
    3. Now that we are hooked in, we check for a valid session, make sure the UserID is 1 and make sure it isn't the first comment. The following code need to be put inside the plugin braces:
        public function Base_AfterCommentFormat_Handler($Sender) {
          $Object = &$Sender->EventArguments['Object'];
          $Session = Gdn::Session();
          if(!$Session->IsValid() && $CssClass != 'Item Comment FirstComment' && $Object->InsertUserID == 1) {
            $Object->FormatBody = 'Please ' . Anchor('sign in', '/entry/signin?Target=discussions', 'SignInPopup') . ' to see answear!';
          }
        }
    

    Now you have a functioning plugin that doesn't modify the core!

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Thanks @hgtonight‌ I will try your solution :)

Sign In or Register to comment.