Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Outputting user emails into a form field
OK – I’m very new at php… so don’t laugh (if you can help it) + this is the first plugin I have tried to do anything with other than use :)
I’m trying to hack “wyn_email_publish” to populate the Target Email field with the emails of txp users seperated by a ; – so you get:
email@email.com; email2@email2.com; email3@email3.com; etc…
This is the part of code which I am trying to edit:
function wyn_email_publish_config ($event, $step) {
global $prefs, $wyn_email_publish_address, $wyn_email_publish_title, $wyn_email_publish_body;
$notify = '';
if (ps ('save')) {
/* Save */
$notify = "Preferences Saved";
$wyn_email_publish_address = ps ('wyn_email_publish_address');
$wyn_email_publish_title = ps ('wyn_email_publish_title');
$wyn_email_publish_body = ps ('wyn_email_publish_body');
} else {
if (!isset ($wyn_email_publish_address)) {
$wyn_email_publish_address = '$tye_email = mysql_query('SELECT email FROM `int_txp_users`'); while ($tye_display = mysql_fetch_array($tye_email)) { echo $tye_display['email'] . ';' ;}'; // This is the line I want to edit
}
if (!isset ($wyn_email_publish_title)) {
$wyn_email_publish_title = '%title%';
}
if (!isset ($wyn_email_publish_body)) {
$wyn_email_publish_body = '<p>Orginal from <a href="%link%">%title%</a></p><p>%body%</p>';
}
}
I am trying to put this line of code into the line I want to edit - It displays perfectly when used on its own in a file:
$tye_email = mysql_query('SELECT email FROM `int_txp_users`'); while ($tye_display = mysql_fetch_array($tye_email)) { echo $tye_display['email'] . ';' ;}
So I am using it like this… I suspect it is something to do with the ‘;’
$wyn_email_publish_address = '$tye_email = mysql_query('SELECT email FROM `int_txp_users`'); while ($tye_display = mysql_fetch_array($tye_email)) { echo $tye_display['email'] . ';' ;}'; // This is the line I want to edit .
Any tips :)
Offline
Re: Outputting user emails into a form field
I suppose a better thing to ask would be: “What would be the best way to get this plugin to send an email to all the user emails in the database?”
Offline