emmytechs
Forum Replies Created
-
Wrote this snippet instead to solve the issue
function user_has_membership(){
$user_id = get_current_user_id(); $current_memberships = get_user_meta( $user_id, 'mfw_membership_id', true ); if ( ! empty( $current_memberships ) && is_array( $current_memberships ) ) { foreach ( $current_memberships as $key => $membership_id ) { $member_status = wps_membership_get_meta_data( $membership_id, 'member_status', true ); if ( ! empty( $member_status ) && 'complete' == $member_status) { return true; } } } return false; }
Kindly take a look. Thanks.
- This reply was modified 4 months, 2 weeks ago by emmytechs.
Thank you very much. All now works perfectly. I appreciate your effort ??
Thanks for your response, so I made a work around though might not be the best way and since I figured it gets the id from the cookies set on first load which is crucial to get the name of the referrer so I set the custom slug permanently to use id and not allow user the edit it then I added some code snippet to the one provided above.
function slicewp_custom_form_fields_add_referring_affiliate( $form ) {
if ( $form != 'affiliate_registration' ) {
return;
}
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'https://';
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$parsed_url = parse_url($url);
$path = $parsed_url['path'];
$segments = explode('/', trim($path, '/'));
$value = end($segments);
$affiliate_id_from_url = $value;
$affiliate_id = slicewp_get_referrer_affiliate_id();
$affiliate = slicewp_get_affiliate( ! empty( $affiliate_id_from_url ) ? $affiliate_id_from_url : 0 );
if ( is_null( $affiliate ) ) {
return;
}
$user = get_userdata( $affiliate->get( 'user_id' ) );
if ( empty( $user ) ) {
return;
}
echo '<p>You have been referred by: ' . $user->first_name . ' ' . $user->last_name . '</p>';
}
add_action( 'slicewp_form_fields', 'slicewp_custom_form_fields_add_referring_affiliate', 5 );Also made sure the
$affiliate_id = slicewp_get_referrer_affiliate_id();
still get called so as to take care of the cookies.Kindly help check if there is any security risk this might impose.
Thanks and I really appreciate the support and your effort as well. ??
Thank you very much for this. It now shows the user that their link was used but just a little thing I figured out which is when they first signup via the link the “Referred by….” doesn’t show unless they refresh the page then it comes up so want to ask if there’s any plugin or snippet I can use to fix this issue.
Thanks once again for your assistance. I really appreciate.
Thanks I really appreciate, It worked as expected.
Okay thanks I’ll do that