Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Paul Wong-Gibbs

    (@djpaul)

    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.

    Thread Starter Bookkus

    (@bookkus)

    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 ); } ?>
    Plugin Author Paul Wong-Gibbs

    (@djpaul)

    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.

    Plugin Author Paul Wong-Gibbs

    (@djpaul)

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

    Plugin Author Paul Wong-Gibbs

    (@djpaul)

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Paul’ is closed to new replies.