Yes - fresh out of the egg and haven't clue about PHP until it came up and bit me in the a*s! 🙂

My code is this:

<?php
	{if ( function_exists('register_sidebar') )
	register_sidebar();
//remove html tag when saving comments
function preprocess_comment_striptags($commentdata) {
    $commentdata['comment_content'] = strip_tags($commentdata['comment_content']);
    return $commentdata;
}
add_filter('preprocess_comment', 'preprocess_comment_striptags');

// remove html tag when showing comments
function comment_text_striptags($string) {
    return strip_tags($string);
}
add_filter('comment_text', 'comment_text_striptags');
if(!function_exists('get_sidebars')) 
	function get_sidebars(); }?>

My error message is this:

Parse error: syntax error, unexpected T_FUNCTION in /home/XXXXXX/XXXXXX.com/wp-content/themes/XXXXXX/functions.php on line 17

It's a Wordpress theme on a Wordpress blog - that has gone awry for some strange reason.

I know, (I think?!), it's only about "closing tags" etc - but I haven't been able to resolve it yet.

Please help! I am at your mercy! 🙂

p.s. thanks in advance - Paul

    Welcome to PHPBuilder!

    Your problem is here:

    if(!function_exists('get_sidebars')) 
        function get_sidebars();

    The 'function' keyword doesn't make much sense there; perhaps you were simply trying to call the get_sidebars() function instead?

      Thanks Brad! 🙂

      You may well be right. But as I haven't a clue about this - what do you suggest I do, (I mean how should I amend the coding), to resolve the error message?

      Thanks again.

      Paul

        should be

        
        if(function_exists('side_bar')
        {
           register_sidebar();
        }
        

        and as brad suggested this

        
        if(!function_exists('get_sidebars'))
        {
             function get_sidebars(); 
        }
        

          Thanks for that JG. 🙂

          I'll give this a go later on and get back to you.

          Paul

            Hello everyone! 🙂
            Thanks for your continued help and support! I now have this:

            <?php

            if ( function_exists('register_sidebar') )
            register_sidebar();

            //remove html tag when saving comments
            function preprocess_comment_striptags($commentdata) {
            $commentdata['comment_content'] = strip_tags($commentdata['comment_content']);
            return $commentdata;
            }

            add_filter('preprocess_comment', 'preprocess_comment_striptags');

            // remove html tag when showing comments
            function comment_text_striptags($string) {
            return strip_tags($string);
            }

            add_filter('comment_text', 'comment_text_striptags');
            if(!function_exists('get_sidebars')) {
            {
            function get_sidebars();
            }
            ?>

            And the error message I get is this:

            Parse error: syntax error, unexpected ';', expecting '{' in /home/XXXX/XXXX.com/wp-content/themes/XXXX/functions.php on line 21

            Again - any help would be greatly appreciated as I'm sure I'm so close to cracking this!

            Paul

            To be honest, the whole file was hacked and looks like the mess it is below, and all I wanted to do was to get it back to it's original state:

            <?php
            eval(base64_decode('aWYgKCFlbXB......7IH0gfQ=='));
            if ( function_exists('register_sidebar') )
            register_sidebar();
            eval(base64_decode('ZnVuY3Rpb24g......yKCk7'));
            //remove html tag when saving comments
            function preprocess_comment_striptags($commentdata) {
            $commentdata['comment_content'] = strip_tags($commentdata['comment_content']);
            return $commentdata;
            }
            eval(base64_decode('ZnVuY3Rpb24......gfSB9'));
            add_filter('preprocess_comment', 'preprocess_comment_striptags');

            eval(base64_decode('ZnVuY3Rpb2......SB9'));
            // remove html tag when showing comments
            function comment_text_striptags($string) {
            return strip_tags($string);
            }
            eval(base64_decode('ZnVuY3Rpb24.......H0gfQ=='));
            add_filter('comment_text', 'comment_text_striptags');
            if(!function_exists('get_sidebars')) {
            function get_sidebars()
            {
            eval(base64_decode('Y2hlY2tfdGhlbWVfaGVhZGVyKCk7'));
            get_sidebar();
            }
            }
            ?>

            All I've been trying to do is to strip out the malicious coding,(in red). If that helps to see what I've been trying to do - the I hope a knight, (or knightess? 🙂 ) in shining armour will swing by here and "put me right" on what the correct coding should be.

            And a sincere thanks to all concerned here. I know it must be a pain for people like myself dropping in out of nowhere and shouting "HELP!" - but you are the experts here, and I appreciate the time and effort you make on the forum helping folks like me.

              Thanks for all your help here people 🙂

              I have the situation resolved.

              Regards

              Paul

                Write a Reply...