• Resolved eengert

    (@eengert)


    I’m developing a golf league website. I’m currently trying to use Paid Memberships Pro to handle memberships. I also need to record hole-by-hole scores for each player, so I’m testing out SportsPress to see if it will work for our needs. I’m trying to develop an integration so that a SportsPress player will be created when a user registers for membership. Paid Memberships Pro doesn’t use the standard WP user registration form, so I need to create the integration myself.

    What I think I want to do is call the user_register() function in your sportspress/modules/sportspress-user-registration.php file. I’ve added the following code in my functions.php file, but it isn’t working:

    // Create SportsPress player profile linked to user account
    function add_sportpress_player( $user_id ) {
    do_action (‘user_register’, $user_id);
    return;
    };

    // add the action
    add_action( ‘pmpro_after_checkout’, ‘add_sportpress_player’, 10, 1 );

    Can you offer any suggestions? If I can get this working, I will be purchasing a SportsPress Pro license.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter eengert

    (@eengert)

    I got my code working to add a player as part of membership registration. Now I’m trying to write the code to assign a default league and season to the player.

    What I have currently isn’t working:

    $main_league = get_term( get_option(‘sportspress_league’) )->name;
    $current_season = get_term( get_option(‘sportspress_season’) )->name;

    update_post_meta( $id, ‘sp_league’, $main_league );
    update_post_meta( $id, ‘sp_season’, $current_season );

    Any ideas?

    Plugin Contributor Savvas

    (@savvasha)

    Hi @eengert ,

    sp_league and sp_season are not post_meta. Those fields are terms, so you need to use the wp_set_object_terms function instead.

    Do you mind to share the whole solution after you finally configure it? It will help a lot other users with similar requests ??

    Thanks,
    Savvas

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Auto-create player when registering via Paid Memberships Pro’ is closed to new replies.