Player Round Registration
-
Hello, I want to know how can I add a button to players register for each game/round.
Thanks.
-
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!
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!
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!
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.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://stackoverflow.com/questions/35733882/how-to-use-get-current-user-id-in-wordpress
https://rudrastyh.com/wordpress/get-user-id.htmlThanks!
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.
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.
I’m glad it’s resolved!
Let us know if you need anything else.
-
This reply was modified 3 years, 11 months ago by
The topic ‘Player Round Registration’ is closed to new replies.