integration with myCRED
-
Hi,
how call the field?
I use
$form_id == 2 && isset( $_POST[143]
the form is correct but the field don’t work.
code bellow–
the Field Options (ID 143)
Field Type – Number
Field Key – kdl8ew
–add_action( ‘frm_after_create_entry’, ‘mycred_charge_for_form_submission’, 30, 2 );
function mycred_charge_for_form_submission( $entry_id, $form_id ) {
// Start by making sure myCRED is enabled
if ( ! function_exists( ‘mycred_add’ ) ) return;// Apply to a specific form only (with ID 1)
if ( $form_id == 2 && isset( $_POST[143] ) ) {// First you would need to define in your form
// how much to give or take for submitting this form
$pack = $_POST[143];// If you do not want to charge or add points, you could
// set this value to zero.
if ( $pack == 0 ) return;// Next get the user ID. If the user is not logged in
// myCRED will going to be able to award points
$user_id = get_current_user_id();
if ( $user_id == 0 ) return;// If the value is positive add points
if ( $pack > 0 )
mycred_add(
‘form_submission’, // required reference
$user_id, // the user to give poitns to
$pack, // amount
$pack*15, // log entry
$form_id // save the form id
);
}
}
- The topic ‘integration with myCRED’ is closed to new replies.