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 | |
function fcrmUpdateContactStatus($contactEmail, $newStatus) { | |
$contact = FluentCrmApi('contacts')->getContact($contactEmail); | |
if($contact) { | |
$oldStatus = $contact->status; | |
if($newStatus != $oldStatus) { | |
$contact->status = $newStatus; | |
$contact->save(); | |
do_action('fluentcrm_subscriber_status_to_' . $newStatus, $contact, $oldStatus); |
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 | |
/* | |
* Postmark SMTP header support for FluentCRM Emails | |
*/ | |
add_filter('fluentcrm_email_headers', function ($headers) { | |
$headers[] = 'X-PM-Message-Stream: broadcasts'; | |
return $headers; | |
}); |
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 | |
/* | |
* Fluent Forms Extra Smartcodes on form integration feeds | |
* This code will add a new item on the smartcode dropdown. | |
* if you don't want to show the smartcode then you may skip this. | |
*/ | |
add_filter('fluentform_form_settings_smartcodes', function ($groups) { | |
$groups[0]['shortcodes']['{my_custom_smartcode}'] = 'Custom All Data'; |
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 | |
/* | |
* Code snippet to reject login for admin/authors from the regular login url | |
* In this example, people who have edit_posts permission is require special url string to login | |
* The URL need to be: https://yourdomain.com/wp-login.php?salt=your_random_url_string | |
* For normal users they can login without the special salt | |
* But If author or admin try to login it will reject the authentication | |
* | |
*/ |
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 | |
/* | |
* Create custom smartcode for hidden field for the editor | |
* usage: {my_formatted_date_time} | |
* @return: current date time as d.m.Y H:i:s format | |
*/ | |
add_filter('fluentform_editor_shortcode_callback_my_formatted_date_time', function ($value) { | |
return date('d.m.Y H:i:s'); | |
}); |
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 | |
/* | |
* Smartcode callback for smartcode: {sondre_post_selection_meta} | |
*/ | |
add_filter('fluentform_shortcode_parser_callback_sondre_post_selection_meta', function ($returnValue, $instance) { | |
$userInputs = $instance::getInputs(); | |
// from $userInputs you can access what user have provided information | |
// if your post selection input name is cpt_selection then you can access the post id as | |
$selectedPostId = $userInputs['cpt_selection']; |
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 | |
// changing summary email body text | |
add_filter('fluentform_email_summary_body_text', function ($text) { | |
return 'Your own Email Body Text'; | |
}); | |
// changing email footer text | |
add_filter('fluentform_email_summary_footer_text', function ($text) { | |
return 'Powered by your agency'; |
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 a tag to a current logged in or cookie based contact | |
// getCurrentContact() method will find the contact from logged in info or from the cookie from email link click | |
// For more api doc: https://github.com/FluentCRM/fluent-crm/wiki/PHP-API | |
$contact = FluentCrmApi('contacts')->getCurrentContact(); | |
$tagsToAdd = [1,2]; | |
if($contact) { |
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 | |
/* | |
* Disable users REST endpoint for public or not author users users | |
* To access the endpoint the user must need to be contributor | |
* aka need to have edit_posts permission | |
*/ | |
add_filter( 'rest_endpoints', function ($endpoints) { | |
$endpoints_to_remove = array( | |
'/wp/v2/users' |
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 | |
/* | |
* Create a custom shortcode for email / confirmation or other after form submit | |
* Usage: {my_custom_shortcode} | |
* @param $value string original shortcode string | |
* @param $parser class \FluentForm\App\Services\FormBuilder\ShortCodeParser | |
*/ | |
add_filter('fluentform_shortcode_parser_callback_my_custom_shortcode', function ($value, $parser) { |