WordPress.org

Ready to get started?Download WordPress

Forums

CubePoints
[resolved] Displaying Cubepoints Rank in comments section (22 posts)

  1. ClearConscious
    Member
    Posted 2 years ago #

    Hello all,

    I'm trying to figure out how to display the Cubepoints ranks into my comment section. I essentially want it to display the rank of each commenter on the site.

    Currently I'm using the following code to display points (hope this is helpful for anyone looking for that):

    <center><?php $user = get_userdata($comment->user_id); if(function_exists('cp_displayPoints') && $user->ID){
    echo 'Points: [';
    cp_displayPoints($user->ID);
    echo ']';
    }
    ?></center>

    I'm wondering if anyone could help me with this.

    Thanks!

    http://wordpress.org/extend/plugins/cubepoints/

  2. Jonathan Lau
    Member
    Plugin Author

    Posted 1 year ago #

    Try this:

    if(function_exists('cp_module_ranks_getRank')){
        echo cp_module_ranks_getRank($user->ID);
    }
  3. ClearConscious
    Member
    Posted 1 year ago #

    Nope, doesn't work :(

  4. Jonathan Lau
    Member
    Plugin Author

    Posted 1 year ago #

    Did you put this code below the code you pasted?
    Otherwise you need this line in front as well.

    $user = get_userdata($comment->user_id);

  5. ClearConscious
    Member
    Posted 1 year ago #

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php $user = get_userdata($comment->user_id);
    if(function_exists('cp_module_ranks_getRank')){
        echo cp_module_ranks_getRank($user->ID);
    }?>

    Like that?

  6. ClearConscious
    Member
    Posted 1 year ago #

    Is there a way to include Rank: Zombie for instance. This just displays the rank. I'm hoping I can let people know that's their rank by including "Rank: [rank inserted]"

  7. ClearConscious
    Member
    Posted 1 year ago #

    Finally got it.

    For anyone that needs help with this, the code can be found below:

    <?php $user = get_userdata($comment->user_id);
    if(function_exists('cp_module_ranks_getRank')){
    echo '[Rank: ';
    echo cp_module_ranks_getRank($user->ID);
    echo ']';
    }?>

  8. Tele-Cole
    Member
    Posted 1 year ago #

    Great. Where u place it?

  9. bennygill
    Member
    Posted 1 year ago #

    Yes where do you place it?? I've been searching for this too.

  10. bennygill
    Member
    Posted 1 year ago #

    oops. Actually I need it to display in bbpress forums. not comment section.

  11. GSJ
    Member
    Posted 1 year ago #

    Hi there, where do you place this code?
    Thanks!

  12. foobarph
    Member
    Posted 1 year ago #

    go to your theme's file and edit your COMMENT.PHP file.

  13. Redazione_INM
    Blocked
    Posted 1 year ago #

    resolved] what?.
    I putted the code in comment.php, in comment_template (sigh - the core of wordpress into includes directory), but nothing happen.
    Somebody can write exactly where insert the code menzioned above?.
    Hello ClearConscious, why you don't share competelly your success?.

    Three authors for the plugin, but nobody is here!.

  14. J.D. Grimes
    Member
    Posted 1 year ago #

    It needs to be in the comments template where you want the rank to appear. That would be in comment.php in your current theme's directory (example: /wp-content/themes/my-theme/comment.php).

  15. Redazione_INM
    Blocked
    Posted 1 year ago #

    Thanks J.D. Grimes
    But I wrote already that if I put that code in the comment.php theme or core, nothing happen, this is the strange!.
    Maybe some other plugin or I don't know what, is just in contrast with the code, because if I write alone, in other plugin, that work properly.
    I'm trying but without result. Damn!.

  16. J.D. Grimes
    Member
    Posted 1 year ago #

    Could you paste a copy of your theme's comment.php on pastbin?

  17. Redazione_INM
    Blocked
    Posted 1 year ago #

    I did it!.

  18. J.D. Grimes
    Member
    Posted 1 year ago #

    Could you give me the link? Thanks.

  19. Redazione_INM
    Blocked
    Posted 1 year ago #

    For J.D. Grimes

    <?php // Do not delete these lines
    
    if (!empty($_SERVER['SCRIPT_FILENAME']) AND 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    	die (__('Please do not load this page directly. Thanks!','atahualpa'));
    
    if ( post_password_required() ) {
    	_e('This post is password protected. Enter the password to view comments.','atahualpa');
    	return;
    }
    
    global $bfa_ata;
    // You can start editing below:
    ?>
    
    <?php // If there are any comments
    $bfa_page_comment_open = 0;
    if ( is_page() and ('open' == $post->comment_status)) {
    	 $bfa_page_comment_open = 1; }
    else {
    	$bfa_page_comment_open = 0;} 
    
    global $user_ID; $post_id;
    ?>
    <!-- // Comment Area Title  -->
    
    <?php if ( have_comments() ) : ?>
    	<?php bfa_next_previous_comments_links('Above'); ?>
    
    	<!-- Comment List -->
    	<ul class="commentlist">
    
    	<?php // Do this for every comment
    	if ($bfa_ata['separate_trackbacks'] == "Yes") {
    
    		wp_list_comments(array(
    			'avatar_size'=>$bfa_ata['avatar_size'],
    			'reply_text'=>__(' &middot; Reply','atahualpa'),
    			'login_text'=>__('Log in to Reply','atahualpa'),
    			'callback' => 'gtcn_basic_callback',      
    
    			'type' => 'comment'
    			));
    
    		wp_list_comments(array(
    			'avatar_size'=>$bfa_ata['avatar_size'],
    			'reply_text'=>__(' &middot; Reply','atahualpa'),
    			'login_text'=>__('Log in to Reply','atahualpa'),
    			'callback' => 'gtcn_basic_callback',      
    
    			'type' => 'pings'
    			));
    
    	} else {
    
    		wp_list_comments(array(
    			'avatar_size'=>$bfa_ata['avatar_size'],
    			'reply_text'=>__(' &middot; Reply','atahualpa'),
    			'login_text'=>__('Log in to Reply','atahualpa'),
     			'callback' => 'gtcn_basic_callback', 
    
    			'type' => 'all'
    			));
    
    	} ?>
    
    	</ul>
    	<!-- / Comment List -->
    
    	<?php bfa_next_previous_comments_links('Below'); ?>
    
    <?php else : // If there are NO comments  ?>
    
    	<?php // If comments are open, but there are no comments:
    if ( ('open' == $post->comment_status) ) : ?>
    		<!-- .... -->
    
    	<?php else : // If comments are closed: ?>
    
    		<?php echo  $bfa_ata['comments_are_closed_text'] ; ?>
    
    	<?php endif; ?>
    
    <?php endif; // END of "If there are NO comments" ?>
    
    <?php
    // Since 3.6.1: Configuring the new comment_form() function,
    // instead of using it with the default settings. See also http://codex.wordpress.org/Function_Reference/comment_form
    ?>
    
    <?php
    // These values aren't available else:
    global $aria_req, $post_id, $required_text;
    // author, email and url fields are set in a separate variable first:
    $fields =  array(
    	'author' => '<p><input class="text author" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' tabindex="1" />' .
    				'&nbsp;&nbsp;<label for="author"><strong>' . __( 'Name ' ,'atahualpa') . '</strong> ' . ( $req ? __('(required)','atahualpa') : '' ) . '</label></p>',
    	'email'  => '<p><input class="text email" id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . '  tabindex="2" />' . 
    
    				'&nbsp;&nbsp;<label for="email"><strong>' . __( 'Email' ,'atahualpa') . '</strong> ' . ( $req ? __('(will not be published) (required)','atahualpa') : '' ) . '</label></p>'
    
    ); 
    
    if ($bfa_ata['show_xhtml_tags'] == "Yes") {
    	$comment_notes_after = '
    		<p class="thesetags clearfix">' .
    		sprintf(__('You can use %1$sthese HTML tags</a>','atahualpa'),
    		'<a class="xhtmltags" href="#" onclick="return false;">') . '</p>
    		<div class="xhtml-tags"><p><code>' . allowed_tags() . '
    		</code></p></div>';
    } else {
    	$comment_notes_after = '';
    }
    
    // The rest is set here:
    $comment_form_settings = array(
    	'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
    	'comment_field'        => '<p><textarea name="comment" id="comment" rows="23" cols="10" tabindex="4"></textarea></p>',
    
    	'must_log_in'          => '<p class="must-log-in3">' .  sprintf( __('<b>Nota</b>: Siamo spiacenti, ma solo gli Utenti che effettuano il <a href="%s">Login </a> potranno pubblicare commenti; ecco perch&egrave; l\'area di testo non &egrave; visualizzata.', 'atahualpa' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
    
    	'logged_in_as'         => '<h3 id="comments">Qui ha inizio l\'area dove puoi scrivere il tuo Commento. Per favore, assicurati di aver collegato anche il cervello!. <img src="http://www.iononmollo.it/wp-content/themes/atahualpa/images/cervello-connesso-computer.gif" alt="Cervello connesso" height="55" width="150"></h3><p class="logged-in-as">' . sprintf( __( 'L\'autenticazione &egrave; avvenuta in modo corretto. Ciao <span><font size="3" color="#ff3762"><b>%2$s</b></font></span>  &nbsp;&nbsp;|| &nbsp;&nbsp;<a href="%3$s" title="Log out of this account">Esci</a><p><b>Nota</b>: Per non andare a capo di due righe, tieni pigiato il tasto <b>Shift(Maiusc)</b> mentre pigi anche sul tasto <b>Enter(Invio)</b>. Ti sposterai di una sola riga in gi&ugrave;.</p>', 'atahualpa' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
    	'comment_notes_after'  => $comment_notes_after,
    	'id_form'              => 'commentform',
    	'id_submit'            => 'submit',
      'title_reply'          => __( '','atahualpa' ),
    	'title_reply_to'       => __( 'Leave a Reply to %s','atahualpa' ),
    	'cancel_reply_link'    => __( 'Cancel reply','atahualpa' ),
    	'label_submit'         => __( 'Post Comment' ,'atahualpa')
    );
    ?>
    
    <?php // Using the new function comment_form() with the custom settings $comment_form_settings
    comment_form($comment_form_settings);
    ?>
  20. J.D. Grimes
    Member
    Posted 1 year ago #

    Somewhere in your theme is a function gtcn_basic_callback(). Find that and post the source.

    EDIT: It will probably be in functions.php

  21. Redazione_INM
    Blocked
    Posted 1 year ago #

    No, that code is a function just for numbering the comments.

  22. Redazione_INM
    Blocked
    Posted 1 year ago #

    Hi J.D. Grimes
    You think right about that function.
    Now on my blog points and ranks follow anytimes the authors.
    The plugin works great and i can show what I want, where I like.!.
    Thanks.
    [ Signature moderated. ]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic