Simple Membership Plugin › Forums › Simple Membership Plugin › Prefill data into registration form
- This topic has 4 replies, 2 voices, and was last updated 8 years, 9 months ago by
francescospina.
-
AuthorPosts
-
August 21, 2017 at 10:42 am #11788
francescospina
ParticipantHi, i need to pre fill data into registration form.
I created this workflow:
- User insert name and email into my website in a form created with a marketing automation software
- I send him an email with a link to a page with simple membership form registration
Into mail message at point 2 i send him an email with a link like this: http://www.mysite.it/community/registrati/?email=name%40example.com&first_name=XXXXXXXX
where obviously name@example.com and XXXXXXXX are mail address and name of the user.
Then i edited “simple-membership/views/add.php” file into plugin editor like this:
<?php SimpleWpMembership::enqueue_validation_scripts(array('ajaxEmailCall' => array('extraData'=>'&action=swpm_validate_email&member_id='.filter_input(INPUT_GET, 'member_id')))); $email = isset($_GET["email"]) ? $_GET["email"] : ""; $first_name = isset($_GET["first_name"]) ? $_GET["first_name"] : ""; ?>the problem is that when i upgrade the plugin all new file overwrite my code 🙁
Is there a way to not lose my code or to add a code into plugin to prefill data?
I don’t need it but it could be useful for someone to add a prefill code for last name or username too 🙂
$email = isset($_GET[“email”]) ? $_GET[“email”] : “”;
$first_name = isset($_GET[“first_name”]) ? $_GET[“first_name”] : “”;
$last_name = isset($_GET[“last_name”]) ? $_GET[“last_name”] : “”;
$username = isset($_GET[“username”]) ? $_GET[“username”] : “”;August 22, 2017 at 4:28 am #11799mbrsolution
ModeratorHi, have you tried to use a child theme? You might be able to add those modified files in your child theme folders. Let me know if this works for you. I myself have not tried this yet.
Kind regards
August 22, 2017 at 9:25 am #11802francescospina
Participanthi mbrsolution, thank you for your answer!
I read about child theme and it is useful to edit theme css or functions not plugins 🙁
August 22, 2017 at 9:40 am #11803mbrsolution
ModeratorHi, yes that is correct. The function of child themes is to manage the themes customization. However in reality you can you do much more with child themes. I know of developers who have added to the child theme certain plugin files to avoid loosing the customize code when updating plugins. Like I mentioned above I have not tried this with our plugin. I just thought of sharing this possible solution with you.
Kind regards
August 22, 2017 at 9:48 am #11804francescospina
Participantok, I’ll try to create a child theme with plugin edited code and i’ll let you know 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.