Support » Plugins » [Plugin: Safe Report Comments] Help for PHP noob: How i do manual link?

  • In case this does not work out you can place the flagging link manually by defining no_autostart_safe_report_comments in your themes’ functions.php file and initializing the class via $safe_report_comments = new Safe_Report_Comments(false);

    This text is nothing to me. So i want code to functions.php and comments.php, how i do this Report link manually?

Viewing 13 replies - 1 through 13 (of 13 total)
  • 1) Deactivate the plugin
    2) Add the following lines to your themes’ functions.php file

    define( 'no_autostart_safe_report_comments', true );
    require_once( ABSPATH . '/wp-content/plugins/safe-report-comments/safe-report-comments.php' );
    $safe_report_comments = new Safe_Report_Comments(false);

    3) at the place where you would like to add the report link place the following code
    echo $safe_report_comments->get_flagging_link( $comment_id='', $result_id='', $text='Report comment' );
    Make sure to replace the parameters with the desired values. result_id is the css id of the entity in which the ajax result should be displayed. $text is the link text.

    Please let me know if this makes any sense and works for you.


    Fatal error: Call to a member function get_flagging_link() on a non-object in /home/hpguru/public_html/wp-content/themes/revolution-code-blue/comments.php on line 43

    can you paste the related parts of the comments.php and the functions.php?


    if ( function_exists('register_sidebars') )
    <?php //Begin Theme Options Code
    $themename = "Revolution Code Blue";
    $shortname = "cb";
    $options = array (
    	array(	"name" => "Color Scheme",
    			"id" => $shortname."_color_scheme",
    			"std" => "Default",
    			"type" => "select",
                "options" => array("Blue","Gray","Red"))
    function myFilter($query) {
        if ($query->is_feed) {
            $query->set('cat','-1323'); //Don't forget to change the category ID =^o^=
    return $query;
    function my_akismet_count() {
    $akismetcount = number_format_i18n(get_option('akismet_spam_count'));
    echo "<a href=''>Akismet</a> on suojannut blogia " . $akismetcount . " roskakommentilta";
    define( 'no_autostart_safe_report_comments', true );
    require_once( ABSPATH . '/wp-content/plugins/safe-report-comments/safe-report-comments.php' );
    $safe_report_comments = new Safe_Report_Comments(false);
      function make_chunky($ret)
    blah blah...


    <?php foreach ($comments as $comment) : ?>
    <?php $comment_type = get_comment_type(); ?>
    <?php if($comment_type == 'comment') { ?>
    		<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    			<?php comment_author_link() ?> sanoi <?php comment_date('d.m.Y k\l\o\ H:i') ?> <?php edit_comment_link('(Muokkaa)','',''); ?><br />
    			<?php if ($comment->comment_approved == '0') : ?>
    			<em>Kommenttisi on moderoitavana.</em>
    			<?php endif; ?>
    	<div class="commenttext">
    		<?php comment_text() ?>
    <?php echo $safe_report_comments->get_flagging_link( $comment_id='', $result_id='', $text='Report comment' ); ?>
    	<div style="border-bottom: margin-bottom:20px; padding:0px 0px 10px 0px; clear:both;"></div>
    <?php } else { $trackback = true; } /* End of is_comment statement */ ?>
    	<?php endforeach; /* end for each comment */ ?>
    <?php if ($trackback == true) { ?>
    <?php foreach ($comments as $comment) : ?>
    <?php $comment_type = get_comment_type(); ?>
    <?php if($comment_type != 'comment') { ?>
    <li><?php comment_author_link() ?></li>
    <?php } ?>
    <?php endforeach; ?>
    <br class="clear" />
    <br class="clear" />
    <?php } ?>

    First thing: could you verify that the path to the plugin file matches your environment in the require statement require_once( ABSPATH . ‘/wp-content/plugins/safe-report-comments/safe-report-comments.php’ );
    Second: make sure that neither call $safe_report_comments = new Safe_Report_Comments(false); nor echo $safe_report_comments->get_flagging_link() are called within a function. If they are called from within a function make sure to add a global $safe_report_comments; statement before working with the $safe_report_comments variable.

    Path is ok.

    Is functions.php code ok?

    define( 'no_autostart_safe_report_comments', true );
    require_once( ABSPATH . '/wp-content/plugins/safe-report-comments/safe-report-comments.php' );
    $safe_report_comments = new Safe_Report_Comments(false);

    Is this code ok? I try it, but same error…

    <?php $safe_report_comments->get_flagging_link( $comment_id='', $result_id='', $text='Report comment' ); ?>

    Thank you. I’m very noob with PHP.

    You deactivated the plugin, right?
    Also try to use this in your comments.php file. Maybe your theme is using a callback function to generate the comments.
    <?php global $safe_report_comments; echo $safe_report_comments->get_flagging_link( $comment_id='', $result_id='', $text='Report comment' ); ?>

    Good luck

    Plugin is de-activated. I try your code now. Thank you.


    Wrong usage of print_flagging_link().

    You need to provide the $comment_id parameter when you are not using the get_flagging_link() function within the comment loop.

    Now i see report comments but when i try it, nothing happens.

    can I contact you via mail/skype?

    Yes. jyri.vaatainen(att)hpguru(dot)net

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: Safe Report Comments] Help for PHP noob: How i do manual link?’ is closed to new replies.