• Resolved Jonathan

    (@luxman007)


    I have multiple roles on my site.

    Can SliceWP make users with a specific role an affiliate automatically? If not, is there a custom function or html button I can place on the site for only specific roles to then activate their affiliate status?

    Will the affiliate that referred them also properly be rewarded if the user activates their account later on? First affiliate counts is set within settings.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author iova.mihai

    (@iovamihai)

    Hey @luxman007,

    Thank you for reaching out! Can you please share more details on how the roles are applied to each user?

    Are the roles assigned at checkout, maybe after completing a form, are they assigned manually by you or another admin?

    Considering that we don’t have such a feature yet, please share as many details as you can about your setup and how you’d like everything to work. This could help me understand your particular scenario and if we could develop some custom code to help you out.

    Thank you and best wishes,

    Mihai

    Thread Starter Jonathan

    (@luxman007)

    The roles are given throughout the onboarding process. This way, users that don’t reach a certain role within a specific time get deleted or “cleaned” to prevent spam or fake emails.

    I had something similar with awp to convert a user based on a gravityform entry. Maybe apply something similar, when user completed # form then make affiliate?

    I can also create an entirely blank gravityforms form with just the submit button and make it visible to users with the specific role. Then clicking on it will simply activate their affiliate access. Could even apply to standard html button?

    *Separate question, when a user is deleted from WP, will they also be deleted as an affiliate? or must we manually delete them?

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @luxman007,

    Thank you for the extra details! Currently, we don’t have a direct integration with Gravity Forms to sign-up affiliates once they complete a form.

    Even so, I believe that I can help you out with some custom code if you can implement the empty form with just the submit button.

    I’m guessing that the user would be the one to click this button. If so, and if the user is logged into the website at the time they click the button, I can provide you a custom code snippet that will register their account as an affiliate.

    Let me know if this would work for you.

    Thank you and best wishes,

    Mihai

    Thread Starter Jonathan

    (@luxman007)

    Yes, custom html/submit button is perfectly fine!

    Thank you.

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @luxman007,

    I believe the following code should help:

    function slicewp_custom_register_affiliate( $entry, $form ) {
    	
    	if ( $form['id'] !== 123 ) {
    		return;
    	}
    
    	$affiliate = slicewp_get_affiliate_by_user_id( get_current_user_id() );
    	
    	if ( ! is_null( $affiliate ) ) {
    		return;
    	}
    	
    	$affiliate_data = array(
    		'user_id' 		=> get_current_user_id(),
    		'date_created'  => slicewp_mysql_gmdate(),
    		'date_modified' => slicewp_mysql_gmdate(),
    		'status'		=> 'active'
    	);
    	
    	$affiliate_id = slicewp_insert_affiliate( $affiliate_data );
    	
    	if ( $affiliate_id ) {
    		
    		do_action( 'slicewp_register_affiliate', $affiliate_id );
    		
    	}
    
    }
    add_action( 'gform_entry_created', 'slicewp_custom_register_affiliate', 10, 2 );

    The code will check for new entries from the form that has the ID 123 (please change the ID to the actual one from Gravity Forms).

    If the user is logged-in and is not registered as an affiliate, they will be added as an affiliate with the “active” status. If you wish to review each application, please change “active” to “pending” in the code.

    Also, please note that you may have data missing from their affiliate accounts (such as the payment email and reason for signing up for your affiliate program), considering that the form has no data.

    Alternatively, what you could also do, instead of adding this empty Gravity Forms form, you could add the affiliate registration form (described here: https://slicewp.com/docs/adding-affiliate-registration-page/) as the extra step after they complete the initial form you already have set up to filter them. I’m not sure if this makes sense, as I don’t know your setup, but you could try it to see how it works.

    Thank you and best wishes,

    Mihai

    Thread Starter Jonathan

    (@luxman007)

    Worked perfectly!!!

    Plugin Author iova.mihai

    (@iovamihai)

    Awesome! Happy to hear it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Auto or Manually Convert User to Affiliate When Specific Role?’ is closed to new replies.