Quick plugin help

Discussion in 'PHP' started by aaron_nimocks, Apr 3, 2008.

  1. #1
    Im trying to edit this Hidethis plugin but Im gettng stuck. Fromt he code you see below basically anything within the <!--hidethis-->OMG HIDDEN<!--/hidethis--> is not going to show up on wordpress blogs unless they are registered.

    Now I want to place some text and html where this was stripped before and I cant get it to work. Basically adding something like "text was removed because your stupid" in exchange for what was in between the hidethis tags. Any help appreciated.

    only thing I can think of but didnt get it to work is something like..

    
    $new = "content removed";
    return $pre.$new.$suf;
    
    PHP:
    
    add_filter('the_content', 'hide_some_content');
    
    function hide_some_content($content) {
    global $current_user, $user_ID;
    
    if (($current_user->id == 0) && ($user_ID == 0)){
    
        $b = strpos($content, '<!--hidethis-->');
        $e = strpos($content, '<!--/hidethis-->');
    
        $pre = substr($content,0,$b);
        $suf .= substr($content,$e,strlen($content));
    
        return $pre.$suf;
    
    } else { return $content; }
    
    }
    
    
    PHP:
     
    aaron_nimocks, Apr 3, 2008 IP