Populate From line with [LISTOWNER.ATTRIBUTE] placeholder

Solutions for other advanced phplisters

Populate From line with [LISTOWNER.ATTRIBUTE] placeholder

Postby Guest » 10:06am, Wed 10 Sep, 2008

Hi All,

I have managed to get [LISTOWNER.ATTRIBUTE] to work in the body of messages / templates, but similarly I was also looking for a way to mod the message from line...

Is it possible rather than using the admin user name to use an admin attribute which holds a full user name and to make the message from field non editable?

This would also be better practice I think as you wouldnt be giving out what your admin user name is to your mailing list.

This way the superadmin would be able to control admins ability to only send out a mailing from the email and from name that the superadmin has set up.

All help, comments greatly appreciated.

Kind regards

Postby Guest » 10:53am, Thu 11 Sep, 2008

Hi all,

I have figured out the required sql for the above using phpMyAdmin to be;

Code: Select all
$sql = 'SELECT `value` FROM `phplist_adminattribute` JOIN `phplist_admin_attribute` ON `id`=`adminattributeid` WHERE `tablename`="emailfrom" AND `adminid`=1';

and found the section which i think needs tweaking in admin/send_core.php

Code: Select all
if ($adminemail && USE_ADMIN_DETAILS_FOR_MESSAGES) {
$from = $GLOBALS["admin_auth"]->adminName($_SESSION["logindetails"]["id"]).' '.$adminemail;

but when I replace the above $from variable with;

Code: Select all
$from = Sql_Fetch_Row_Query("select value from {$tables["adminattribute"]} INNER JOIN {$tables["admin_attribute"]} on id=adminattributeid where tablename="emailfrom" and adminid=$id") . ($_SESSION["logindetails"]["id"]).' '.$adminemail;

My send a message page only loads the top section, am guessing there is a problem in the syntax that i've used above but this is not a language i'm used to coding in so if anyone can spot the flaw id appreciate your comments.


Postby Guest » 8:17pm, Thu 11 Sep, 2008

Hi all,

This is as far as I've got with this;

Code: Select all
$Sql_Query = ("select value from {$tables["adminattribute"]} inner join {$tables["admin_attribute"]} on id = adminattributeid where tablename = 'emailfrom' and adminid = $id");   

$from = Sql_Fetch_Row($Sql_Query) . ($_SESSION["logindetails"]["id"]).' '.$adminemail;

The original $from line was like this;

Code: Select all
$from = $GLOBALS["admin_auth"]->adminName($_SESSION["logindetails"]["id"]).' '.$adminemail;

I'm now getting a from field with an id plus the admin's email.

Can't figure out this syntax, I think I should have double quotes around emailfrom as thats the string value of tablename, i.e. the tablename value for my admin attribute.

I can get the sql to work in phpMyAdmin which gives me the associated field value from phplist_admin_attribute.

Can someone see the flaw in the above code, I must have tried dozens of permutations and still no luck :cry:

Here's hoping someone will stop by and reply...

Postby chrishanvey » 5:17am, Fri 24 Oct, 2008

I'm quite interested in this feature myself and had quick look at your solution. I think this would only work if you are sending to one list.
I would like this functionality to work when sending to multiple lists.
PL Nut
Posts: 17
Joined: 2:25am, Thu 01 Dec, 2005

admin attributes

Postby dannette » 3:37pm, Fri 02 Jan, 2009

I'd like to know how you got it work in the body - I've been looking at this for a few hours and tried a few things but still cannot get it to work. I am using the latest install - 2.10.8. I have looked at several posts and tried implementing some of the suggestions to no avail. (like using prepared message - that was a little messy)
Posts: 9
Joined: 7:41pm, Mon 13 Jun, 2005

Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests