Cool, Gabriel! Thank you very much!!!!
Do not apologize, maybe I have not expressed myself well …
I do not intend to take more of your time, just two more questions:
1 – I created a simple plugin with the code, but my Dreamweaver shows a syntax error at line 32 (” IS_PROFILE_PAGE = false;>?”), I delete this line and it worked perfectly! :D…
it will be missed?
2 – How can I do to pick just one custom point type for each form? For this function would be best just a text field, era instead of a dropdown (forgive me if the code already has this)
The complete plugin:
<?php
/*
Plugin Name: Mycred Manualy Points Addon in Gravity Entries
Plugin URI: https://myCRED.me
Description: Adiciona Campos personalizados no editor de solicita??o de pontos.
Version: 1.2
Author: Gabriel Merovingi (myCRED Creator)
Author URI: https://myCRED.me
*/
// Mycred custom points in Gravity entries editor
add_action( 'gform_entry_detail', 'adjust_mycred_balance_form', 10, 2 );
function adjust_mycred_balance_form( $form, $lead ) {
// Requiremens
if ( $form['id'] != 9 || ! class_exists( 'myCRED_Admin' ) || ! current_user_can( 'edit_users' ) ) return;
// Load myCRED Admin Module
$mycred_admin = new myCRED_Admin();
// Get the user object
$user = get_userdata( absint( $lead['created_by'] ) );
if ( ! isset( $user->ID ) ) return;
// If form is submitted, process it now
if ( isset( $_POST['myCRED-manual-add-points'] ) )
$mycred_admin->adjust_points_manually( $user->ID );
// Hack for the adjust_users_balance() method
if ( ! defined( 'IS_PROFILE_PAGE' ) )
define( 'IS_PROFILE_PAGE', true );
elseif ( defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE === false )
?>
<table class="widefat fixed entry-detail-view" cellspacing="0">
<thead>
<tr>
<th style="background:#ebf2ff;" colspan="2"><h3>Adjust points for entry creator</h3></th>
</tr>
</thead>
<tbody>
<?php $mycred_admin->adjust_users_balance( $user ); ?>
</tbody>
</table>
<?php
}
As a thank you, I’m sending the translation into Brazilian Portuguese of your plugin:
https://drive.google.com/folderview?id=0B6kRZI7KJFgxTzlFaVkxTWxwazA&usp=sharing
I will soon translate the addons and also send you.