Jump to content

tvjpblogs

New Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by tvjpblogs

  1. Thank you so much for your help maxxd! I will go there and see what I can find.
  2. Okay, so I've fixed line breaks, and all is formatted and populating as it should be, thanks to your assistance. The only thing left, or shall I say the last piece of this puzzle is making this information send along with the form. Do you know if this is possible with another hook to include this data in the email that is sent when the user presses send?
  3. Thank you, thank you, and thank you!!!! I caught the error. had an extra closing tag where none was needed. Changed to code below: add_action('ninja_forms_display_fields', 'thisIsMyFunction', 0, 10); function thisIsMyFunction($formID){ //do whatever you need to do, using $formID global $current_user; get_currentuserinfo(); echo $current_user->display_name . "\n"; echo $current_user->pmpro_baddress1 . " "; echo $current_user->pmpro_baddress2 . "\n"; echo $current_user->pmpro_bcity . ", "; echo $current_user->pmpro_bstate . " "; echo $current_user->pmpro_bzipcode . "\n"; echo $current_user->user_email . "\n"; echo 'Social Security Number: ' . $current_user->SSN. "\n"; }; This works and is displaying the information needed. Just need to format it as it is not honoring the line breaks
  4. Running the code above gives an error: Parse error: syntax error, unexpected end of file in /home/cpcportal/public_html/wp-content/themes/life-credit-debt-rn-child-theme/functions.php on line 51 I know I'm making novice mistakes. But hopefully it's very simple to correct.
  5. Many thanks, you are really helping clarify! I've added the call to ninja forms in a child theme functions.php file Not sure what you mean though by //do whatever you need to do, using $formID. Is this where I would place my code, and does $formID need to be defined? add_action('ninja_forms_display_fields', 'thisIsMyFunction', 0, 10); function thisIsMyFunction($formID){ //do whatever you need to do, using $formID global $current_user; get_currentuserinfo(); echo $current_user->display_name . "\n"; echo $current_user->pmpro_baddress1 . " "; echo $current_user->pmpro_baddress2 . "\n"; echo $current_user->pmpro_bcity . ", "; echo $current_user->pmpro_bstate . " "; echo $current_user->pmpro_bzipcode . "\n"; echo $current_user->user_email . "\n"; echo 'Social Security Number: ' . $current_user->SSN. "\n"; ?> };
  6. Thank you both! Truthfully just learning how to use hooks. My design experience has been more focused on visual design than code, but I can code and interpret code enough to get by. Please forgive if this sounds like an amateur question, but how would I use ninja_forms_display_fields to display user metadata as text within the message body? It looks interesting upon research, but can't figure out how and where to use it.
  7. Hi! I'm trying to display user metadata in the message body of a ninja contact form in a wordpress website. I'm using a php file called ninjacss.php that is being imported by the options of the theme I am using. It's supposed to grab the user metadata, and display the values within the wordpress page the ninja form generates so the information can be auto generated and sent along with the other fields that the user must fill in. I can place simple php in a post or page and it works and shows me what I want, but I can't place php code to my knowledge in a ninja contact form so I decided to see if declaring a special css class that adds content to the message module would be a proper workaround. In theory it works as I can use the css class to add content that is plain text, but when trying to dynamically populate the data using php, it gets a little tricky. The code is as follows: <?php /*** set the content type header ***/ header("Content-type: text/css"); ?> .ninjaphptest:before { content: "<?php global $current_user; get_currentuserinfo(); echo $current_user->display_name . "\n"; echo $current_user->pmpro_baddress1 . " "; echo $current_user->pmpro_baddress2 . "\n"; echo $current_user->pmpro_bcity . ", "; echo $current_user->pmpro_bstate . " "; echo $current_user->pmpro_bzipcode . "\n"; echo $current_user->user_email . "\n"; echo 'Social Security Number: ' . $current_user->SSN. "\n"; ?>" ; } The code above does absolutely nothing. To test if the file is being referenced correctly I changed it to something with a simple variable like below: <?php /*** set the content type header ***/ header("Content-type: text/css"); $current_user = "testing 1 2 testing 1 2"; ?> .ninjaphptest:before { content: "<?php echo $current_user; ?>" ; } This displays the desired testing result of "testing 1 2 testing 1 2" This signifies that the ninjacss.php file is being referenced, php is being recognized in that file through the wordpress setup, and that there is definitely something wrong in the previous code. Looking for answers and/or direction as to how to go about getting this to work. If you're up for this challenge(at least to this php novice) please reply. Any feedback/guidance is greatly appreciated. Thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.