Skip to content

Instantly share code, notes, and snippets.

@ben-wright
ben-wright / gist:932aa80a2bf671d462b1533dba52827e
Created November 16, 2020 16:34
ACF Gravity Form Field Support for WPGraphQL
add_filter(
'wpgraphql_acf_register_graphql_field',
function ($field_config, $type_name, $field_name, $config) {
if (isset($config['acf_field']['type']) && 'forms' === $config['acf_field']['type']) {
$field_config['type'] = 'GravityFormsForm';
$field_config['resolve'] = function ($root, $args, $context, $info) {
$formRaw = GFAPI::get_form($root['field_5f90411866d06']); // ACF gravity form field ID here
$fieldManipulator = new WPGraphQLGravityForms\DataManipulators\FieldsDataManipulator($formRaw['fields']);
$formManipulator = new WPGraphQLGravityForms\DataManipulators\FormDataManipulator($fieldManipulator);
$formattedData = $formManipulator->manipulate($formRaw);
@ChrisDubuche
ChrisDubuche / DubucheLEAPSoftwareEngineerResume
Created May 13, 2018 23:18
DubucheLEAPSoftwareEngineerResume
#CHRISTIAN DUBUCHE
####[email protected] | bit.ly/cdubuche | github.com/ChrisDubuche | 516.967.9472
###SUMMARY
Software developer, possessing the skills, passion, and creativity to building scalable solutions to complex problems. I am intuitive and resourceful, with the interpersonal skills to collaborate and communicate with both technical and non-technical audiences.
###DEVELOPMENT EXPERIENCE
@Idealien
Idealien / functions.php
Created January 28, 2018 22:09
GFlow - Specific User Assignment
<?php
add_filter( "gravityflow_user_field", "gflow_request_manager", 10, 3 );
function gflow_request_manager( $choices, $form_id, $field ) {
if ( $form_id == 1 && $field->id == 15 ) {
$manager = get_user_by('email', get_user_meta(get_current_user_id(), "manager_email", true) );
if( false !== $manager ) {
$choices = array(
array('value' => $manager->ID, 'text' => $manager->first_name . ' ' . $manager->last_name)
@schmolzp
schmolzp / mailchimp_form_parse.js
Created February 14, 2017 19:15
MailChimp Form Parse
// Parse parameters in URL
$.urlParam = function(name){
var results = new RegExp(&apos;[\?&amp;]&apos; + name + &apos;=([^&amp;#]*)&apos;).exec(window.location.href);
var checkNull = results == null ? '' : results[1] || 0;
return checkNull;
}
// Create hidden input elems and add them to form
function addFormElem(paramName, fieldName) {
@stevenslack
stevenslack / wc-membership-object-ids-by-post.php
Last active July 19, 2018 22:10
Get the term IDs associated with the choosen membership levels assigned to a post or page. Only returns taxonomy terms.
<?php
/**
* Get the page/post IDs or taxonomy term IDs for restricted content
* for chosen WooCommerce Memberships levels which have been assigned to a post or page.
*
* @param string $content_type | accepts either 'taxonomy' or 'post_type' object keys
* @param int $post_id The ID of the post or page
* @return array post/pageID's or taxonomy term ID's
*/
function wc_get_membership_term_ids( $content_type, $post_id ) {