<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[myCRED 숏코드 [mycred_rank_progress] 오류]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/15424</link>
		<description><![CDATA[<p>안녕하세요</p>

<p>KBoard와 myCRED 플러그인을 연동하여 잘사용하고있습니다</p>

<p> </p>

<p>포인트를 아래의 이미지와 같이 표시하려고 찾아본결과 원래 지원하고있는 숏코드가 있어서 적용시키려다 문제가 발생합니다</p>

<p><img alt="" src="http://codex.mycred.me/wp-content/uploads/2016/11/new-rank-progress-with-labels.png" /></p>

<p> </p>

<p>일단 <a href="http://codex.mycred.me/shortcodes/mycred_rank_progress/" target="_blank">http://codex.mycred.me/shortcodes/mycred_rank_progress/</a> 이글을 참고하여 숏코드를 생성하려고하지만 제 테마는 "Visual Composer(비주얼 컴퓨저)"를 사용하고있지않기 때문에 다른 방법을 찾아봤습니다</p>

<p> </p>

<p>찾아본결과 비주얼 컴퓨저를 사용하지 않아도 <a href="https://mycred.me/code-snippets/mycred-custom-shortcode-rank-progress/" target="_blank">https://mycred.me/code-snippets/mycred-custom-shortcode-rank-progress/</a> 이글을 참고하면 사용가능하다고 나와있는데</p>

<p>테마의 functions.php파일에 아래 코드를 추가하였습니다</p>

<pre>
<code>&lt;?php

// Get user's rank progress
function get_mycred_users_rank_progress( $user_id, $show_rank ) {
	global $wpdb;

	if ( ! function_exists( 'mycred' ) ) return '';
	
	// Change rank data to displayed user when on a user's profile
	if ( function_exists( 'bp_is_user' ) &amp;&amp; bp_is_user() &amp;&amp; empty( $user_id ) ) {
		$user_id = bp_displayed_user_id();
	}

	// Load myCRED
	$mycred = mycred();
	
	// Check if user is excluded
	#if ( $mycred-&gt;core-&gt;exclude_user( $user_id ) ) return ''; //문제가 발생한다하여 주석처리

	// Ranks are based on a total
	if ( $mycred-&gt;rank['base'] == 'total' )
		$key = $mycred-&gt;get_cred_id() . '_total';
			
	// Ranks are based on current balance
	else
		$key = $mycred-&gt;get_cred_id();

	// Get Balance
	$users_balance = $mycred-&gt;get_users_cred( $user_id, $key );
   
	// Rank Progress
   
	// Get the users current rank post ID
	$users_rank = (int) mycred_get_users_rank( $user_id, 'ID' ); //문제가 발생한다하여 ID를 type_id로 변경하였습니다
	
	// Get the name of the users current rank
	$users_rank_name = get_the_title( $users_rank );
   
	// Get the ranks set max
	$max = get_post_meta( $users_rank, 'mycred_rank_max', true );
	
	$tabl_name = $wpdb-&gt;prefix . 'postmeta';
	
	// Get the users next rank post ID
	$next_ranks = $wpdb-&gt;get_results( $wpdb-&gt;prepare( "SELECT post_id FROM {$tabl_name} WHERE meta_key = %s AND meta_value &gt; %d ORDER BY meta_value * 1 LIMIT 1;", 'mycred_rank_min', $max ) );

    foreach( $next_ranks as $next_rank ) {

        $next_rank = $next_rank-&gt;post_id;
    }
	
	// Get the name of the users next rank
	$next_rank_name = get_the_title( $next_rank );
	
	// Get the ranks set min
	$next_rank_min = get_post_meta( $next_rank, 'mycred_rank_min', true );
   
	// Calculate progress. We need a percentage with 1 decimal
	$progress = number_format( ( ( $users_balance / $max ) * 100 ), 0 );

	// Display rank progress bar
	echo '&lt;div class="mycred-rank-progress"&gt;';	
		echo '&lt;h3 class="rank-progress-label" style="font-weight:bold;"&gt;Rank Progress ('. $progress .'%)&lt;/h3&gt;';
		echo '&lt;progress max="'. $max .'" value="'. $users_balance .'" class="rank-progress-bar"&gt;';
		echo '&lt;/progress&gt;';	
		if( $show_rank == 'yes' ){
			echo '&lt;span class="current-rank" style="float:left;padding-top:1%;font-weight:bold;"&gt;'. $users_rank_name .'&lt;/span&gt;';	
			echo '&lt;span class="next-rank" style="float:right;padding-top:1%;font-weight:bold;"&gt;'. $next_rank_name .'&lt;/span&gt;';
			echo '&lt;span class="points-progress" style="width:100%;float:left;margin-top: -4.5%;padding-top:1%;font-weight:bold;text-align:center;"&gt;'. $users_balance .' of '. $next_rank_min .'&lt;/span&gt;';
		}
	echo '&lt;/div&gt;';	
}

/**
 * myCRED Shortcode: mycred_users_rank_progress
 * @since 1.0
 * @version 1.0
 */
function mycred_users_rank_progress( $atts ){
	extract( shortcode_atts( array(
		'user_id' =&gt; get_current_user_id(),
		'show_rank' =&gt; 'no'
	), $atts ) );

	ob_start();
	
	get_mycred_users_rank_progress( $user_id, $show_rank );

	$output = ob_get_contents();
	ob_end_clean();

	return $output;

}
add_shortcode( 'mycred_users_rank_progress', 'mycred_users_rank_progress' );

?&gt;</code></pre>

<p>그리고 테마의 css파일에 아래의 코드를 추가하였습니다</p>

<pre>
<code>.mycred-rank-progress{}
.mycred-rank-progress h3.rank-progress-label{}
.mycred-rank-progress span.current-rank{}
.mycred-rank-progress span.next-rank{}
.mycred-rank-progress span.points-progress{}

/* HTML 5 Progress Bar */
progress[value]  {
  /* Reset the default appearance */
  -webkit-appearance: none; -moz-appearance: none; appearance: none;

  /* Get rid of default border in Firefox. */
  border: none;

  /* Dimensions */
  width: 100%; height: 2em;

  /* For IE10 */
  color: red; 
}

/* HTML 5 Progress Bar Container */
progress[value]::-webkit-progress-bar {
  background-color: #eee;
}

/* HTML 5 Progress Bar Value */
progress[value]::-webkit-progress-value {
	background-color: red;
}</code></pre>

<p> </p>

<p>functions.php 파일에 추가될 내용은 해당 게시물에 댓글에 맞게 주석처리하거나 변경하였습니다</p>

<p>페이지에 표시는되는데 <a href="https://www.doogis.com/testpoint" target="_blank">https://www.doogis.com/testpoint</a> 페이지와 같이 이상하게 표시가됩니다</p>

<p>이것을 맨처음 스크린샷처럼 막대모양의 표시가 제대로 이루어졌으면 좋겠는데 전혀 연동이 안되고있는거같습니다</p>
]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[답변감사합니다

사이드바에 삽입할 내용중 포인트를 그냥나타내기보다는 저렇게 얼마만큼의 포인트가 ...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/15469</link>
			<description><![CDATA[<p>답변감사합니다</p>

<p>사이드바에 삽입할 내용중 포인트를 그냥나타내기보다는 저렇게 얼마만큼의 포인트가 있고 다음단계의 등급까지는 얼마나 남았는지</p>

<p>경험치바처럼 생긴것을 정말원하고있었지만 제능력으로 불가능할거같아서 그만두고있었는데요 다행이도 myCRED 플러그인에서 저 숏코드를 지원하긴하는데</p>

<p>작동을 안하는군요... 이건 계속 코드보고있는데 어떻게해야할지 답이안나오네요</p>
]]></description>
			<author>두지스</author>
			<pubDate>Mon, 21 Aug 2017 15:54:40 +0000</pubDate>
			<category>워드프레스</category>
		</item>
				<item>
			<title><![CDATA[안녕하세요.

코드를 살짝 봐보니,

$progress = number_format( ( ( $users_balance / $max ) * 100 ),...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/15463</link>
			<description><![CDATA[<p>안녕하세요.</p>

<p>코드를 살짝 봐보니,</p>

<p>$progress = number_format( ( ( $users_balance / $max ) * 100 ), 0 );</p>

<p>이 부분에서</p>

<p>$users_balance 값이나 $max 값이 제대로 있는지 확인해봐야 할 듯합니다.</p>

<p>확인해보고, 그 위에 있는 코드들도 모두 확인해서 역추적해서 원인을 찾는 수고를 해야할 듯합니다..</p>

<p>저희도 좀 여유가 생겼을 때 테스트 한번 해보겠습니다 ㅎㅎ</p>
]]></description>
			<author>스레드봇</author>
			<pubDate>Mon, 21 Aug 2017 14:32:12 +0000</pubDate>
			<category>워드프레스</category>
		</item>
			</channel>
</rss>