<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[한아이디로 글작성시, 멤버uid만 변경이 되질 않습니다ㅠㅠ]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/47246</link>
		<description><![CDATA[<pre>
<code class="language-html">add_action('kboard_skin_field_after_title', 'my_kboard_skin_field_after_title2', 10 , 3);
		function my_kboard_skin_field_after_title2($field, $content, $board){
			if(current_user_can('administrator')){ 
				?&gt;
				&lt;div class="kboard-attr-row"&gt;
					&lt;label class="attr-name" for="kboard-input-author"&gt;&lt;?php echo __('Author', 'kboard')?&gt;&lt;/label&gt;
					&lt;div class="attr-value"&gt;
						&lt;input type="text" id="kboard-input-author" name="member_display" value="&lt;?php
						if($content-&gt;member_display){echo $content-&gt;member_display;}else{
							$a=wp_get_current_user();
							$usersid=$a-&gt;display_name;
				echo $usersid;}?&gt;"&gt;
					&lt;/div&gt;
				&lt;/div&gt;

				&lt;div class="kboard-attr-row"&gt;
					&lt;label class="attr-name" for="kboard-input-author"&gt;&lt;?php echo __('Author', 'kboard')?&gt;&lt;/label&gt;
					&lt;div class="attr-value"&gt;
						&lt;input type="text" id="kboard-input-author" name="member_uid" value="&lt;?php
						if($content-&gt;member_uid){echo $content-&gt;member_uid;}else{
							$a=wp_get_current_user();
							$usersid2=$a-&gt;ID;
				echo $usersid2;}?&gt;"&gt;
					&lt;/div&gt;
				&lt;/div&gt;

				&lt;div class="kboard-attr-row"&gt;
					&lt;label class="attr-name"&gt;날짜&lt;/label&gt;
					&lt;div class="attr-value"&gt;&lt;input type="text" name="date" value="&lt;?php date_default_timezone_set("Asia/Seoul");
					if($content-&gt;date){echo $content-&gt;date;}else{echo date("YmdHis");}?&gt;"&gt;&lt;/div&gt;
				&lt;/div&gt;
				&lt;?php
			}
		}</code></pre>

<p>1.위 코드는 한아이디로 관리자라면, 닉네임,날짜등을 다르게 해서 글을 쓸수있게 하는것입니다.</p>

<p>근데 디비에서 확인해보니, member_uid만 변경이 안되고 있었드라구요ㅠㅠ</p>

<p>혹시 글쓸때 member_uid도 글을쓸때, 임의로 써서, 변경이 되려면 어떻게해야할까요?</p>

<p>예를들어 1번 아이디가 13을 입력하고 글을써도, member_uid는 1이 됩니다ㅠ</p>

<p>(닉네임과 날짜는 잘 바껴요ㅠ)</p>

<p> </p>

<pre>
<code class="language-html">function my_kboard_comments_field($field_html, $board, $content_uid, $comment_builder){
				if(current_user_can('administrator')){
				?&gt;
				&lt;div class="comments-field"&gt;
					&lt;label class="comments-field-label" for="comment_member_display"&gt;&lt;?php echo __('Author', 'kboard-comments')?&gt;&lt;/label&gt;
					&lt;input type="text" id="comment_member_display" name="member_display" value="&lt;?php
					if($temporary-&gt;member_display){echo $temporary-&gt;member_display;}else{
						$a=wp_get_current_user();
						$usersid=$a-&gt;display_name;
			echo $usersid;}?&gt;" placeholder="&lt;?php echo __('Author', 'kboard-comments')?&gt;..." required&gt;
				&lt;/div&gt;

				&lt;div class="comments-field"&gt;
					&lt;label class="comments-field-label" for="comment_member_uid"&gt;&lt;?php echo __('사용자UID', 'kboard-comments')?&gt;&lt;/label&gt;
					&lt;input type="text" id="comment_member_uid" name="member_uid" value="&lt;?php
					if($temporary-&gt;member_uid){echo $temporary-&gt;member_uid;}else{
						$a=wp_get_current_user();
						$usersid3=$a-&gt;ID;
			echo $usersid3;}?&gt;" placeholder="&lt;?php echo __('사용자UID', 'kboard-comments')?&gt;..." required&gt;
				&lt;/div&gt;

				&lt;div class="comments-field"&gt;
					&lt;label class="comments-field-label" for="comment_date"&gt;&lt;?php echo __('작성일', 'kboard-comments')?&gt;&lt;/label&gt;
					&lt;input type="text" id="comment_date" name="date" value="&lt;?php date_default_timezone_set("Asia/Seoul");
					if($comment-&gt;created){echo $comment-&gt;created;}else{echo date("YmdHis");}?&gt;" placeholder="&lt;?php echo __('date', 'kboard-comments')?&gt;..." required&gt;
				&lt;/div&gt;
			&lt;?php }?&gt;
				&lt;div class="comments-field field-image1"&gt;
					&lt;label class="comments-field-label" for="comment_image1_&lt;?php echo $content_uid?&gt;"&gt;사진&lt;/label&gt;
					&lt;input type="file" id="comment_image1_&lt;?php echo $content_uid?&gt;" name="comment_attach_image1" accept="image/*"&gt;
				&lt;/div&gt;
				&lt;div class="comments-field field-file1"&gt;
					&lt;label class="comments-field-label" for="comment_file1_&lt;?php echo $content_uid?&gt;"&gt;첨부파일&lt;/label&gt;
					&lt;input type="file" id="comment_file1_&lt;?php echo $content_uid?&gt;" name="comment_attach_file1"&gt;
				&lt;/div&gt;
				&lt;?php
			}</code></pre>

<p>2.위 코드는 댓글쪽입니다. 댓글을쓸때 관리자는 닉네임,날짜,member_uid를 변경할수있게 하였습니다.</p>

<p>디비를 확인해보니 user_uid라서 name값을 user_uid라고 변경해서도 해봤지만, 역시 댓글도 member_uid가 변경이 되질 않습니다ㅠㅠ</p>

<p>댓글쓸때 닉네임,날짜 그리고 멤버uid까지 변경해서 작성하려면 어떻게해야할까요?ㅠ</p>

<p>(댓글도 글과 마찬가지로, 닉네임과 날짜는 잘 변경되고, 멤버uid만 변경이 안됩니다ㅠ)</p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[안녕하세요~^^

KBoard 플러그인에서 작성자 uid는 자동으로 현재의 사용자 uid를 입력하고 있습니다.

...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/47260</link>
			<description><![CDATA[<p>안녕하세요~^^</p>

<p>KBoard 플러그인에서 작성자 uid는 자동으로 현재의 사용자 uid를 입력하고 있습니다.</p>

<p>만약, 별도의 입력 필드에 입력한 값으로 적용되게 하시려면</p>

<p>아래의 코드를 활용해보세요.</p>

<pre>
<code class="language-php">add_action('kboard_pre_document_insert', 'kboard_pre_document_insert_20201019', 10, 4);
function kboard_pre_document_insert_20201019($uid, $board_id, $content, $board){
	if($board-&gt;isAdmin() &amp;&amp; $board-&gt;id == '1'){ // 실제 게시판 id로 적용해주세요.
		$member_uid = isset($_POST['member_uid']) ? $_POST['member_uid'] : '';
		if($member_uid){
			$content-&gt;member_uid = $member_uid;
		}
	}
}</code></pre>

<p>위의 코드에서 $board-&gt;id == '1' 부분은 실제 게시판 id로 적용해보세요.</p>

<p>$board-&gt;isAdmin() 코드를 활용하시면 관리자인지 체크하실 수 있습니다.</p>

<p> </p>

<p>댓글 쪽에 $temporary 변수와 $comment 변수는 별도로 선언하신 건지요?</p>

<p>댓글 쪽은 아래의 코드를 추가해서 활용해보시겠어요?</p>

<pre>
<code class="language-php">add_filter('kboard_comments_insert_data', 'kboard_comments_insert_data_20201019', 10, 2);
function kboard_comments_insert_data_20201019($data, $board_id){
	$board = new KBoard($board_id);
	if($board-&gt;isAdmin() &amp;&amp; $board-&gt;id == '1'){ // 실제 게시판 id로 적용해주세요.
		$member_uid = isset($_POST['member_uid']) ? $_POST['member_uid'] : '';
		if($member_uid){
			$data['user_uid'] = $member_uid;
		}
	}
	return $data;
}</code></pre>

<p>위의 코드에서 $board-&gt;id == '1' 부분은 실제 게시판 id로 적용해보세요.</p>

<p>테마의 functions.php 파일에 코드를 추가하거나 <a href="https://ko.wordpress.org/plugins/code-snippets/" target="_blank">Code Snippets</a> 플러그인을 사용해서 코드를 추가할 수 있습니다.</p>

<p>고맙습니다.</p>]]></description>
			<author>스레드봇</author>
			<pubDate>Mon, 19 Oct 2020 02:24:50 +0000</pubDate>
			<category>KBoard</category>
		</item>
			</channel>
</rss>