WordPress.org

Forums

Achievements for WordPress
[resolved] Paul (6 posts)

  1. Bookkus
    Member
    Posted 1 year ago #

    Hi Paul,

    I was wondering if you do custom programming for the plugin?
    I need it to work with Group Reviews. Give achievement points for getting a certain amount of rewards.
    Or can you help me along the road to doing it myself?

    Let me know.

    http://wordpress.org/plugins/achievements/

  2. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Hi

    No, sorry, I can't take any work, and -- FYI -- it's against this forum's code of contact to try to ask for custom work. Moving swiftly on... :)

    If you know PHP and the basics of WordPress plugin development, I can absolutely get you started and tell you what you need to do to get other plugins' actions integrated into Achievements. Let me know.

  3. Bookkus
    Member
    Posted 1 year ago #

    Sorry about the asking for custom work.

    I have this code so far, but it is from an earlier developer. I was wondering how to hook it in.

    <?php
    
    // create custom plugin settings menu
    add_action('admin_menu', 'j_create_menu');
    
    function achievements_tweaks_events_activate() {
    	// add the new 'action' values for achievements into the achievements table.
    	global $wpdb;
    
    	$achievement_category = 'group_review';
    	$achievement_is_group_action = 0;
    	$achievement_name = 'group_review_add_rating';
    	$achievement_description = 'Achieve once group review reached';
    
    	$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' ) );
    
    }
    
    function achievements_tweaks_events_deactivate() {
    
    	// remove the actions from the table wp_achievements_actions table
    	global $wpdb;
    	$achievement_category = 'group_review'; // make sure this title is unique to your plug-in
    
    	// remove the actions from the table wp_achievements_actions table
    	$wpdb->query("DELETE FROM wp_achievements_actions WHERE category like '".$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' );
    
    register_activation_hook( __FILE__, 'achievements_tweaks_events_activate' );
    
    function j_create_menu() {
    
    	//create new top-level menu
    	add_menu_page('J Plugin Settings', 'J Settings', 'administrator', __FILE__, 'j_settings_page','');
    
    	//call register settings function
    	add_action( 'admin_init', 'register_mysettings' );
    }
    
    function register_mysettings() {
    	//register our settings
    	register_setting( 'j-settings-group', 'enable_achievement_on_group' );
    /* 	register_setting( 'j-settings-group', 'some_other_option' ); */
    }
    
    function j_settings_page() {
    	?>
    <div class="wrap">
    <h2>J connection options</h2>
    
    <form method="post" action="options.php">
        <?php settings_fields( 'j-settings-group' ); ?>
        <?php //do_settings( 'j-settings-group' ); ?>
        <table class="form-table">
            <tr valign="top">
            <th scope="row">Enable Achievements</th>
            <td><input type="text" name="enable_achievement_on_group" value="<?php echo get_option('enable_achievement_on_group'); ?>" /></td>
            </tr>
    
        </table>
    
        <?php submit_button(); ?>
    
    </form>
    </div>
    <?php }
    
    /**
     * Implements the group_review_add_rating action for BuddyPress
     *
     * @since 2.0
     */
    function dpa_handle_action_group_review_add_rating() { $func_get_args = func_get_args(); dpa_handle_action( 'group_review_add_rating', $func_get_args ); } ?>
  4. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Ah, that looks like it's for the old 2.x versions of the plugin. When I get some time in the next few days, I'll pull apart the relevant bits of this, and put a quick/untested version up here for you.

  5. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Haven't gotten to this, probably won't until after Christmas now. Best to email me if you need help with this still.

  6. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Old thread, but look at http://achievementsapp.com/developers/adding-other-plugins/ if you still need help supporting a custom action in the current version of Achievements.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Achievements for WordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic