Title: Player Round Registration
Last modified: May 5, 2022

---

# Player Round Registration

 *  Resolved [rmarreiros](https://wordpress.org/support/users/rmarreiros/)
 * (@rmarreiros)
 * [4 years ago](https://wordpress.org/support/topic/player-round-registration/)
 * Hello, I want to know how can I add a button to players register for each game/
   round.
    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Roch](https://wordpress.org/support/users/rochesterj/)
 * (@rochesterj)
 * [4 years ago](https://wordpress.org/support/topic/player-round-registration/#post-15618460)
 * Hi there!
 * Thanks for reaching out.
 * We don’t have this option, unfortunately.
 * You’ll need some custom code or a plugin such as gravity forms to help you with
   that.
 * Thanks!
 *  Thread Starter [rmarreiros](https://wordpress.org/support/users/rmarreiros/)
 * (@rmarreiros)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15659688)
 * Hello, I install gravity forms. What is the meta_key/custom field key to put 
   this working? I have tried sp_players but it doesnt do nothing.. What is the 
   custom code that I need? Thanks!
 *  [Roch](https://wordpress.org/support/users/rochesterj/)
 * (@rochesterj)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15663653)
 * Hi there!
 * Unfortunately, since we don’t have this function, we don’t have instructions 
   on how to do it. The plugin was just a suggestion, and their support team can
   help you with the setup.
 * Otherwise, you can hire a developer to create the custom code for you.
 * Thanks!
 *  Thread Starter [rmarreiros](https://wordpress.org/support/users/rmarreiros/)
 * (@rmarreiros)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15756033)
 * This is part of my code, its working if players insert their Player ID.
 *  $postid=get_the_ID();
    $wpdb->insert( “wp_postmeta”, array( “meta_id”=>null,“
   post_id”=>$postid, “meta_key”=>”sp_team”, “meta_value”=>$playerid ) );
 * How can I get the player ID created by logged in user? Any suggetions?
    Thanks.
 *  [Roch](https://wordpress.org/support/users/rochesterj/)
 * (@rochesterj)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15757832)
 * Hi there!
 * It depends on how your code is run, but maybe something like this:
    [https://developer.wordpress.org/reference/functions/get_current_user_id/](https://developer.wordpress.org/reference/functions/get_current_user_id/)
   [https://stackoverflow.com/questions/35733882/how-to-use-get-current-user-id-in-wordpress](https://stackoverflow.com/questions/35733882/how-to-use-get-current-user-id-in-wordpress)
   [https://rudrastyh.com/wordpress/get-user-id.html](https://rudrastyh.com/wordpress/get-user-id.html)
 * Thanks!
 *  Thread Starter [rmarreiros](https://wordpress.org/support/users/rmarreiros/)
 * (@rmarreiros)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15757958)
 * I may have explained myself badly.
    Here’s the thing, on my site there are several
   events and each user can create their player profile and I wanted to put a button
   on each event page for players to register as players. What I need to know is
   how to get the post id created by the logged in user, the user id I know but 
   I needed the id of the post that this user created. Because all users will create
   a post of type “sp_player”
 * Thanks
    -  This reply was modified 3 years, 11 months ago by [rmarreiros](https://wordpress.org/support/users/rmarreiros/).
 *  Thread Starter [rmarreiros](https://wordpress.org/support/users/rmarreiros/)
 * (@rmarreiros)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15760006)
 * My problem is solved.
    There is part of the code to add player registration for
   each event if anyone needs.
 *     ```
              $user_id = get_current_user_id();
               $postid=get_the_ID();
               $args = array(
                   'post_type' => 'sp_player',
                   'author' => $user_id,
                   'post_status' => 'publish'
                 );
   
                 /* Using WP_Query */
                 $my_query = new WP_Query( $args );
                 if ( $my_query->have_posts() ) :
                   while ( $my_query->have_posts() ) : $my_query->the_post();
   
                     $sp_player_id = get_the_ID(); /* We get ID here */
   
               $wpdb->insert(
                   "wp_postmeta",
                   array(
                       "meta_id"=>null,
                       "post_id"=>$postid,
                       "meta_key"=>"sp_team",
                       "meta_value"=>$sp_player_id
                   )
               );
               $wpdb->insert(
                   "wp_postmeta",
                   array(
                       "meta_id"=>null,
                       "post_id"=>$postid,
                       "meta_key"=>"sp_player",
                       "meta_value"=>$sp_player_id
                   )
               );
               endwhile;
               endif; 
               wp_reset_postdata();
       ```
   
 * Thanks
    -  This reply was modified 3 years, 11 months ago by [rmarreiros](https://wordpress.org/support/users/rmarreiros/).
 *  [Roch](https://wordpress.org/support/users/rochesterj/)
 * (@rochesterj)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15760845)
 * I’m glad it’s resolved!
 * Let us know if you need anything else.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Player Round Registration’ is closed to new replies.

 * ![](https://ps.w.org/sportspress/assets/icon-256x256.png?rev=1252005)
 * [SportsPress - Sports Club & League Manager](https://wordpress.org/plugins/sportspress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sportspress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sportspress/)
 * [Active Topics](https://wordpress.org/support/plugin/sportspress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sportspress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sportspress/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Roch](https://wordpress.org/support/users/rochesterj/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/player-round-registration/#post-15760845)
 * Status: resolved