or is it in the loader.php
` case 22:
$wpdb->insert( “{$table_prefix}achievements_actions”, array( ‘category’ => ‘inviteanyone’, ‘name’ => ‘accepted_email_invite’, ‘description’ => __( “A new user activates their account.”, ‘dpa’ ), ‘is_group_action’ => 0 ) );
$wpdb->insert( “{$table_prefix}achievements_actions”, array( ‘category’ => ‘inviteanyone’, ‘name’ => ‘sent_email_invite’, ‘description’ => __( “The user invites someone to join the site.”, ‘dpa’ ), ‘is_group_action’ => 0 ) );
break;`
Also….. just basic etiquette of how to add to this case statement from another “buddy” plug-in so the core can stay unmodified is truly mind boggling…
Hey Simon,
Thanks for the kind words. And well done, you’ve pretty much figured out the basics of how it’s implemented. Check out http://achievementsapp.com/developer/add-support-for-a-plugin-non-custom-post-type/ for some more detail, and let me know if you need assistance.
p.s. this might be of use. It’s a couple of years old, so may need tweaking based on the above documentation; http://djpaul.dangerous-minds.net/example_achievements.phps
Oh you mean on the site you made specifically for developers like me asking pesky questions….
DOOOOIEEEEE c|
thanks for the help this looks like it has everything I need
For posterity’s sake … if you want to build a plug-in to tie in other plug-ins or your own into achievements without mucking up the core… use this: http://wordpress.org/extend/plugins/buddypress-skeleton-component/ To put your functions in.
A few more questions if you have a moment, thanks for getting back to me so fast the first time!
“Add a new record to the achievements_actions table. The name column is very important. It must match the first argument of the do_action() call.”
Do you mean adding this directly using mySQL admin tools? Or that by using the function…
`function dpa_handle_action_bp_example_send_high_five() {
$func_get_args = func_get_args();
dpa_handle_action( ‘bp_example_send_high_five’, $func_get_args );
}`
it adds it for you?
Bit of a newbie with this level of programming so thanks again for the feedback….
I guess alot of this depends on the plug-in, so it’s a little ambitious to expect help on this … BUT…
I have looked through all 235 files of the “GD Star Rating” plug-in and can only find a select few “add_action” calls, none of which relate to someone rating on a post “This is the action I’m trying to grab”…
Does the “event” we’re registering in the achievements table need to be officially registered as an “action” or is there another way of referencing these user actions…. i.e. when someone rates a post.?
thanks thanks
P.S. Paul, if you’d like me to post these questions on your plug-in dev site, I can do that.
You can either add a record to achievements_actions directly with SQL, or you could do a little plugin to install it for you when it’s activated. Up to you.
You need to look for do_action calls
Hey there Paul,
Thanks! found all the actions in the plug-in I want to dial in….
// gdsr_vote_thumb_article
// gdsr_vote_thumb_comment
// gdsr_vote_rating_multis
// gdsr_vote_rating_article
// gdsr_vote_rating_comment
awesome…. now I would really like to set this up as a plug-in for others to use…. do you have any easy to use snippets for adding a new achievement”action” to the achievement table?
In the example: http://djpaul.dangerous-minds.net/example_achievements.phps… that this is manually triggering each achievement event rather then relying on the inherint functionality of the plug-in….I liked your example better, where you registered the “action” then used the core functionality of the achievements plug-in for all the heavy lifting…. i.e. unlocking, awarding, counting.
Anywho… here’s what I got so far.. triggering a fatal error on activation…. any thoughts?
This is placed in loader.php… of a new plug-in created from skeleton.
‘function achievements_tweaks_events_activate() {
// add the new ‘action’ values for achievements into the achievements table.
global $wpdb
$achievement_category = ‘gdsr_vote’;
$achievement_is_group_action = 0;
$achievement_name = ‘gdsr_vote_rating_article’;
$achievement_description = ‘The user rated a post’;
$wpdb->insert( ‘wp_achievements_actions’, array( ‘category’ => $achievement_category, ‘is_group_action’ => $achievement_is_group_action, ‘name’ => $achievement_name, ‘description’ => $achievement_description), array( ‘%s’, ‘%d’, ‘%s’, ‘%s’ ) );
}
register_activation_hook( __FILE__, ‘achievements_tweaks_events_activate’ );’
oops my bad… I missed a “;”…after global $wpdb..
that worked a charm…
I’ll post this plug-in when I’m finished…..
Again … thanks so mUCH PAUL!!! YOU ROCK!
I noticed that old, old example_achievements.php was old and wasn’t working. If you can’t figure out anything from the documentation on achievementsapp.com, let me know, and I’ll copy/paste a new template version
One last question (I hope) on setting this up as a companion plug-in without mucking up the works.
When the user uninstalls the plug-in we want to remove all references across the 3 achievements tables to any related actions, achievements, or unlocks…
Trying to use wpdb-> query to achieve this …. the same way i added them but am having difficulty.
any thoughts?
‘function achievements_tweaks_events_deactivate() {
// remove the actions from the table wp_achievements_actions table
global $wpdb;
$achievement_category = ‘gdsr_vote’; // make sure this title is unique to your plug-in
// remove any associated achivements from the wp_achievements table
$wpdb->query(“DELETE FROM $wpdb->wp_achievements A INNER JOIN $wpdb->wp_achievements_actions AA ON A.action_id = AA.id WHERE AA.category = ‘”.$achievement_category.”‘”);
// remove the actions from the table wp_achievements_actions table
$wpdb->query(“DELETE FROM $wpdb->wp_achievements_actions A WHERE A.category = $achievement_category”);
// remove any unlocked achievement references to these actions.
// we’el leave these hanging in case the achievement is reactivated.
}
register_deactivation_hook( __FILE__, ‘achievements_tweaks_events_deactivate’ );’
as you can see above I’m trying numerous ways to reference the variable and complete this delete properly…. maybe this isn’t a plug-in question, but rather a syntax error in the $wpdb->query
cannot get this $wpdb delete to work in it’s simplest form….
`// register_activation_hook( __FILE__, ‘achievements_tweaks_events_activate’ );
function achievements_tweaks_events_deactivate() {
// remove the actions from the table wp_achievements_actions table
global $wpdb;
$achievement_category = ‘gdsr_vote’; // make sure this title is unique to your plug-in
$wpdb->query(“DELETE FROM $wpdb->wp_achievements_actions WHERE ‘category’ = $achievement_category”);
}
register_deactivation_hook( __FILE__, ‘achievements_tweaks_events_deactivate’ );`
Any thoughts would be greatly appreciated…. thanks…S.
$wpdb->wp_achievements_actions doesn’t exist. Check how the table’s referenced in Achievements core.