WordPress.org

Ready to get started?Download WordPress

Forums

How to allow tag for non-admins on comments (5 posts)

  1. rflfn
    Member
    Posted 9 months ago #

    Hi, i add this code on my theme functions.php (for this tutorial)

    add_filter('preprocess_comment','allowpretag');
    function allowpretag($data) {
      global $allowedtags;
      $allowedtags['pre'] = array('class'=>array());
      return $data;
    }

    When admin post any comment works correctly, but when users post any comments using tag <pre>, some times works, some times dont work, example this code work for admin but not for users:

    <pre class="brush:php">
    <?php
       Echo "Hello, World!";
    ?>
    </pre>

    For admin works, but for users appear a blank line.

    When users remove tag php <?php the code works, but if the all code have other tag <?php the rest of it is ignored, example:
    this code work for admin and users:

    <pre class="brush:php">
       Echo "Hello, World!";

    Here's my blog for test, please post comment for test http://testonly.rflfn.com/?p=1

    Note: im using this plugin
    http://wordpress.org/plugins/syntax-highlighter-compress/

    No are others plugins enabled on site.

    I would like the tag <pre> working correctly, and that all tags within it appear normally, without being ignored.

  2. rflfn
    Member
    Posted 9 months ago #

    Sorry for inccorrect syntax

    When admin post any comment works correctly, but when users post any comments using tag, some times works, some times dont work, example this code work for admin but not for users:

    I would like the tag working correctly, and that all tags within it appear normally, without being ignored.

  3. rflfn
    Member
    Posted 9 months ago #

    I have not found the solution, I think someone must already have had this problem, does anyone could help?

    The problem is not in the theme, tested with others and still the same problem.

  4. khan24
    Member
    Posted 9 months ago #

    Thanks for your discuss, I have learned enough.

  5. rflfn
    Member
    Posted 9 months ago #

    Thanks for your discuss, I have learned enough.

    Sorry but... This is not a tutorial, this is a question for how to solve the problem with tag

    ...

Reply

You must log in to post.

About this Topic

Tags