Title: jonioscm's Replies | WordPress.org

---

# jonioscm

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

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

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Achievements for WordPress] Award for logging in x times](https://wordpress.org/support/topic/award-for-logging-in-x-times/)
 *  Thread Starter [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/award-for-logging-in-x-times/#post-4632794)
 * Hi Apokh,
 * Apologies for delay in responding – currently in process of house move so only
   internet access I have is at work! Looks like you got a bit mixed up with where
   to add things. I’ll try to clarify what I did.
 * Your file xlogin.php should just be used for adding the “actions” – it appears
   you’ve added Unit9’s function in there, too. Whilst it may work, it also might
   not. Work through the base plugin extension template, just changing the things
   you need to (ie. the eat pizza/cake sections).
 * I’d add those other functions to your theme folders functions.php (just make 
   one if you don’t have it already) if you’re only using the one theme. You’ll 
   have to make sure the “require” function in your last code example (mg_achievements_init)
   is able to find the actual xlogin.php file. I placed it in my theme folder simply
   because it means I can call it with ‘xlogin.php’ – rather than adding paths.
 * Hope this helps,
 * Jon
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Achievements for WordPress] Image size for achievements loop](https://wordpress.org/support/topic/image-size-for-achievements-loop/)
 *  [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/image-size-for-achievements-loop/#post-4659628)
 * If the uploaded image is actually 32px x 32px – you should be able to target 
   the image via css to force the size. Something like (assuming the table is classed
   the same) maybe;
 *     ```
       .dpa-archive-achievements img {
       	height:32px;
       	width:32px;
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Achievements for WordPress] Award for logging in x times](https://wordpress.org/support/topic/award-for-logging-in-x-times/)
 *  Thread Starter [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/award-for-logging-in-x-times/#post-4632784)
 * No problem, Unit9
 * your_textdomain is for (I believe) translating/language related. There is a bit
   of info [here](https://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains)
   on text domains.
 * Hope this helps =o)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Achievements for WordPress] Award for logging in x times](https://wordpress.org/support/topic/award-for-logging-in-x-times/)
 *  Thread Starter [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/award-for-logging-in-x-times/#post-4632759)
 * You’ll need to add the actions via plug-in extension – see [here](http://achievementsapp.com/developers/adding-other-plugins/)
 * About halfway down the page is the “Reference Plugin” which should make it straight
   forward enough. Work through that template making the changes, and you should
   be right. Save in your theme folder as (for example) achextend.php – then add
   this to your functions.php;
 *     ```
       function mg_achievements_init() {
         require 'achextend.php';
       }
       add_action( 'dpa_init', 'mg_achievements_init' );
       ```
   
 * I’m pretty sure that should get you up and running. You can then add the achievements
   in via the wp-admin thingo =o)
 * You might choose not to save it in the theme folder – depending on how your site
   is structured. I’m running a local intranet, with a single theme, as the only
   administrator – so this works for me.
 * I think that should get you up and going =o)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Achievements for WordPress] Award for logging in x times](https://wordpress.org/support/topic/award-for-logging-in-x-times/)
 *  Thread Starter [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/award-for-logging-in-x-times/#post-4632757)
 * Just a thought, but I guess you could use a variable rather than the if statement
   like this (untested!);
 *     ```
       function my_user_login_count($username, $user) {
           $login_count = intval(get_user_meta($user->ID, 'my_user_count', true));
   
           $login_count++;
           update_user_meta($user->ID, 'my_user_count', $login_count);
           $theaction = 'logged_in_' . $login_count . '_times';
   
           do_action($theaction, $current_user->ID);
           }
       }
       add_action('wp_login', 'my_user_login_count', 10, 2);
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Achievements for WordPress] Award for logging in x times](https://wordpress.org/support/topic/award-for-logging-in-x-times/)
 *  Thread Starter [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/award-for-logging-in-x-times/#post-4632756)
 * I went down the same route as Unit9, initially – but changed for flexibility (
   rather than having to hard code individual achievements. If you go that way, 
   you would essentially add an if statement where the // comment line is – so code
   might be;
 *     ```
       function my_user_login_count($username, $user) {
           $login_count = intval(get_user_meta($user->ID, 'my_user_count', true));
   
           $login_count++;
           update_user_meta($user->ID, 'my_user_count', $login_count);
   
           if ($login_count == 10) {
               do_action('logged_in_10_times', $current_user->ID);
           }
           if ($login_count == 20) {
               do_action('logged_in_20_times', $current_user->ID);
           }
       }
       add_action('wp_login', 'my_user_login_count', 10, 2);
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Achievements for WordPress] Award for logging in x times](https://wordpress.org/support/topic/award-for-logging-in-x-times/)
 *  Thread Starter [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/award-for-logging-in-x-times/#post-4632533)
 * By the way, the ‘user_front_end_login’ is a custom one I added using the instructions
   from PG [here](http://achievementsapp.com/developers/adding-other-plugins/).
 * Thanks for the amazing plugin – I’ve had heaps of fun =o)
 * Jon
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[New User Approve] Feature request: 2x new actions](https://wordpress.org/support/topic/feature-request-2x-new-actions/)
 *  [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/feature-request-2x-new-actions/#post-3433899)
 * I’d appreciate this feature, too. Occasionally I get a lot of bot sign-ups in
   one go, and have to go through the main “user list” to delete the accounts.
 * Regards,
 * Jon
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BuddyPress Member Profile Stats] Plugin Not Working Anymore…](https://wordpress.org/support/topic/plugin-not-working-anymore/)
 *  [jonioscm](https://wordpress.org/support/users/jonioscm/)
 * (@jonioscm)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-not-working-anymore/#post-3147303)
 * Developer needs to read this;
 * > [PHP Warning: Missing argument 2 for wpdb::prepare()](https://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/)

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