Actually, I looked closer at the congrats text, and that’s just a meta field in the achievement editor. You can set that to be whatever you want via the “Congratulations text” textarea. No need to filter anything. It won’t be the part in green because that’s a bit hardcoded, though not impossible to filter.
In order to filter the green background text, see if this works for you.
function caleb_filter_congrat_green_message( $text ) {
//check to make sure we're dealing with just the text we want to alter, else return untouched.
if ( $text != 'You have earned this achievement!' )
return $text;
//If we're this far, the $text variable value matched the string we're looking for, so lets change it.
$text = 'Some new text';
return $text;
}
add_filter( 'gettext', 'caleb_filter_congrat_green_message', 10, 2 );
Not sure what part is providing the “Students earning this badge…” text, so I can’t quite help with that spot yet. If you could tell me what field you’re using to set that text, I’ll be able to move forward.
For the user’s name, I have the following, and in it you have a choice regarding if you want the name to be part of the link or not. Read the comments for a bit more detail there.
<?php
function caleb_filter_earners_list_data( $user_content, $ID ) {
//Grab our user data, as we have the user ID available.
$user = get_userdata( $ID );
//This is a copy/paste of the original $user_content but it's already close to what we want, we just need a bit more.
//If you want the name outside of the html link.
$user_content = '<li><a href="' . get_author_posts_url( $user->ID ) . '">' . get_avatar( $user->ID ) . '</a>' . $user->user_firstname . ' ' . $user->user_lastname . '</li>';
//If you want the user name to be part of the link text, delete the line above and use this.
$user_content = '<li><a href="' . get_author_posts_url( $user->ID ) . '">' . get_avatar( $user->ID ) . $user->user_firstname . ' ' . $user->user_lastname . '</a></li>';
return $user_content;
}
add_filter( 'badgeos_get_achievement_earners_list_user', 'caleb_filter_earners_list_data', 10, 2 );
Regarding the removal of indent, that’s going to be all a CSS thing with your theme.