• Resolved sanumolu5

    (@sanumolu5)


    Hi,

    During the user registration process, we offer three subscription options: Free, 1-year, and 3-year. We’ve implemented Fluent Forms for all three subscription types. Now, we face the need to assign varying points based on the subscription type.

    I have used the Fluent Form action hook (“fluentform/submission_inserted”) to call the listeners of “3 distinct custom events” within Gamipress for each subscription type. But the listeners are not getting triggered. My code is as follows.

    function jkyog_registration_activity_triggers( $triggers ) {   
        $triggers['Registration JKYOG'] = array(     
            'jkyog_free_subscription_event' => __( 'Free Subscription', 'gamipress' ),
            'jkyog_one_year_subscription_event' => __( '1 Year Subscription', 'gamipress' ),
            'jkyog_three_years_subscription_event' => __( '3 Year Subscription', 'gamipress' )
        );
        return $triggers;
    }
    add_filter( 'gamipress_activity_triggers', 'jkyog_registration_activity_triggers' );
    
    function jkyog_free_subscription_listener( $args ) { 
        error_log(" inside jkyog FREE subscription LISTENER");
        gamipress_trigger_event( array(      
            'event' => 'jkyog_free_subscription_event',
            'user_id' => get_current_user_id()     
        ) );
    }
    
    function jkyog_one_year_subscription_listener( $args ) { 
        error_log(" inside jkyog 1 YEAR subscription LISTENER");
        gamipress_trigger_event( array(      
            'event' => 'jkyog_one_year_subscription_event',
            'user_id' => get_current_user_id()     
        ) );
    }
    
    function jkyog_three_years_subscription_listener( $args ) { 
        error_log(" inside jkyog 3 YEARS subscription LISTENER");
        gamipress_trigger_event( array(      
            'event' => 'jkyog_three_years_subscription_event',
            'user_id' => get_current_user_id()     
        ) );
    }
    
    add_action("fluentform/submission_inserted", "jky_membership_form_processor", 20, 3);
    
    /* Process JKYog Membership fluent forms
     * Reference: https://fluentforms.com/docs/fluentform_submission_inserted/
     */
    function jky_membership_form_processor($entryId, $formData, $form)
    {
        try {
     // Register Forms
            $registerFormIds = ["3", "4", "9", "10"];
    
            // Upgrade Forms
            $upgradeFormIds = ["5", "6", "7", "8"];
    
            // determine if current form is register form or upgrade form
            $isRegisterForm = in_array($form->id, $registerFormIds);
            $isUpgradeForm = in_array($form->id, $upgradeFormIds);
    
            if ($isRegisterForm || $isUpgradeForm) {
                error_log("In membership form processor registration/upgrade form");
                if($isRegisterForm) {  
                    error_log("register form");
                 do_action("jkyog_one_year_subscription_listener", $entryId, $formData, $form);   
                } else {
                    error_log("upgrade form");
                    do_action("jkyog_three_years_subscription_listener", $entryId, $formData, $form); 
                }          
    } elseif ($form->id == 11) {
                error_log("In membership form processor free subscription");
                do_action("jkyog_free_subscription_listener", $formData);   
    } else {
                error_log("Unrecognized form with form id: " . $form->id);
            }
        } catch (Exception $e) {
            error_log("Exception while processing membership registration: ".$e->getMessage());
        }
    }

    Can someone kindly help identify why the listeners are not triggering?

    • This topic was modified 1 year, 3 months ago by sanumolu5.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ruben Garcia

    (@rubengc)

    Hi @sanumolu5

    I am so sorry but we do not offer support for customizations like that since our main focus is the development and maintenance of GamiPress, AutomatorWP and all official add-ons.

    Anyway, any WordPress custom development agency or freelancer can handle it for you.

    If you do not know one, we recommend checking our list of trusted experts that can estimate any type of job for you here: https://gamipress.com/customizations/

    Also, there are docs for developers about how to create custom events:

    https://gamipress.com/snippets/tutorials/

    Hope it helps!

    Thread Starter sanumolu5

    (@sanumolu5)

    @rubengc

    I appreciate your explanation. Would it be possible for me to leave this discussion thread open? Given that this is a voluntary forum, there’s a chance that a skilled developer or tech enthusiast might take an interest in analyzing the issue within the provided code. Their assistance could prove invaluable in resolving the matter.

    Plugin Author Ruben Garcia

    (@rubengc)

    Of course @sanumolu5

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom event Listener not triggering’ is closed to new replies.