/** * Capture user login and add it as timestamp in user meta data * */ function user_last_login( $user_login, $user ) { update_user_meta( $user->ID, ‘last_login’, time() ); } add_action( ‘wp_login’, ‘user_last_login’, 10, 2 ); /** * Display last login time…Continue reading
define(‘MEMBER_REGISTRATION_FORM_KEY’, ‘member-registration’); define(‘MEMBER_REGISTRATION_FORM_ID’, FrmForm::get_id_by_key(MEMBER_REGISTRATION_FORM_KEY)); define(‘MEMBER_REGISTRATION_EMAIL_PRIMARY_FIELD_KEY’, MEMBER_REGISTRATION_FORM_KEY . ‘_email_primary’); define(‘MEMBER_REGISTRATION_EMAIL_PRIMARY_FIELD_ID’, FrmField::get_id_by_key(MEMBER_REGISTRATION_EMAIL_PRIMARY_FIELD_KEY)); define(‘MEMBER_REGISTRATION_EMAIL_SECONDARY_FIELD_KEY’, MEMBER_REGISTRATION_FORM_KEY . ‘_email_secondary’); define(‘MEMBER_REGISTRATION_EMAIL_SECONDARY_FIELD_ID’, FrmField::get_id_by_key(MEMBER_REGISTRATION_EMAIL_SECONDARY_FIELD_KEY)); define(‘MEMBER_REGISTRATION_USER_ID_FIELD_KEY’, MEMBER_REGISTRATION_FORM_KEY . ‘_user_id’); define(‘MEMBER_REGISTRATION_USER_ID_FIELD_ID’, FrmField::get_id_by_key(MEMBER_REGISTRATION_USER_ID_FIELD_KEY)); define(‘MEMBER_REGISTRATION_USER_NAME_FIELD_KEY’, MEMBER_REGISTRATION_FORM_KEY . ‘_user_name’); define(‘MEMBER_REGISTRATION_USER_NAME_FIELD_ID’, FrmField::get_id_by_key(MEMBER_REGISTRATION_USER_NAME_FIELD_KEY)); define(‘MEMBER_REGISTRATION_PASSWORD_FIELD_KEY’, MEMBER_REGISTRATION_FORM_KEY . ‘_password’); define(‘MEMBER_REGISTRATION_PASSWORD_FIELD_ID’, FrmField::get_id_by_key(MEMBER_REGISTRATION_PASSWORD_FIELD_KEY)); define(‘MEMBER_REGISTRATION_MEMBER_NAME_FIELD_KEY’, MEMBER_REGISTRATION_FORM_KEY . ‘_member_name_primary’); define(‘MEMBER_REGISTRATION_MEMBER_NAME_FIELD_ID’, FrmField::get_id_by_key(MEMBER_REGISTRATION_MEMBER_NAME_FIELD_KEY));…Continue reading
/** * Name: fw_afterNewMemberCreate (“fw” indicates “FreeWheelers”) * Desc: After creating (importing) a member, set values * 1. Creates a WP user if it doesn’t exist (which it won’t in the case of an import) * 2. Sets the WordPress…Continue reading
/** * Name: fw_setNightlyPrices * Desc: Sets up the registration site prices checkboxes **/ add_filter(‘frm_setup_new_fields_vars’, ‘fw_setNightlyPrices’, 20, 2); function fw_setNightlyPrices($values, $field) { if ($field->id == RALLY_REGISTRATION_NIGHTS_AND_PRICES_SITE_1_FIELD_ID) { $rally_registration_data_entry_key = $_GET[“event_entry_key”]; $rally_event_data_entry = FrmEntry::getOne(FrmEntry::get_id_by_key($rally_registration_data_entry_key), true); $prices = array(); for($site=1;$sitemetas[FrmField::get_id_by_key($field_key)] : 0;…Continue reading
/** * Changes the labels of a lookup field’s checkbox options to their values. * * This filter is specific to the Formidable Forms plugin and targets * the options of a lookup field before they are displayed. * *…Continue reading
add_action(‘frm_after_create_entry’, ‘fw_afterGetUsernameRequest’, 30, 2); function fw_afterGetUsernameRequest($entry_id, $form_id) { if ($form_id == GET_USERNAME_FORM_ID) { $email = FrmEntryMeta::get_entry_meta_by_field($entry_id, GET_USERNAME_EMAIL_FIELD_ID); global $wpdb; $prefix = $wpdb->prefix; $sql = “SELECT item_id FROM {$prefix}frm_item_metas WHERE meta_value=%s AND (field_id=%d OR field_id=%d)”; error_log(“fw_afterGetUsernameRequest email: $email”); error_log(“fw_afterGetUsernameRequest sql: $sql”);…Continue reading
//add the Entry ID for each rally form to a number field in the form add_action(‘frm_after_create_entry’, ‘frm_add_entry_id_f946’, 42, 2); function frm_add_entry_id_f946 ($entry_id, $form_id){ if ( $form_id == 30 ) { //change 30 to the ID of your form FrmEntryMeta::add_entry_meta( $entry_id,…Continue reading
//add the Entry KEY for each rally form to a text field in the form add_action( ‘frm_after_create_entry’, ‘frm_add_entry_id_f947’, 42, 2 ); function frm_add_entry_id_f947 ( $entry_id, $form_id ) { if ( $form_id == 30 ) { //change 30 to the ID…Continue reading
/** * Name: getProfilePicture * Desc: If the profile picture exists in the entry, user it. Otherwise use the Gravatar (which may be the default) * **/ add_shortcode(‘fw-get-profile-image’, ‘fw_getProfileImage’); function fw_getProfileImage($atts) { $entry_id = $atts[“entry_id”]; $entry = FrmEntry::getOne($entry_id, true); $primary…Continue reading
add_filter( ‘frm_setup_edit_fields_vars’, ‘fw_checkPhoneValue’, 20, 3 ); function fw_checkPhoneValue( $values, $field, $entry_id ) { //echo “fieldid: ” . $field->id . ““; if ( $field->id == MEMBER_REGISTRATION_PHONE_PRIMARY_FIELD_ID ) { print_r($values); $phone2 = FrmEntryMeta::get_entry_meta_by_field( $entry_id, MEMBER_REGISTRATION_PHONE_PRIMARY_FIELD_ID); echo “Phone2: $phone2“; } return $values; }Continue reading