Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    For the first part, It’s more a case of what you want to map it to from the badges you create within BadgeOS. With the mapping to Credly, the field you choose from within WP, will be used for the criteria field in Credly badges on their end.

    For the second part, stand by, I’ll look into finding out what filters and whatnot you’d need for that.

    For the edit part: I’m not familiar at all with the pagelines theme. I’d check to see what output is being displayed in the spots in question. There could be case of hiding via css, but I can’t say for sure. If there’s nothing being output as well, then we’d need to go with my reply for part 2, with filtering and adding output.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hello again Caleb, I appreciate your patience.

    So, to filter the text and whatnot in the green, it looks like you have this filter hook to work with:

    badgeos_earned_achievement_message

    This is going to hold the html/text for the “You have earned this achievement!” green bar and then if you have congratulations text for the achievement, it’ll be part of that as well. With this, you can change the whole spot to whatever you want, or you could use something like php’s str_replace to alter just parts of it. Not the MOST efficient but it still presents possibilities.

    For changing the heading of the next part, which says “People who have earned this:” we have this hook

    badgeos_earners_heading

    and then for the actual list of users, we have a hook that is run for each one, and it’s a list element. Right now, they’re definitely going to be part of an UNordered list, but if we need to, we could file a ticket for a filter for the markup. The html for each user will be as follows by default:

    $user_content = '<li><a href="' . get_author_posts_url( $user->ID ) . '">' . get_avatar( $user->ID ) . '</a></li>';

    filter hook:

    badgeos_get_achievement_earners_list_user

    The filter has that $user_content variable as well as the user ID passed in, in case you want to selectively do something. With this, you should be able to reconstruct and add more user information to the returned output.

    Hopefully that answers your questions regarding this, but don’t hesitate to ask more. I’m willing to help.

    overall hooks resource: https://badgeos.org/developers/hooks/

    Thread Starter CalebEverett

    (@calebeverett)

    Hi Michael,
    Thanks for the help. Here’s the page where this is showing up now:
    https://careercalifornia.edu/badges/perfect-attendance-october-2013-2/

    Unfortunately, I am not super experienced on the technical front. I know how to add functions to the functions.php file and edit template files. If you’d be willing to point me in the right direction on where to make the changes, I’d like to take a swing at it.

    I’d also be happy to retain you guys to do some work for us to help us get set up as well.

    Thank you,

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    I could likely help get some bits and pieces started for you if you let me know what all information you want displayed for the user. I know above you mentioned their user names, and also you wanted to display a picture of the badge. The badge image, I feel, would be best shown just once and then obviously each user gets their own image/name.

    Regarding the retaining WebDevStudios part, feel free to contact at https://badgeos.org/contact/ and provide as much detail as you can for your needs, and also mention that you want to work with us for it. That’ll get any wheels rolling and we’ll see if we can come to an agreement on terms.

    Thread Starter CalebEverett

    (@calebeverett)

    Hi Michael,

    I think we were thinking about the same thing on the layout. Here’s a screen shot with a few ideas. https://screencast.com/t/jcpTb7EIrlra

    By the way that would also be awesome as a shortcode. I would bet other folks would be interested in being able to drop in a badge with the list of recipients in to a blog post.

    Thanks,

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘What field maps to Credly criteria?’ is closed to new replies.