• 27-08-2020, 11:55:51
    #10
    Kimlik doğrulama veya yönetimden onay bekliyor.
    @Scorpion2763; çok teşekkür ederim.
    @EvilBozkurt; , @ustunweb; web evet bu konuda haklısınız teşekkür ederim. Buna yönelik bildiğiniz bir eklenti veya pratik başka bir yol bulunuyor mu ?
    Bu kod ile ad ve soyadı direkt olarak gizlesem de söylediğim şekilde tasarlayamadım. Doğrusu PHP'de pek bilgim yok. Ad ve Soyad'ın ilk harfini alıp, devamına ** eklemeliyim.

    add_filter ('get_comment_author', 'my_comment_author', 10, 1);
    function my_comment_author ($ author = '') {
    // Get the comment ID from WP_Query
    $ comment = get_comment ($ comment_ID);
    if (! empty ($ comment-> comment_author)) {
    if ($ comment-> user_id> 0) (
    $ user = get_userdata ($ comment-> user_id);
    $ author = $ user-> first_name. ' '.substr ($ user-> last_name, 0,1).'. '; // this is the actual line you want to change
    } else {
    $ author = __ ('Anonymous');
    }
    } else {
    $ author = $ comment-> comment_author;
    }
     return $ author;
  • 27-08-2020, 12:08:08
    #11
    SoftwareR10 adlı üyeden alıntı: mesajı görüntüle
    @Scorpion2763; çok teşekkür ederim.
    @EvilBozkurt; , @ustunweb; web evet bu konuda haklısınız teşekkür ederim. Buna yönelik bildiğiniz bir eklenti veya pratik başka bir yol bulunuyor mu ?
    Bu kod ile ad ve soyadı direkt olarak gizlesem de söylediğim şekilde tasarlayamadım. Doğrusu PHP'de pek bilgim yok. Ad ve Soyad'ın ilk harfini alıp, devamına ** eklemeliyim.

    add_filter ('get_comment_author', 'my_comment_author', 10, 1);
    function my_comment_author ($ author = '') {
    // Get the comment ID from WP_Query
    $ comment = get_comment ($ comment_ID);
    if (! empty ($ comment-> comment_author)) {
    if ($ comment-> user_id> 0) (
    $ user = get_userdata ($ comment-> user_id);
    $ author = $ user-> first_name. ' '.substr ($ user-> last_name, 0,1).'. '; // this is the actual line you want to change
    } else {
    $ author = __ ('Anonymous');
    }
    } else {
    $ author = $ comment-> comment_author;
    }
    return $ author;

    $author = mb_substr($user->first_name, 0, 1, 'UTF-8').'***'.' '.mb_substr($user->last_name, 0, 1, 'UTF-8');
  • 27-08-2020, 12:09:17
    #12
    Üyeliği durduruldu
    add_filter ('get_comment_author', 'my_comment_author', 10, 1);
    function my_comment_author ($author = '') {
    $comment = get_comment ($ comment_ID);
    if(! empty ($ comment-> comment_author)) {
    if($ comment->user_id> 0) (
    $user = get_userdata ($comment-> user_id);
    $first_name = substr($user->first_name, 0, 1).str_repeat('*', strlen($user->first_name)-1);
    $last_name = substr($user->last_name, 0, 1).str_repeat('*', strlen($user->last_name)-1);
    $author = $first_name + ' ' + $last_name;
    } else {
    $author = __ ('Anonymous');
    }
    } else {
    $author = $comment-> comment_author;
    }
    return $author;
    }
    Şöyle deneyin, test edenemedim ama çalışması lazım.
  • 27-08-2020, 12:14:03
    #13
    @Scorpion2763;
    @awoken;
    teşekkür ederim
  • 27-08-2020, 12:24:24
    #14
    awoken adlı üyeden alıntı: mesajı görüntüle
    add_filter ('get_comment_author', 'my_comment_author', 10, 1);
    function my_comment_author ($author = '') {
    $comment = get_comment ($ comment_ID);
    if(! empty ($ comment-> comment_author)) {
    if($ comment->user_id> 0) (
    $user = get_userdata ($comment-> user_id);
    $first_name = substr($user->first_name, 0, 1).str_repeat('*', strlen($user->first_name)-1);
    $last_name = substr($user->last_name, 0, 1).str_repeat('*', strlen($user->last_name)-1);
    $author = $first_name + ' ' + $last_name;
    } else {
    $author = __ ('Anonymous');
    }
    } else {
    $author = $comment-> comment_author;
    }
    return $author;
    }
    Şöyle deneyin, test edenemedim ama çalışması lazım.
    Şu şekilde bir hata alıyorum:
    PHP kod değişiklikleriniz wp-content/themes/martfury/functions.php dosyasındaki satır 95 yüzünden geri alındı. Lütfen düzeltin ve tekrar kaydetmeyi deneyin.
    syntax error, unexpected 'comment_ID' (T_STRING), expecting variable (T_VARIABLE) or '{' or '$'95. satır:
    $comment = get_comment ($ comment_ID);
    @Scorpion2763;
    Kodu aşağıdaki şekilde esas tema içerisindeki "functions.php" dosyasına ekledim. Ancak sadece isimden sonra nokta koydu.
    Örneğin Mahmut Tan adında;
    Mahmut T.
    add_filter('get_comment_author', 'my_comment_author', 10, 1);
    function my_comment_author( $author = '' ) {
    // Get the comment ID from WP_Query
    $comment = get_comment( $comment_ID );
    if (!empty($comment->comment_author) ) {
    if($comment->user_id > 0){
    $user=get_userdata($comment->user_id);
    $author=$user->first_name.' '.substr($user->last_name,0,1).'.'; // this is the actual line you want to change
    } else {
    $author = mb_substr($user->first_name, 0, 1, 'UTF-8').'***'.' '.mb_substr($user->last_name, 0, 1, 'UTF-8');
    }
    } else {
    $author = $comment->comment_author;
    }
    
    return $author;
    }
  • 27-08-2020, 12:41:24
    #15
    $author = mb_substr($user->first_name, 0, 1, 'UTF-8').'***'.' '.mb_substr($user->last_name, 0, 1, 'UTF-8').'***';