This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// SEND ACCESS LEVEL TO GRAVITY FORMS | |
function get_access_level(){ | |
global $user_ID; | |
$plan_id = rcp_get_subscription_id( $user_ID ); | |
$access_level = rcp_get_subscription_access_level( $plan_id ); | |
return $access_level; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gform_wrapper ul { | |
padding-left: 0; | |
list-style: none; } | |
.gform_wrapper li { | |
margin-bottom: 15px; } | |
.gform_wrapper form { | |
margin-bottom: 0; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field | |
* | |
* Usage | |
* | |
* 1 - Enable "Allow field to be populated dynamically" option on field which should be populated. | |
* 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this field. | |
* | |
* Basic Fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************************** | |
*** Gravity styles *** | |
****************************************************************************/ | |
/*Form Body | |
contains the main form content*/ | |
body .gform_wrapper .gform_body {border: 1px solid red} | |
/*Form List Container | |
unordered list used to structure all of the form elements*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Automatic Url + Content Dir/Url Detection for Wordpress | |
*/ | |
$document_root = rtrim(str_replace(array('/', '\\'), '/', $_SERVER['DOCUMENT_ROOT']), '/'); | |
$root_dir = str_replace(array('/', '\\'), '/', __DIR__); | |
$wp_dir = str_replace(array('/', '\\'), '/', __DIR__ . '/wp'); | |
$wp_content_dir = str_replace(array('/', '\\'), '/', __DIR__ . '/wp-content'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Multiple Roles per User | |
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful. | |
* Version: 1 | |
* Author: nikolov.tmw | |
* Author URI: http://paiyakdev.com/ | |
* License: GPL2 | |
*/ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Programmatically logs a user in | |
* | |
* @param string $username | |
* @return bool True if the login was successful; false if it wasn't | |
*/ | |
function programmatic_login( $username ) { | |
if ( is_user_logged_in() ) { | |
wp_logout(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('gform_after_submission', 'gfToAcfListToRepeater', 10, 2); | |
function gfToAcfListToRepeater($entry, $form) | |
{ | |
foreach ($form['fields'] as $field) { | |
if (!($field['type'] == 'post_custom_field' && $field['inputType'] == 'list' && $field['enableColumns'] == true)) { | |
continue; | |
} | |
$id = $field['id']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ACF | |
* リピーターリピーターフィールドでの一番はじめの画像をアイキャッチ画像にも設定する。 | |
**/ | |
function acf_set_featured_image( $value, $post_id, $field ){ | |
if( $value != ''){ | |
update_post_meta($post_id, '_thumbnail_id', $value); | |
} else { | |
delete_post_meta($post_id, '_thumbnail_id'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action("gform_after_submission_1", "acf_post_submission", 10, 2); | |
function acf_post_submission ($entry, $form) | |
{ | |
$post_id = $entry["post_id"]; | |
update_field('address1', $entry['29.1'], $post_id); | |
update_field('address2', $entry['29.2'], $post_id); | |
update_field('address3', $entry['29.3'], $post_id); | |
} |