Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Shahjahan Jewel techjewel

🎯
Focusing
View GitHub Profile
View get_tag_id_from_slug_fluentcrm.php
<?php
function myFluentCrmTagIdBySlug($slug) {
$tag = \FluentCrm\App\Models\Tag::where('slug', $slug)->first();
if($tag) {
$tagId = $tag->id;
}
View fluentcrm-redirect-after-confirmation.php
<?php
add_action('fluentcrm_confirmation_head', function ($subscriber) {
$redirectUrl = 'https://google.com'; // Change this url;
echo '<meta http-equiv="refresh" content="0; URL='.$redirectUrl.'" />';
});
View custom_background_queue_process.php
<?php
/*
* Function to push a task for background processing
* @param: string $callbackName - Your classback acction name
* @param: mixed $payload - Your payload data that you will get when procssing on callback
*/
function my_custom_queue_on_background($callbackName, $payload)
{
@techjewel
techjewel / fluencrm-contact-status-change.php
Last active Jun 14, 2021
FluentCRM update contact status programatically
View fluencrm-contact-status-change.php
<?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);
@techjewel
techjewel / fluentcrm-postmark-support.php
Created May 3, 2021
Postmark SMTP header support for FluentCRM Emails
View fluentcrm-postmark-support.php
<?php
/*
* Postmark SMTP header support for FluentCRM Emails
*/
add_filter('fluentcrm_email_headers', function ($headers) {
$headers[] = 'X-PM-Message-Stream: broadcasts';
return $headers;
});
View new_form_submission_smartcode.php
<?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';
@techjewel
techjewel / protect_login_for_admin_roles.php
Last active Oct 28, 2021
Code snippet to reject login for admin/authors from the regular login url
View protect_login_for_admin_roles.php
<?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
*
*/
View custom_date_smartcode.php
<?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');
});
View dynamic_smartcode_in_fluentforms.php
<?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'];
@techjewel
techjewel / fluentform-summary-email-hooks.php
Created Mar 1, 2021
Fluent Forms Summary Email Text Change
View fluentform-summary-email-hooks.php
<?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';