Home php教程 php手册 允许老用户发表纯英文评论

允许老用户发表纯英文评论

Jun 06, 2016 pm 08:09 PM
people w publish English Comment

Allow people who have commets approved to submit a non-Chinese comment. No miscarriage of justice any more. 允许"曾在本站发表过评论且通过了审核"的用户发表纯英文评论 , 妈妈再也不用担心我的误判. 灵感来自于wordpress默认讨论选项中的"评论者先前

Allow people who have commets approved to submit a non-Chinese comment.
No miscarriage of justice any more.
允许"曾在本站发表过评论且通过了审核"的用户发表纯英文评论, 妈妈再也不用担心我的误判.

灵感来自于wordpress默认讨论选项中的"评论者先前须有评论通过了审核"这一项, 我在wp-includes/comments.php中找到了相关动作, 此动作在get_option('comment_whitelist')后触发, 我觉得可以用在纯英文评论上

以上是废话, 以下代码扔到functions.php

   /**
    * allow old users to submit english comments
    * coder: xiaohudie
    * 2013-05-20
    */
function butterfly_en($comment) {
	$pattern = '/[一-龥]/u';  
	$cau=$comment['comment_author'] ;
	$cem=$comment['comment_author_email'] ; 
	global $wpdb;
	$ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$cau' AND comment_author_email = '$cem' and comment_approved = '1' LIMIT 1");
	if( is_user_logged_in() || 1 == $ok_to_comment ){ return $comment; } 
	elseif ( !preg_match_all($pattern, $ccontent, $match) ) {
		exit('sorry, please type some Chinese words like 小蝴蝶最漂亮 in your comment to pass the spam-check.');
	} 
} 
add_filter('preprocess_comment', 'butterfly_en'); 
Copy after login

大家可以尽情测试, 测试方法(前提你之前在小蝴蝶评论过):
你可以成功的提交一条纯英文评论了, 不会英文的同学可以复制这一句: smallbutterfly is very beautiful
然后你可以改一下你的昵称, 然后再发一条纯英文评论试试

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Why is the latest comment on Xiaohongshu at the bottom? How does Xiaohongshu make its comments number one? Why is the latest comment on Xiaohongshu at the bottom? How does Xiaohongshu make its comments number one? Mar 21, 2024 pm 06:21 PM

As a popular social e-commerce platform, Xiaohongshu’s user comments are an important interactive link. Many users find that on Xiaohongshu, the latest comments often appear at the bottom of the comment area. Why is this? This article will delve into the sorting mechanism of Xiaohongshu’s comment area and share some tips for ranking comments at the front. 1. Why are the latest comments on Xiaohongshu at the bottom? The default sorting method of the Xiaohongshu comment area is to display comments in chronological order, that is, the latest comments will be displayed at the bottom of the comment area. This sorting method helps users easily view the latest comments and obtain real-time information. Xiaohongshu encourages interaction between users and encourages users to actively participate in comments by placing the latest comments at the bottom of the page. This design allows users to browse other users’ comments,

How do I delete my comments on TikTok? How can others find out my comments on TikTok? How do I delete my comments on TikTok? How can others find out my comments on TikTok? Mar 21, 2024 pm 10:41 PM

People enjoy posting videos, browsing videos, commenting and interacting on Douyin. But in the comment interaction, sometimes we may make some inappropriate remarks or make mistakes and want to delete these comments. So how to delete my own comments on Douyin? 1. How to delete my comments on Douyin? 1. Log in to Douyin App and find the video with the comment you want to delete. 2. At the bottom of the video page, find a list of all comments. 3. Find your comment, click the heart icon (like) on the right side of the comment, then click the delete icon (trash can) to confirm deletion. 4. If you @ other people in the comment, you will receive a prompt when deleting the comment: "After deleting this comment, the person @ will not receive the notification." If you want the person @ to receive the notification, you can Cancel @ first,

Why is Xiaohongshu's own comment at the bottom? How to modify a comment on Xiaohongshu? Why is Xiaohongshu's own comment at the bottom? How to modify a comment on Xiaohongshu? Mar 21, 2024 pm 10:46 PM

Xiaohongshu is a popular social e-commerce platform where users can share shopping tips, recommend products and exchange shopping experiences. Some users found that comments they posted on Xiaohongshu were always displayed at the bottom, which confused them. This article will explore why Xiaohongshu’s comments arrangement causes user comments to appear at the bottom, and introduce how to modify the position of comments on Xiaohongshu. 1. Why are Xiaohongshu’s own comments at the bottom? The display order of comments on Xiaohongshu is usually based on the chronological order of the comments. If your comment is posted after another user has commented, it will appear at the bottom. This is Xiaohongshu’s default comment sorting method, which is designed to maintain order and clarity in the comment area. Xiaohongshu may based on the content of the comments

Why can't others see my comments on Xiaohongshu? Why can't others see its comments? Why can't others see my comments on Xiaohongshu? Why can't others see its comments? Mar 21, 2024 pm 07:51 PM

Xiaohongshu is a popular social media platform where users can share their lives and exchange experiences. Some users will find that when they comment on other people's posts, they cannot see it. So, why can’t others see my comments on Xiaohongshu? This article will explore this issue in detail to help you resolve your confusion. 1. Why can’t others see my comments on Xiaohongshu? Delayed review: Xiaohongshu review content has been reviewed and may be temporarily hidden due to containing sensitive words or illegal content. In this case, the other party may not be able to see the comment temporarily after it is posted. Generally, these comments will reappear once moderation is complete. Account anomalies may cause comments posted by commenters not to be seen by the other party, even if the comments are successfully posted. Such abnormal situations include accounts being banned or functions limited.

Why can't pictures be displayed in Xiaohongshu comments? Why is the Xiaohongshu IP address not updated? Why can't pictures be displayed in Xiaohongshu comments? Why is the Xiaohongshu IP address not updated? Mar 21, 2024 pm 09:00 PM

Xiaohongshu is a popular social e-commerce platform where users can share their shopping experiences and recommend products. Some users reported that they were troubled by the fact that the images they uploaded in their comments were not displayed properly. This article will help you find out why images in Xiaohongshu comments cannot be displayed and provide solutions. 1. Why can’t pictures be displayed in Xiaohongshu comments? Image formats may not be supported: Xiaohongshu’s comment function only supports limited image formats. If the image format you upload is not supported, the image may not be displayed. It is recommended that you try other formats, such as JPG, PNG, etc. The size of images uploaded in comments may be limited by Xiaohongshu. If the size of your image is too large, it may not be displayed properly. It is recommended that you try pressing

How to pin comments to the top of Xiaohongshu on the computer? Where are the private messages on the computer? How to pin comments to the top of Xiaohongshu on the computer? Where are the private messages on the computer? Mar 28, 2024 pm 12:36 PM

On Xiaohongshu, users can browse a variety of beauty, fashion, travel and other content, while also expressing their own opinions and comments. Some users encountered the problem of how to pin comments when using the Xiaohongshu computer version. 1. How to pin comments to the top of Xiaohongshu on the computer? 1. Open the computer version of Xiaohongshu and enter the post or update you want to comment on. 2. In the comment area, find the comment you want to pin. 3. Click on the comment and you will see a "Pin" button. 4. Click the "Pin" button, and the comment will appear at the top of the comment area and become a pinned comment. It should be noted that the Xiaohongshu computer version currently only supports pinning your own comments, and the pinning function is only valid in the comment area of ​​posts or updates, and cannot be pinned on topic pages or global comment areas. two,

Will I be reminded if my Xiaohongshu comment is deleted by the blogger? What should I do if my comments in Xiaohongshu are deleted? Will I be reminded if my Xiaohongshu comment is deleted by the blogger? What should I do if my comments in Xiaohongshu are deleted? Mar 28, 2024 am 11:46 AM

Xiaohongshu is a content-rich and interactive social platform where users can post and comment on various contents. Sometimes we may encounter situations where our comments are deleted by bloggers. So, will the blogger be reminded if a Xiaohongshu comment is deleted? What should we do if it is deleted? 1. Will the blogger be reminded if a Xiaohongshu comment is deleted? After a Xiaohongshu comment is deleted by the blogger, the system will provide a notification to the user. Users can check the notification in Xiaohongshu’s message center to learn why their comments were deleted. Users can also find their deleted comments in the comment record on their personal homepage and view the relevant situation. 2. What should I do if my comments in Xiaohongshu are deleted? 1. Stay calm: First of all, we need to stay calm and don’t panic or get angry. Bo

How to delete historical comments on Xiaohongshu? Why is it that the comment is successful but cannot be seen? How to delete historical comments on Xiaohongshu? Why is it that the comment is successful but cannot be seen? Mar 21, 2024 pm 10:07 PM

In the current digital age, Xiaohongshu has become the main platform for many people to share their lives and obtain information. Sometimes, we may need to delete historical comments on Xiaohongshu, or encounter a situation where the comments are successful but cannot be seen. This article will focus on these two issues, providing detailed operation methods and possible causes. 1. How to delete historical comments on Xiaohongshu? To delete historical comments on Xiaohongshu, you can usually follow the following steps: 1. Find the comments: In the Xiaohongshu APP, find the comments you posted. Comments usually appear below the note or in the comments section. 2. Long press on a comment: Use your finger to long press on your comment until the delete option appears. 3. Confirm deletion: In the pop-up deletion confirmation dialog box, click the "OK" or "Delete" button to delete

See all articles