Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.
Forgot Password?
Navigation

Concerning register.php in Fusion8

Last updated on 3 years ago
G
GrimlochSenior Member
Posted 3 years ago
I need help with this. When a new user registers: code from register.php
 if (dbrows($result) > 0) {
 add_to_title($locale['global_200'].$locale['u155']);

 $data = dbarray($result);
 -----------------> $user_info = unserialize(base64_decode(($data['user_info']))); <------------------

 $result = dbquery("INSERT INTO ".DB_USERS." (".$user_info['user_field_fields'].") VALUES (".$user_info['user_field_inputs'].")");
 $result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['code']."' LIMIT 1");

 opentable($locale['u155']);
 if ($settings['admin_activation'] == "1") {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u162']."<br /><br />n</div>n";
 } else {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u161']."<br /><br />n</div>n";
 }
------------------------> include BASEDIR."welcome_letter.php"; <-------------------
 closetable();
 } else {
 redirect("index.php");
 }

I have annotated the info in question. I need to know if it's possible and proper to do this in my welcome_letter.php script:
   $to_email = $user_info['user_email'];
   $to_name = $user_info['user_name'];

After the user receives the notice that they are now registered and can login I want to send them a welcome letter.
Energy can neither be created nor destroyed; only transformed !
Edited by Chan on 09-02-2023 06:40, 3 years ago
M
MathiasHUJunior Member
Posted 3 years ago
G
GrimlochSenior Member
Posted 3 years ago
Maybe I'll take a look at it and see if I can use any of it. But I'm on Fusion8.
G
GrimlochSenior Member
Posted 3 years ago
That doesn't help me a bit. Thanks for trying.
G
GrimlochSenior Member
Posted 3 years ago
Still trying. Please tell me what is wrong with this code I added in register.php:
 if (dbrows($result) > 0) {
 add_to_title($locale['global_200'].$locale['u155']);
 $data = dbarray($result);
 $user_info = unserialize(base64_decode(($data['user_info'])));
 $result = dbquery("INSERT INTO ".DB_USERS." (".$user_info['user_field_fields'].") VALUES (".$user_info['user_field_inputs'].")");
    $lastid = db_lastid();
 $result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['code']."' LIMIT 1");
opentable($locale['u155']);
 if ($settings['admin_activation'] == "1") {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u162']."<br /><br />n</div>n";
 } else {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u161']."<br /><br />n</div>n";
   }
      $result = dbquery("SELECT user_name, user_email FROM ".DB_USERS." WHERE user_id = '".$lastid."'");
         while ($data = dbarray($result)) {
         $email = $data['user_email'];
         $name = $data['user_name'];
      include BASEDIR."welcome_letter.php";
   }
closetable();

And in the welcome_letter.php besides the html content I have this:
<?php
require_once INCLUDES."sendmail_include.php";
   $to_name = $name;
   $to_email = $email;
   $subject = "Letter of Welcome";
$content
   $message = $content;
   $from_name = "Tom Wills";
   $from_email = 'twills@ohs1962.org';

      sendemail($to_name, $to_email, $from_name, $from_email, $subject, $message, $type = "html", $cc = "", $bcc = "terry@whisperwillow.com");
?>
Edited by Grimloch on 07-02-2023 16:05, 3 years ago
C
ChanSuper Admin
Posted 3 years ago
What's in $user_info ? if it contains user name and user email you can use it without doing anything else.
I cannot see anything wrong without the array debug output except for the reliance of dblastid in the last query. We have also mentioned before that lastid is unreliable if server lags.
G
GrimlochSenior Member
Posted 3 years ago
The db_lastid (which is the way it is in ver8) works fine I tested it. It does grab the last username and email that was inserted from users table. The problem is it just refuses to send the email; no error codes in the log. I'm still plugging away at it but so far no luck.
G
GrimlochSenior Member
Posted 3 years ago
When I submit the registration it gives the proper message on the screen. But then when I click the link in the verification email that I get this is the result on the website. The email that I am trying to send never comes through.
Grimloch attached the following image:
Image not found
G
GrimlochSenior Member
Posted 3 years ago
I just do not understand why this won't work. I spent some time cleaning up and simplyfying the code. The end result is still the same (see image in previous post); user is validated and confirmed but no welcome email is sent. Here is the code now:
 if (dbrows($result) > 0) {
 add_to_title($locale['global_200'].$locale['u155']);
 $data = dbarray($result);
 $user_info = unserialize(base64_decode(($data['user_info'])));
 $result = dbquery("INSERT INTO ".DB_USERS." (".$user_info['user_field_fields'].") VALUES (".$user_info['user_field_inputs'].")");
         $lastid = db_lastid();
 $result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['code']."' LIMIT 1");
opentable($locale['u155']);
 if ($settings['admin_activation'] == "1") {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u162']."<br /><br />n</div>n";
 } else {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u161']."<br /><br />n</div>n";
   }
// New coding to send welcome letter
      $result = dbquery("SELECT user_name, user_email FROM ".DB_USERS." WHERE user_id = '$lastid'");
         while ($data = dbarray($result)) {
         $email = $data['user_email'];
         $name = $data['user_name'];

require_once INCLUDES."sendmail_include.php";

      $to_name = $name;
      $to_email = $email;
      $from_name = "xxx xxxx";
      $from_email = "xxxx@xxxx";
      $subject = "Letter of Welcome";
      include "welcome_tpl.php";
      sendemail($to_name, $to_email, $from_name, $from_email, $subject, $message, $type = "html");
}
// End new welcome letter coding
closetable();

The 'welcome_tpl.php' is a non-image html template in the root folder from my newsletters infusion that I have used successfully for many years now. I do not suspect a problem there. Can someone please try to help me with this. It's the final step in making my friends closed membership alumni website complete. It would be greatly appreciated!
Energy can neither be created nor destroyed; only transformed !
Edited by Grimloch on 09-02-2023 14:52, 3 years ago
G
GrimlochSenior Member
Posted 3 years ago
Well my friends it now works like a charm! I have never been afraid of admitting when I am wrong and this time is no exception! I had multiple errors in my template file. No errors in Fusion and I discovered them by looking at the Host error log. Anyway this puppy can be put to bed!
M
MathiasHUJunior Member
Posted 3 years ago
Have you created a new user?
G
GrimlochSenior Member
Posted 3 years ago

MathiasHU wrote:

@MathiasHU - Have you created a new user?

Yes multiple times. It works perfectly.
G
GrimlochSenior Member
Posted 3 years ago
To anyone running a version 8 site. If you might be interested in doing this just PM me and I can supply you with all the details not shown here.
Energy can neither be created nor destroyed; only transformed !
M
MathiasHUJunior Member
Posted 3 years ago
It works, I get a welcome email

            // New coding to send welcome letter
 $result = dbquery("SELECT user_name, user_email FROM ".DB_USERS." WHERE user_id = '".$lastid."'");
 while ($data = dbarray($result)) {
 $email = $data['user_email'];
 $name = $data['user_name'];

require_once INCLUDES."sendmail_include.php";

 $to_name = $name;
 $to_email = $email;
 $from_name = $settings['siteusername'];
 $from_email = $settings['siteemail'];
 $subject = "Letter of Welcome ".$lastid."";
      $message = "Letter of Welcome test message";
 //include "welcome_tpl.php";

 sendemail($to_name, $to_email, $from_name, $from_email, $subject, $message, $type = "html");

}
// End new welcome letter coding
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
You cannot set up a bounty in this discussion thread.
Moderator: Support Team
Users who participated in discussion: Chan, Grimloch, MathiasHU