Title: CraftyMc's Replies | WordPress.org

---

# CraftyMc

  [  ](https://wordpress.org/support/users/craftymc/)

 *   [Profile](https://wordpress.org/support/users/craftymc/)
 *   [Topics Started](https://wordpress.org/support/users/craftymc/topics/)
 *   [Replies Created](https://wordpress.org/support/users/craftymc/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/craftymc/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/craftymc/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/craftymc/engagements/)
 *   [Favorites](https://wordpress.org/support/users/craftymc/favorites/)

 Search replies:

## Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Redirection] Username variable / constant?](https://wordpress.org/support/topic/username-variable-constant/)
 *  Thread Starter [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/username-variable-constant/#post-7603503)
 * Is there any help on this?
 * Need a solution urgently.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Buddypress Xprofile Custom Fields Type] Show field data elsewhere?](https://wordpress.org/support/topic/show-field-data-elsewhere/)
 *  Thread Starter [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/show-field-data-elsewhere/#post-7566647)
 * Tried it, didn’t work 🙁
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Buddypress Xprofile Custom Fields Type] Show field data elsewhere?](https://wordpress.org/support/topic/show-field-data-elsewhere/)
 *  Thread Starter [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/show-field-data-elsewhere/#post-7566581)
 * That’s no good as it should be id of the bd profile which is being viewed, it’s
   basically a profile card of the use when you hover over their avatar. so using
   $user_id would set a fixed standard for all profiles and not the age of the profile
   which you’re viewing. =(
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BadgeOS] Badge for publishing a new post of custom post type](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/)
 *  [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/#post-5854316)
 * Got it working from your paste mate =D thank you ever so much. Now i can mod 
   it to my liking and turn it into a plugin.
 * Thanks so much for the help bud.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BadgeOS] Badge for publishing a new post of custom post type](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/)
 *  [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/#post-5854315)
 * hmmm, I changed this line `if ($post_type == 'custom_type') {` to use ideas and
   $ideas still keeping the save for testing but can’t get the badge to award.
 * I can move it to another file / plugin, just trying to get it to work first 🙂
 * How can i find out for sure what the custom post type is?
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BadgeOS] Badge for publishing a new post of custom post type](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/)
 *  [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/#post-5854312)
 * [@kendall](https://wordpress.org/support/users/kendall/),
 * I actually just tried your method about half an hour ago but i can’t seem to 
   get it to work.
 * My custom type is $ideas,
 * I added this to the bottom of my triggers.php file,
 *     ```
       function custom_trigger($triggers) {
           $triggers['new_trigger'] = 'New Trigger';
           return $triggers;
       }
       add_filter('badgeos_activity_triggers', 'custom_trigger');
   
       function increment_custom_trigger($post_id) {
   
           // Set the database as a global variable.
           global $wpdb;
   
           // Get the post object and use the object to determine the type and author.
           $post = get_post($post_id);
           $post_type = $post->post_type;
           $post_author = $post->post_author;
   
           // Get the author as an object so we can retrieve a username.
           $user = get_userdata( $post_author );
           $username = $user->user_login;
   
           // Test for our custom post type slug
           if ($post_type == 'custom_type') {
   
               // Iterate the trigger count and save the new count as a variable.
               $new_count = badgeos_update_user_trigger_count($post_author, 'new_trigger');
   
               // Log the new trigger count.
               badgeos_post_log_entry( null, $author, null, sprintf('%1$s triggered %2$s (%3$dx)', $username, 'new_trigger', $new_count));
   
               // Here's where things get fun. We're going to search the
               // database for achievements that use the trigger that we've
               // just incremented and save them in an array.
               $triggered_achievements = $wpdb->get_results( $wpdb->prepare(
                   "
                   SELECT post_ID
                   FROM $wpdb->postmeta
                   WHERE meta_key = '_badgeos_trigger_type'
                       AND meta_value = %s
                   ",
                   'new_trigger'
               ) );
   
               // Now we iterate through that array and use an existing
               // function to determine if we should award any of those
               // achievements to the author of the post.
               foreach ($triggered_achievements as $achievement) {
                   badgeos_maybe_award_achievement_to_user( $achievement->post_ID, $post_author, 'new_trigger', get_current_blog_id(), '' );
               }
           }
       }
       add_action('save_post', 'increment_custom_trigger');
       ```
   
 * Then I setup a badge using the ‘new trigger’ but it didn’t fire. No badge was
   given upon save / submit.
 * Not sure where i have gone wrong as it’s not throwing up any errors but it’s 
   not giving badges either. Also how would i get it to award on publish and not
   save?
 * Much appreciated. Thank You.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BadgeOS] Badge for publishing a new post of custom post type](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/)
 *  [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/badge-for-publishing-a-new-post-of-custom-post-type/#post-5854309)
 * Did anyone figure out exactly what lines to add / edit to include another step
   for custom post type?
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Postman SMTP Mailer/Email Log] Using HTML template please help!](https://wordpress.org/support/topic/using-html-template-please-help/)
 *  Thread Starter [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [11 years ago](https://wordpress.org/support/topic/using-html-template-please-help/#post-6176167)
 * I managed to get it to work but Iv’e had to remove all spaces and new lines. 
   Lets hope I never have to go there again because it looks a complete mess now
   lol just imagine 150 lines with no spaces or new lines, *my head hurts* lol
 * It would appear it was converting all the new lines to `<br />` instead of ignoring
   them. 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Postman SMTP Mailer/Email Log] feature request, log processed emails?](https://wordpress.org/support/topic/feature-request-log-processed-emails/)
 *  Thread Starter [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/feature-request-log-processed-emails/#post-5989095)
 * Hey bud, yeah it’s awesome. I’m fully up to date and everything is working smoothly
   and as it should. I would recommend this plugin to anyone and everyone. I run
   it on all of my websites now. Keep up the good work. 🙂 Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Postman SMTP Mailer/Email Log] feature request, log processed emails?](https://wordpress.org/support/topic/feature-request-log-processed-emails/)
 *  Thread Starter [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/feature-request-log-processed-emails/#post-5988778)
 * 🙂 perfect, looking forward to it. Keep up the great work bud.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Blackjack] Mycred Integration](https://wordpress.org/support/topic/mycred-integration/)
 *  [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/mycred-integration/#post-5036227)
 * myCRED, myCRED, myCRED please support it, so many people use it….
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Participants Database] Shortcode for number of records in the database?](https://wordpress.org/support/topic/shortcode-for-number-of-records-in-the-database/)
 *  Thread Starter [CraftyMc](https://wordpress.org/support/users/craftymc/)
 * (@craftymc)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/shortcode-for-number-of-records-in-the-database/#post-5830556)
 * Perfect, thank you!!

Viewing 12 replies - 1 through 12 (of 12 total)