Skip to content

Instantly share code, notes, and snippets.

View vfontjr's full-sized avatar

Victor M. Font Jr. vfontjr

View GitHub Profile
<script>
jQuery(document).ready(function($) {
"use strict";
// populate primary contact name and email from registration credentials
$("#field_devdir_copy_name_and_email").on("change", function() {
if ( $(this).prop('checked') ) {
bindCurrent();
} else {
unbindCurrent();
<?php
/* use the frm_display_entry_content filter hook to conditionally display the relationship form for
* adding a new relationship record or relationship view for editing the relationship in place in the
* media contacts view
*/
add_filter('frm_display_entry_content', 'media_contact_relationships', 20, 7);
function media_contact_relationships($new_content, $entry, $shortcodes, $display, $show, $odd, $atts) {
if ( $display->ID == 14318 ) {
$results = masterminds_check_relationships( $entry->id );
<?php
function remove_divi_shortcodes( $content ) {
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
return $content;
}
<?php
//* Append directives to the virtual robots.txt
//* Siteground adds crawl-delay: 10 to robots.txt. Don't use physical robots.txt on SiteGround
add_filter( 'robots_txt', 'robots_mod', 10, 2 );
function robots_mod( $output, $public ) {
$output .= "Sitemap: https://victorfont.com/sitemap_index.xml";
return $output;
}
<script>
jQuery(document).ready(function ($) {
"use strict";
/* conditions to trigger show or hide checkboxes:
* 1. if current value is checked in this row, do nothing
* 2. if current value is checked in previous row, hide value in this row
* 3. if current value is checked in future row, hide value in this row
* 4. if current value is unchecked in this row, is it hidden because it was checked in another row? If so, is it now unchecked in the other row, then show it.
* 5. if user removes row, all checked boxes in that row need to be shown again in all remaining rows.
<?php
add_action('frm_after_update_entry', 'update_user_role', 10, 2);
function update_user_role($entry_id, $form_id){
if ( $form_id == 4 ) {
$userid = $_POST['item_meta'][15];// ID of the userID field
$role = $_POST['item_meta'][19];// ID of the role field
if ( $userid && $role ) {
<div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]">
<div id="field_[key]_label" class="frm_primary_label">[field_name]
<span class="frm_required" aria-hidden="true">[required_label]</span>
</div>
<div class="frm_opt_container" aria-labelledby="field_[key]_label" role="group">
<div class="flex-display" data-target="#field_[key]-0">
<div class="image-icon"><i class="fal fa-weight"></i></div>
[input opt=1]
</div>
<div class="flex-display" data-target="#field_[key]-1">
<?php
$("#field_phone_number").on('change', function() {
$("#field_stripped_phone_number").val( $(this).val().replace(/[^\d+]/g, '') );
});
<?php
apply_filters( 'frm_currencies', 'add_currency' );
function add_currency( $currencies ) {
/* this adds the Eastern Caribbean dollar to Formidable's currency list */
$currencies['XCD']= array(
'name' => __( 'Eastern Caribbean dollar', 'formidable-pro' ),
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => ' ',
<?php
add_action( 'frmreg_after_create_user', 'do_custom_action_after_registration', 10, 2 );
function do_custom_action_after_registration( $user_id, $args ) {
if ( $args['entry']->form_id == 32 ) {// Replace 32 with your form ID
$entry_id = $args['entry']->id;
$field_id = 805;
$current_value = FrmEntryMeta::get_entry_meta_by_field( $entry_id, $field_id );
if( is_null($current_value) ) {
$added = FrmEntryMeta::add_entry_meta( $entry_id, $field_id, null, $user_id );