Vielleicht weiß HerrB ja Rat...wenn ich das dann soweit fertig habe veröffentliche ich es hier.
Also vielleicht zur Veranschaulichung was derzeit bei mir abläuft:
Ich habe aus dem gemeinschafts Modul von Uwe und HerrB mit den Persönlichen Daten im FEUser Profil und dem Anmeldescript hier eine Kombination gemacht:
Code: Alles auswählen
<?php
// Initialisation
cInclude('classes', 'class.template.php');
$properties = new PropertyCollection;
$arrSettings = array();
$arrSettings["JoinSel"] = $properties->getValue("clientsetting", $client, "newsletter", "joinsel");
$arrSettings["JoinMultiple"] = $properties->getValue("clientsetting", $client, "newsletter", "joinmultiple");
$arrSettings["JoinGroups"] = $properties->getValue("clientsetting", $client, "newsletter", "joingroups");
$arrSettings["OptNewWindow"] = "CMS_VALUE[4]";
$template = 'newsletter_form.html';
// See Input for comments
if ($arrSettings["JoinSel"] == "" || ($arrSettings["JoinSel"] == "UserSelected" && $arrSettings["JoinGroups"] == "")) {
$arrSettings["JoinSel"]= "Default";
}
if ($arrSettings["JoinMultiple"] == "enabled") {
$arrSettings["JoinMultiple"] = " multiple";
} else {
$arrSettings["JoinMultiple"] = "";
}
if (!is_object($tpl)) {
$tpl = new Template;
}
$tpl->reset();
$tpl->set('s', 'FORM_ACTION', 'front_content.php?changelang='.$lang.'&idcatart='.$properties->getValue("clientsetting", $client, "Newsletter", "idcatart"));
if ($arrSettings["OptNewWindow"]) {
$tpl->set('s', 'FORM_TARGET', ' target="_blank"');
} else {
$tpl->set('s', 'FORM_TARGET', '');
}
$tpl->set('s', 'EMAILNAME', mi18n("Name"));
if ($arrSettings["JoinSel"] == "UserSelected") {
cInclude("classes", "class.newsletter.groups.php");
$rgroups = new RecipientGroupCollection;
$rgroups->select("idclient = '$client' AND idlang = '$lang' AND defaultgroup = '0' AND idnewsgroup IN (".$arrSettings["JoinGroups"].")","", "groupname ASC");
if ($rgroups->Count() > 0) {
$tmp_groups = ' <tr>'.chr(10);
$tmp_groups .= ' <td><label for="groupsel" class="label_searchbox">'.mi18n("Select").'</label></td>'.chr(10);
$tmp_groups .= ' <td><select name="GroupSel[]" size="2" id="groupsel" style="margin-bottom:.4em;" class="input_searchbox" '.$arrSettings["JoinMultiple"].'/>'.chr(10);
while ($rgroup = $rgroups->next()) {
$tmp_groups .= ' <option value="'.$rgroup->get("idnewsgroup").'">'.$rgroup->get("groupname").'</option>'.chr(10);
}
$tmp_groups .= ' </select></td>'.chr(10);
$tmp_groups .= ' </tr>'.chr(10);
$tpl->set('s', 'GROUPS', $tmp_groups);
} else {
$tpl->set('s', 'GROUPS', '');
}
} else {
$tpl->set('s', 'GROUPS', '');
}
if (!is_object($oTpl)) {
$oTpl = new Template;
}
$oTpl->reset();
$tpl->set('s', 'MESSAGE', $sMessage);
$tpl->set('d', 'FIELDTITLE', mi18n("email"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'email');
$tpl->set('d', 'FIELDID', 'email');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["email"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Titel"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Titel');
$tpl->set('d', 'FIELDID', 'titel');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Titel"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Vorname"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Vorname');
$tpl->set('d', 'FIELDID', 'vorname');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Vorname"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Nachname"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Nachname');
$tpl->set('d', 'FIELDID', 'nachname');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Nachname"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Strasse"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Strasse');
$tpl->set('d', 'FIELDID', 'strasse');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Strasse"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Postleitzahl"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Postleitzahl');
$tpl->set('d', 'FIELDID', 'postleitzahl');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Postleitzahl"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Ort"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Ort');
$tpl->set('d', 'FIELDID', 'ort');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Ort"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Land"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Land');
$tpl->set('d', 'FIELDID', 'land');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Land"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Firma"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Firma');
$tpl->set('d', 'FIELDID', 'firma');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Firma"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Telefon"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Telefon');
$tpl->set('d', 'FIELDID', 'telefon');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Telefon"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Fax"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Fax');
$tpl->set('d', 'FIELDID', 'fax');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Fax"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Mobil"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Mobil');
$tpl->set('d', 'FIELDID', 'mobil');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Mobil"]);
$tpl->next();
$tpl->set('d', 'FIELDTITLE', mi18n("Homepage"));
$tpl->set('d', 'FIELDTYPE', 'text');
$tpl->set('d', 'FIELDNAME', 'Homepage');
$tpl->set('d', 'FIELDID', 'homepage');
$tpl->set('d', 'FIELDVALUE', $_REQUEST["Homepage"]);
$tpl->next();
$tpl->set('s', 'NEWSLETTER', mi18n("Newsletter"));
$tpl->set('s', 'SUBSCRIBE', mi18n("Subscribe"));
$tpl->set('s', 'DELETE', mi18n("Unsubscribe"));
$tpl->set('s', 'WELCOME', mi18n("Willkommen"));
$tpl->set('s', 'GO', mi18n("Go"));
$tpl->set('s', 'JOIN', mi18n("Join"));
$tpl->generate('templates/'.$template);
?>
Code: Alles auswählen
<p>{WELCOME}<br/><br/></p>
<div id="newsletterbox">
<p>Mit * gekennzeichnete Felder müssen ausgefüllt werden.</p>
<form method="post" action="{FORM_ACTION}" style="padding:0;margin:0;" name="newsletterform" id="newsletterform"{FORM_TARGET}>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/blank.gif" width="70" height="1" border="0"/></td>
<td><img src="images/blank.gif" width="73" height="1" border="0"/></td>
<td><img src="images/blank.gif" width="1" height="1" border="0"/></td>
</tr>
<tr>
<td class="meldung" colspan="2"><p>{MESSAGE}</p></td>
</tr>
<tr>
<td><label for="emailname" class="label_searchbox"><p>{EMAILNAME}</p></label></td>
<td><input type="text" name="emailname" id="emailname" value="" class="input_searchbox" style="margin-bottom:.4em;"/></td>
<td> </td>
</tr>
<!-- BEGIN:BLOCK -->
<tr>
<td width="75" class="textklein"><p>{FIELDTITLE}</p></td>
<td width="275" class="textklein"><input size="30" type="{FIELDTYPE}" name="{FIELDNAME}" id="{FIELDID}" value="{FIELDVALUE}" style="margin-bottom:.4em;"></td>
</tr>
<!-- END:BLOCK -->
{GROUPS}
<tr>
<td align="right" colspan="2"><select name="action" id="action" class="input_newsletterselect">
<option value="subscribe" selected>{SUBSCRIBE}</option>
<option value="delete">{DELETE}</option>
</select></td>
<tr></tr>
<td align="right" colspan="2"><a href="javascript:document.forms['newsletterform'].submit();" style="color: #9d9ea2;" title="{GO}">{GO}</a></td>
</tr>
</table>
</form>
</div>
Jetzt wirds aber knifflig. Aufgrund mangelnder Kentnisse der Klassen und wie was wo gespeichert wird bin ich auf Vermutungen und mehr oder weniger gezieltem herumstochern in der API angewiesen.
Den Newsletter Handler habe ich mal so angegangen:
(Nur ein Ausschnitt aus dem Code )
Code: Alles auswählen
if ($recipient = $objRecipients->next()) {
// $idrecipient = $recipient->get("idnewsrcp");
$recipient->set("confirmed",1);
$recipient->set("confirmeddate", date("Y-m-d H:i:s"), false);
$recipient->set("deactivated",0);
$recipient->store();
$strMessage = mi18n("Thank you! You have confirmed your subscription to our newsletter!");
$newsletters = New NewsletterCollection;
$newsletters->select("idclient = '$client' AND idlang='$lang' AND welcome='1'");
if ($newsletter = $newsletters->next()) {
$result = $newsletter->send($objProperties->getValue("clientsetting", $client, "Newsletter", "idcatart"),"single",$recipient->get("idnewsrcp"));
$strMessage .= mi18n(" The welcome newsletter is already on the way to you!");
}
if ($arrSettings["FrontendLink"] == "enabled" && $arrSettings["FrontendConfirm"] == "ActivateUser") {
$frontendusers = new FrontendUserCollection;
$frontendusers->select("idclient = '$client' AND username='".urlencode($recipient->get("email"))."'");
if ($frontenduser = $frontendusers->next()) {
$frontenduser->set("active",1);
$pwd = substr(md5(rand()),0,8); // Generating password
$frontenduser->set("password", $pwd);
$frontenduser->store();
// Erweiterte FEUser Daten speichern
$oFEUser = new FrontendUser;
$oFEUser->setProperty("titel", "address", $Titel);
$oFEUser->setProperty("vorname", "address", $Vorname);
$oFEUser->setProperty("nachname", "address", $Nachname);
$oFEUser->setProperty("postleitzahl", "address", $Postleitzahl);
$oFEUser->setProperty("ort", "address", $Ort);
$oFEUser->setProperty("strasse", "address", $Strasse);
$oFEUser->setProperty("land", "address", $Land);
$oFEUser->setProperty("firma", "address", $Firma);
$oFEUser->setProperty("telefon", "address", $Telefon);
$oFEUser->setProperty("fax", "address", $Fax);
$oFEUser->setProperty("mobil", "address", $Mobil);
$oFEUser->setProperty("email", "address", $eMail);
$oFEUser->setProperty("homepage", "address", $Homepage);
$sMessage = mi18n("Ihre Daten sind erfolgreich aktualisiert worden.");
$oFEUser->store(); # weiss gar nicht, ob das nötig ist
// Ende des FEUser Daten speicherns
$strMessage .= mi18n("<br><br>Additionally, your website account has been activated. You can now use the following username and password to log in to access special areas on our website:<br>");
$strMessage .= mi18n("Username: ").$recipient->get("email").mi18n("<br>Password: ").$pwd;
$body = mi18n("txtMailPassword")."\n\n".mi18n("Username: ").$recipient->get("email")."\n".mi18n("Password: ").$pwd."\n\n".mi18n("Click here to login: ").$cfgClient[$client]["path"]["htmlpath"]."front_content.php?changelang=".$lang;
$mail = new phpmailer();
$mail->From = $arrSettings["SenderEMail"];
$mail->FromName = $arrSettings["SenderEMail"];
$mail->AddAddress($recipient->get("email"));
$mail->Mailer = "mail";
$mail->Subject = mi18n("Website account");
$mail->Body = $body;
// $mail->AltBody = $body;
Für Hilfe wäre ich jedenfalls dankbar.
Achja mir ist klar, dass die &_REQUEST Daten derzeit nicht richtig integriert sind. Das fällt unter "feinheiten" und kommt am Schluss. Ich will das speichern der zusätzlichen Felddaten erstmal irgendwie hinkriegen...