Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 6 Drupal6:如何修改注释模块的显示_Drupal 6_Module_Comments_Hook - Fatal编程技术网

Drupal 6 Drupal6:如何修改注释模块的显示

Drupal 6 Drupal6:如何修改注释模块的显示,drupal-6,module,comments,hook,Drupal 6,Module,Comments,Hook,在发布评论之前,将显示一条消息: Login or register to post comments 我想修改2个链接“login”和“register”的输出,主要是我想在链接中添加一些类,用一些img对其进行良好的格式化。不同颜色的按钮 我真的需要“告诉”要放和的输出,默认情况下没有类 我知道这可以用钩子或其他什么东西来完成,但我找不到任何关于这方面的信息…负责这一行的文章位于drupal\u root/modules/comment/comment.module中的theme\u co

在发布评论之前,将显示一条消息:

Login or register to post comments
我想修改2个链接“login”和“register”的输出,主要是我想在链接中添加一些类,用一些img对其进行良好的格式化。不同颜色的按钮

我真的需要“告诉”要放和的输出,默认情况下没有类


我知道这可以用钩子或其他什么东西来完成,但我找不到任何关于这方面的信息…

负责这一行的文章位于drupal\u root/modules/comment/comment.module中的
theme\u comment\u post\u probled

看起来像这样

function theme_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', 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))));
      }
    }
  }
}
功能主题\u评论\u帖子\u禁止($node){
全球$用户;
静态$authenticated_post_注释;
如果(!$user->uid){
如果(!isset($authenticated\u post\u comments)){
//我们只输出任何链接,如果我们确定,用户得到许可
//通过登录发布评论。我们也在本地缓存此信息。
$authenticated_post_comments=array_key_exists(DRUPAL_authenticated_RID,用户角色(TRUE,'post comments')+用户角色(TRUE,'post comments without approval');
}
如果($authenticated\u post\u comments){
//我们不能使用drupal\u get\u destination(),因为这些链接
//有时出现在/节点和分类列表页面上。
if(变量_get('comment_form_location_'.$node->type,comment_form_SEPARATE_PAGE)=comment_form_SEPARATE_PAGE){
$destination='destination='.rawurlencode(“注释/回复/$node->nid#comment表单”);
}
否则{
$destination='destination='.rawurlencode(“node/$node->nid#comment form”);
}
if(变量_get('user_register',1)){
//用户可以自己注册。
返回t('or to post comments',array('@login'=>url('user/login',array('query'=>$destination)),'@register'=>url('user/register',array('query'=>$destination));
}
否则{
//只有管理员才能添加新用户,无需公开注册。
返回t('to post comments',array('@login'=>url('user/login',array('query'=>$destination));
}
}
}
}
我建议修改主题的template.php,并添加一个新函数
phptemplate\u comment\u post\u probled($node)
,在该函数中复制
theme\u comment\u post\u comments
的内容并进行必要的修改