Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Paul Wong-Gibbs

    (@djpaul)

    Hi! Thanks!

    You’ll need to be a little familiar with HTML, CSS, and PHP to get this done, but let me help get you started. Are you using Achievements with BuddyPress, or not?

    I am very interested in knowing this also. Would like the 10 most recent badges to appear on the displayed user’s profile, without modifying the plugin itself. Using Buddypress 1.7 and Achievements 3.5. Would basically be put in member-header.php of the buddypress/members/single template. Thanks in advance for your help, it’s a great plugin! Thanks for adding live notifications to!

    Nevermind, I figured it out. Did it this way:

    <?php 
    
    	$args = array(
         'type' => 'dpa_unlocked',
         'max' => 10,
         'user_id' => bp_displayed_user_id(),
    	 'sort' => 'DESC',
    
        );
    	if ( bp_has_activities( bp_ajax_querystring( $args ) ) ) : 
    
    ?>
        <?php while ( bp_activities() ) : bp_the_activity(); ?>
    
               <div class="user-badges">
                   <a href="<?php echo bp_activity_get_permalink(); ?>">
                       <?php echo get_the_post_thumbnail(bp_get_activity_item_id(), 'thumbnail'); ?>
                   </a>
               </div> 
    
        <?php endwhile; ?>
    <?php endif; ?>

    Actually the bp_activity_get_permalink(); is no good. Use get_permalink(bp_get_activity_item_id()); instead.

    Thread Starter Chef

    (@splendidangst)

    Yes, I’m using it with BuddyPress

    Leon Kiley

    (@watersedgeweb)

    Here is the new / improved / permanent way to display achievements in a buddypress template:

    <?php
    	// WP_Query arguments
    	$args = array (
    	'post_type'              => 'dpa_progress',
    	'post_status'            => 'dpa_unlocked',
    	'author'                 => bp_displayed_user_id(),
    	'order'                  => 'DESC',
    	'orderby'                => 'date',
    	'nopaging'		 => true
    	);
    
    	// The Query
    	$badges = new WP_Query( $args );
    ?>
    
    <?php while ($badges->have_posts()) : $badges->the_post(); ?>
         <a href="<?php echo get_permalink($post->post_parent); ?>" title="<?php esc_attr( the_title() ); ?>">
         <?php echo get_the_post_thumbnail($post->post_parent,'thumbnail'); ?>
         </a>
    <?php endwhile; ?>
    
    <?php wp_reset_postdata(); ?>

    Took me a while to figure out so I thought I’d share.

    Plugin Author Paul Wong-Gibbs

    (@djpaul)

    SplendidAngst, check out the code the Leon wrote up. It should do what you want, or at least be a good start point.

    Thanks Leon!

    Works great.

    but i cant use this code in the loop-single-reply.php

    I Want to show it below the Avatar in the bbpress Forum, but everyone postet in the topic get shown the same achievement as the topic starter.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Display newest achievement/badge on users profile’ is closed to new replies.