is it anyway possible to find a home page at all, I would like to insert php code on it, from cms I do not know if it's possible, I watched some plugins, but they do not look good to me. thank you all for help
-
What exactly do you want to achieve? Just add some PHP to the home page, or to every page? Does it have to be at a specific position, or just executed in header or footer? – janh Oct 13 '17 at 7:30
-
I want the user after the registration (when he clicked the button to register) to send one xml containing his data. This xml code has variables in php and the data generated is sent directly to another server. I thought that after the registration I posted a home page, I think that I could put this php code on my home page? – srdjan_stojanovic Oct 13 '17 at 7:38
I think using the user_registration hook is probably the best fit for what you want to do.
An example from the docs:
add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
if ( isset( $_POST['first_name'] ) )
update_user_meta($user_id, 'first_name', $_POST['first_name']);
}
To be compliant with the WordPress way (and be less likely to get into trouble if you change servers), you should probably use WP's HTTP API to send the XML to the other URL.
-
thanks for the answer, can you tell me if I need to put this code on the page where I want to enter my xml call? – srdjan_stojanovic Oct 13 '17 at 7:56
-
-
can I use the same page (function.php) to insert my xml call?gist.github.com/anonymous/bd8ab3f2a17342a64a0205b53740de1a – srdjan_stojanovic Oct 13 '17 at 8:08
-
Yes, absolutely. Put it inside the function (e.g.
myplugin_registration_save
) that you add. Also note that it's functions.php (with an s at the end). function.php won't get executed automatically. – janh Oct 13 '17 at 8:16 -
Thank you so much for helping me, I set this code up, is that okay?gist.github.com/anonymous/3faf8328dd68dffab0b0a3d25bc6b71b – srdjan_stojanovic Oct 13 '17 at 8:45