2011-03-23 8 views
0

에 코멘트 양식의 제목을 변경하는 방법이있다 "로그인 (등록)해서 댓글을 씀 .."내 웹 사이트에서 드루팔

을 내가 메시지를 변경하려면 : "로그인 (등록)해서 댓글을 씀 (댓글은 검토 됨). "

스팸성 댓글을 게시하기 위해 스패머가 많이 생성되기 때문에. 모든 댓글이 검토되었습니다. 이 메시지를 올리면 스패밍이 불가능하고 스팸 발송자가 로그인을 생성하지 않는다는 정보가 제공됩니다.

+1

스팸은 일반적으로 자동화, 그것을 생성하는 봇이 같은 모든 메시지를 무시합니다. – bjudson

+0

봇이 등록되지 않고 인간이 아닌 것을 알지 못했습니다. 고마워 Captcha가 포함됩니다. – AgA

답변

2

Drupal 6을 사용 중이라고 가정하면 의견 양식을 작성하는 코드는 Drupal 모듈 디렉토리의 comments.module 파일에 있습니다. 다행히도,이 기능은 테마를 허용합니다.

할 수있는 일은 theme_comment_post_forbidden ($ node) 함수를 복사하여 붙여넣고 테마 디렉토리의 template.php 파일에 배치하는 것입니다. 또한 'theme'을 테마 이름으로 바꾸고 함수의 이름을 바꿔야합니다.

예를 들어, 테마 이름이 'utilitiesindia'라고 말하면됩니다. 그런 다음 함수의 이름을 utilitiesindia_comment_post_forbidden으로 바꿉니다. 드루팔 6에서

/** 
* Theme a "you can't post comments" notice. 
* 
* @param $node 
* The comment node. 
* @ingroup themeable 
*/ 
function utiltiesindia_comment_post_forbidden($node) { 
    global $user; 
    static $authenticated_post_comments; 

    if (!$user->uid) { 
    if (!isset($authenticated_post_comments)) { 
     // We only output any link if we are certain, that users get permission 
     // to post comments by logging in. We also locally cache this information. 
     $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval')); 
    } 

    if ($authenticated_post_comments) { 
     // We cannot use drupal_get_destination() because these links 
     // sometimes appear on /node and taxonomy listing pages. 
     if (variable_get('comment_form_location_'. $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { 
     $destination = 'destination='. rawurlencode("comment/reply/$node->nid#comment-form"); 
     } 
     else { 
     $destination = 'destination='. rawurlencode("node/$node->nid#comment-form"); 
     } 

     if (variable_get('user_register', 1)) { 
     // Users can register themselves. 
     return t('<a href="@login">Login</a> or <a href="@register">register</a> to post comments(comments will be moderated)', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))) 
); 
     } 
     else { 
     // Only admins can add new users, no public registration. 
     return t('<a href="@login">Login</a> to post comments', array('@login' => url('user/login', array('query' => $destination)))); 
     } 
    } 
    } 
} 
1

:

그래서, 테마라는 utilitiesindia에 template.php 파일에이 기능을 사용
또 다른 옵션은 작은 사용자 정의 모듈을 만드는 것입니다. 여기에는 hook_link_alter()이 사용됩니다. 이것은 "새로운 코멘트 게시에 대한 로그인"링크의 제목을 변경하는 작은 예제 모듈입니다 : (MYMODULE_NAME의 모든 인스턴스를 모듈에 대해 선택한 이름으로 바꿉니다)

1 단계 : MYMODULE_NAME.info라는 파일을 만듭니다 및 추가

; $Id$ 
name = "MYMODULE_NAME" 
description = "Change the appearance of links that appear on nodes" 
core = 6.x 

2 단계 : 파일이라고 MYMODULE_NAME.module을 만들고 추가

<?php 
    // $Id$; 

    /** 
    * Implementation of hook_link_alter 
    */ 
    function MYMODULE_NAME_link_alter(&$links, $node){ 
    if (!empty($links['comment_forbidden'])) { 
     // Set "Login to post new comment" link text 
     $links['comment_forbidden']['title'] = 'NEW TEXT'; 

     // Add this to allow HTML in the link text 
     $links['comment_forbidden']['html'] = TRUE; 
    } 
    } 

3 단계 : 사이트에서 폴더를 MYMODULE_NAME라는 폴더에이 파일을 넣고, 배치/모든/모듈 , 활성화 모듈

1

실제로 스팸 발송자가 계정을 만들지 않도록하려면 CAPTCHA 모듈과 같은 것을 사용해야합니다. 대개의 경우 지침을 무시하는 봇을 사용하기 때문입니다.

http://drupal.org/project/captcha

관련 문제