<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[케이보드 댓글 알림 관련 문의 드립니다.]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/39644</link>
		<description><![CDATA[<p>안녕하세요, 케이보드 댓글 알림 관련 문의 드립니다.</p>

<p>현재 코스모스팜 회원관리 플러그인을 사용하여 케이보드에 쓴 글에 댓글이 달렸을 시 이메일 알림이 가도록 설정했습니다.</p>

<p>그리고 현재 잘 되는 것으로 확인 됩니다. 다만 3 가지 궁금증이 있어 이렇게 글을 쓰게 되었습니다.</p>

<p> </p>

<p>1. 검색을 하다보니 케이보드 댓글 알림을 이메일로 보내기 위해서는 다음과 같은 코드를 삽입하라는 글을 보았습니다. 코드는 아래와 같습니다.</p>

<pre>
<code class="language-php">add_action('kboard_comments_insert', 'my_parent_comment_email_alert_20191212', 10, 3);
function my_parent_comment_email_alert_20191212($comment_uid, $content_uid, $board){
	$comment = new KBComment();
	$comment-&gt;initWithUID($comment_uid);
	$content = new KBContent();
	$content-&gt;initWithUID($content_uid);
	
	if($comment-&gt;parent_uid){
		$parent = new KBComment();
		$parent-&gt;initWithUID($comment-&gt;parent_uid);
		
		if($parent-&gt;user_uid){
			$user = new WP_User($parent-&gt;user_uid);
			
			if($user-&gt;user_email &amp;&amp; $user-&gt;ID != get_current_user_id()){
				if(!class_exists('KBMail')){
					include_once KBOARD_DIR_PATH . '/class/KBMail.class.php';
				}
				$url = new KBUrl();
				$mail = new KBMail();
				$mail-&gt;to = $user-&gt;user_email;
				$mail-&gt;title = "새로운 댓글이 등록 되었습니다.";
				$mail-&gt;content = $parent-&gt;content;
				$mail-&gt;url = $url-&gt;getDocumentRedirect($content-&gt;uid);
				$mail-&gt;url_name = '페이지로 이동하여 보기';
				$mail-&gt;send();
			}
		}
	}
}</code></pre>

<p> </p>

<p>저도 그래서 이 코드를 functions.php 파일에 삽입하였으나, 이 코드를 삭제하고 테스트를 해봐도 댓글 알림이 제대로 이메일로 발송되는 것을 알 수 있었습니다. 이 코드를 꼭 붙여야 할까요?</p>

<p> </p>

<p>2. 이메일 알림을 받기 위해서는 이메일 알림 페이지에서 &lt;이메일 알림받기&gt;를 체크해야만 합니다. 그런데 문제는 제 생각에 기본 값으로는 &lt;이메일 알림받기&gt; 값이 해제되어 있는 것 같습니다. 그래서 검색을 해본 결과 기본 값으로 &lt;이메일 알림 받기&gt;가 체크되어 있게 하기 위해서는 아래와 같은 코드가 삽입되어야한다는 것을 발견했습니다. 코드는 아래와 같습니다.</p>

<pre>
<code class="language-php">add_action('user_register', 'my_user_register', 10, 1);
function my_user_register($user_id){
	update_user_meta($user_id, 'cosmosfarm_members_notifications_subnotify_email', '1');
}</code></pre>

<p>이 코드를 삽입한 후, 새로 가입한 사람들의 경우 &lt;이메일 알림 받기&gt;가 자동으로  체크됨을 확인할 수 있었습니다. 문제는 기존에 가입한 분들입니다. 기존에 가입한 분들은 이 코드를 넣었음에도 불구하고 여전히 &lt;이메일 알림 받기&gt;가 자동으로 체크되지 않고 있습니다. 기존 가입자의 설정까지 제가 바꿀 수 있을까요? 제 생각에 그건 어려울 것 같지만 혹시 몰라 여쭤 봅니다.</p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[감사합니다. 모두 해결하였습니다. 연말 잘 보내시길 바랄게요!]]></title>
			<link>https://www.cosmosfarm.com/threads/document/39703</link>
			<description><![CDATA[<p>감사합니다. 모두 해결하였습니다. 연말 잘 보내시길 바랄게요!</p>]]></description>
			<author>yoois</author>
			<pubDate>Fri, 20 Dec 2019 06:00:39 +0000</pubDate>
			<category>KBoard</category>
		</item>
				<item>
			<title><![CDATA[안녕하세요~^^

1번의 코드가 없어도 동작한다면 코드를 사용하실 필요는 없습니다.

 

2번의 경우 아...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/39661</link>
			<description><![CDATA[<p>안녕하세요~^^</p>

<p>1번의 코드가 없어도 동작한다면 코드를 사용하실 필요는 없습니다.</p>

<p> </p>

<p>2번의 경우 아래 코드를 사용하시면 가입된 모든 회원 정보를 업데이트할 수 있습니다.</p>

<p>아래 코드를 테마의 functions.php 파일에 추가해주세요.</p>

<pre>
<code class="language-php">add_action('init', 'my_all_users_update_20191219');
function my_all_users_update_20191219(){
	$args = wp_parse_args(array());
	$args['count_total'] = false;
	
	$user_search = new WP_User_Query($args);
	$users = (array) $user_search-&gt;get_results();
	
	foreach($users as $user){
		update_user_meta($user-&gt;ID, 'cosmosfarm_members_notifications_subnotify_email', '1');
	}
}</code></pre>

<p>그런데 초기에 회원수가 별로 없을 때 한 번만 해주세요.</p>

<p>코드를 넣고 페이지를 새로고침 하시면 전체 회원에 적용됩니다.</p>

<p>적용 후 코드를 다시 삭제해주세요.</p>

<p> </p>

<p>3번의 경우 이전에 안내드린 코드를 그대로 재활용하실 수 있겠습니다.</p>

<p>아래 코드를 테마의 functions.php 파일에 추가해서 확인해보시겠어요?</p>

<pre>
<code class="language-php">add_filter('the_content', 'my_page_restriction_20191219', 99, 1);
function my_page_restriction_20191219($content){
	global $post;
	
	if($post &amp;&amp; $post-&gt;ID == '14586'){ // 실제 페이지 ID 값으로 변경
		if(!is_user_logged_in()){
			$page_restriction_message = '&lt;p&gt;이 페이지를 보기 위해서는 로그인이 필요합니다.&lt;/p&gt;';
			
			$_REQUEST['redirect_to'] = $_SERVER['REQUEST_URI'];
			$content = wpmem_inc_regmessage('page_restriction', $page_restriction_message) . wpmem_inc_login('page_restriction');
		}
	}
	
	return $content;
}</code></pre>

<p>고맙습니다.</p>]]></description>
			<author>스레드봇</author>
			<pubDate>Thu, 19 Dec 2019 03:16:14 +0000</pubDate>
			<category>KBoard</category>
		</item>
			</channel>
</rss>