WBCE CMS – Way Better Content Editing.
You are not logged in.
Pages: 1
Ich möchte gerne in ein input Feld die Userdaten des angemeldeten Users eintragen.
Soweit so gut, das funktioniert mit Droplet ansich sehr gut.
Der Dropletaufruf wird als value eingetragen
value="[[droplet]]"
Damit erscheint automatisch der Username.
Wenn aber bei einem nicht ausgefüllten Required Feld das Formular neu geladen wird, erscheint im Feld nicht der Wert des Droplets, sondern der Dropletaufruf selber ( [[droplet]] )
Ich vermute, dass in diesem Fall der Parser nicht durchläuft.
Wie kann ich das beheben?
Wäre das ev ein Bug ?
Droplets sind in Formularen ansich nicht vorgesehen, aber durchaus ein Thema...
Ev kann man ja Userdaten (username, display_name, e-mail) direkt in einem Template aufrufen, daran bin ich aber gescheitert...
Last edited by berny (12.08.2026 10:17:21)
Offline
Hm ... confirmed
Leider leine Ahnung wie Dein Dropplet aussieht oder welches "mini-form" Formular Du einsetzt.
Getestet hier local mit "EN contactform" mit CAPTCHA (und das //testweise// absichtlich falsch ausgefüllt)
Gut, beim falschen Catcha wird werden die Droplets nicht geparst - vermutlich wildes "return/echo" und dann "die()" irgendwo
in den Tiefen des Modules.
Abhilfe (vorsicht "Schnellschuß")
File: ~/wbce_168/wbce/modules/miniform/view.php
Line: 321 ff.
unset($value);
if (!function_exists('evalDroplets'))
{
require_once WB_PATH."/modules/droplets/droplets.php";
}
evalDroplets($template); // [sic!] - param is call by referenceHope it helps
Gruß Kant
Sapere aude!
Offline
berny
Die Frage ist, ob man dass für die Zukunft abfängt?
Ich denke eben an das captcha...
Der Hintergrund ist, dass ein Formular im angemeldeten Bereich automatisch Userdaten ladet, die nicht änderbar sind.
Hintergrund ist das Ausfüllen der user_extend Tabelle.
Das Formular liefert die Daten.
Diese kann ich dann in die Tabelle einfügen.
Die Änderung funktioiert...
Last edited by berny (13.08.2026 08:22:14)
Offline
Hm ..
ich hab (erst mal) einen PR eingereicht ...
https://github.com/WBCE/WBCE_CMS/pull/600
closed :-) see/read the following ones:
Gruß
Kant
Last edited by kant (13.08.2026 11:32:51)
Sapere aude!
Offline
Warning:
With a fix like this a visitor could fill something like:[[sectionpicker?sid=123]] in any inputfield. (these droplets exist by default)
That would include the complete section 123 in the email.
(note the sid is found in any webpage source like: <a class="section_anchor" id="wb_159" ></a> )
Think what would happen if someone added [[sectionpicker?sid=1]] [[sectionpicker?sid=2]] [[sectionpicker?sid=3]] [[sectionpicker?sid=4]] etc..
640K of RAM ought to be enough for anybody.
Offline
stefanek, berny
Ich möchte gerne in ein input Feld die Userdaten des angemeldeten Users eintragen.
Soweit so gut, das funktioniert mit Droplet ansich sehr gut.
Der Dropletaufruf wird als value eingetragen
value="[[droplet]]"
Damit erscheint automatisch der Username.
Aufgrund des von Ruud aufgezeigten Problems ist es tatsächlich nicht sinnvoll, es mithilfe von Droplets zu lösen.
Was gemacht werden könnte, ist, das MiniForm Modul dazu zu bringen, bestimmte Felder vorauszufüllen, wenn man eingeloggt ist.
Das wäre aber ein größerer Umbau.
Christian
“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale
Offline
Starting a form from a link (not the menu) you can do something like this:
The form has a field "mf_r_name" (could even be hidden)
Pre-fill this name field using a link like: www.yourwebsite.com/pages/contactform.php?name=[[username]]
See: https://miniform.dev4me.com/module-help … nd-tricks/
Prove of concept: https://miniform.dev4me.com/demo/contactform/?firstname=WBCE&lastname=UserLast edited by dev4me (13.08.2026 10:37:06)
640K of RAM ought to be enough for anybody.
Offline
stefanek
A hidden advanced trick is also possible :-)
Set in your website/template a session vairable like:
[== PHP ==]
<?php
if(!isset($_SESSION['form']['mf_your_fieldname'])) {
$_SESSION['form']['mf_your_fieldname'] = ($_SESSION['USERNAME'] ?? 'Unknown');
}
?>(mf_your_fieldname is whatever you defined in the form, $_SESSION['DISPLAY_NAME'] = the loggedin user)
Loading the form will fill that field.
(an extra check on logged in might be usefull)
Last edited by dev4me (13.08.2026 10:57:51)
640K of RAM ought to be enough for anybody.
Offline
kant, stefanek, berny
Do you think, this will better to put this into config.php because if once we change the template and forget this part to add?
Offline
I think modifying config.php is never advised.. ( although some of my own modules do/require that
)
But.. I should work the same..
640K of RAM ought to be enough for anybody.
Offline
berny
A hidden advanced trick is also possible :-)
Set in your website/template a session vairable like:
[== PHP ==] <?php if(!isset($_SESSION['form']['mf_your_fieldname'])) { $_SESSION['form']['mf_your_fieldname'] = ($_SESSION['USERNAME'] ?? 'Unknown'); } ?>(mf_your_fieldname is whatever you defined in the form, $_SESSION['DISPLAY_NAME'] = the loggedin user)
Loading the form will fill that field.
(an extra check on logged in might be usefull)
Does not work.....
Needs the session - form the id from the section ($_SESSION['form_123']) ?
Offline
Ich kenne nicht das genaue Szenario und was Du da versuchst, aber wie wäre es ein Droplet zu schreiben das die Daten per Javascript in die Felder schreibt, wenn es ein eingeloggter Nutzer ist?
Mit PHP alles abfangen und über insertJsCode das JS in die Seite schreiben.
Den Dropletaufruf selbst könntest Du dann in das miniform-template setzen.
Christian
“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale
Offline
if(!isset($_SESSION['form']['mf_r_username'])) {
$_SESSION['form']['mf_r_username'] = ($_SESSION['USERNAME'] ?? 'Unknown');
}
echo '<pre>';
print_r($_SESSION);
echo '</pre>';I put this in a Code2 module befor the miniform.
[form] => Array
(
[mf_r_username] => Berny
but
<label for="username"><span>User <span>*</span></span>
<input placeholder="username - Firstname Lastname" class="" type="text" id="username" name="mf_r_username" value="" style="background-color: lightgrey; " />
</label>
It seams, there is missing something...
Offline
Sorry for my delay, i got it.
Forgot the values {USERNAME}
i put a code2 module befor the miniform, put in the code
$_SESSION['form']['mf_r_username'] = $_SESSION['USERNAME'] . ' - '.$_SESSION['DISPLAY_NAME'];
$_SESSION['form']['mf_r_e-mail'] = $_SESSION['EMAIL'];Why deactivate the !isset : this form is only for registered users, so there is automaticly a $_SESSION[USERNAME] and more...
div class="half">
<label for="username"><span>User <span>*</span></span>
<input placeholder="Username - Firstname Lastname" class="{USERNAME_ERROR}" type="text" id="username" name="mf_r_username" value="{USERNAME}" style="background-color: lightgrey; pointer-events: none;" readonly />
</label>
</div>
<div class="half">
<label for="e-mail"><span>E-Mail <span>*</span></span>
<input placeholder="E-Mail" class="{E-MAIL_ERROR}" type="text" id="e-mail" name="mf_r_e-mail" value="{E-MAIL}" style="background-color: lightgrey; pointer-events: none;" readonly />
</label>
</div>The template section...
thx .
Last edited by berny (16.08.2026 10:13:59)
Offline
Pages: 1