rmarreiros
Forum Replies Created
-
Forum: Plugins
In reply to: [SportsPress - Sports Club & League Manager] Player Round RegistrationMy 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 2 years, 5 months ago by rmarreiros.
Forum: Plugins
In reply to: [SportsPress - Sports Club & League Manager] Player Round RegistrationI 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 2 years, 5 months ago by rmarreiros.
Forum: Plugins
In reply to: [SportsPress - Sports Club & League Manager] Player Round RegistrationThis 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.Forum: Plugins
In reply to: [SportsPress - Sports Club & League Manager] Player Round RegistrationHello, 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!