link the PHPList user table to a company table

Questions related to the phpList Hosted service

link the PHPList user table to a company table

Postby myphplist » 7:30am, Wed 08 Aug, 2012

Dear phplist folk,
Is it possible to link (join) the users registered in PHPList with a table containing a list of company. In other words to have a Field "company ID" in the user table pointing to a Field "company ID" in the a company table.

Thanks in advance for your answer.

Regards.

Giuseppe Angelini
myphplist
phpLister
 
Posts: 8
Joined: 11:58am, Tue 31 Jul, 2012

Re: link the PHPList user table to a company table

Postby duncanc » 11:12am, Thu 09 Aug, 2012

phplist supports user attributes, these are extra fields for each user that you define and populate with values.

Is this what you are looking for, as you don't explain what you want to do with the company id?
duncanc
Moderator
 
Posts: 2440
Joined: 6:34am, Sat 08 May, 2010
Location: London

Re: link the PHPList user table to a company table

Postby myphplist » 1:41pm, Thu 09 Aug, 2012

duncanc wrote:phplist supports user attributes, these are extra fields for each user that you define and populate with values.

Is this what you are looking for, as you don't explain what you want to do with the company id?


Thanks for your answer,

In fact I would like to manage a company table to which the users belong, in order to also contact the companies by E-mail or Post Mail.
The user table from the PHPList should be linked to the company table with his own attributes like contry, address and so on... . In fact I would like to migrate our current mailling list application based on SQL and it is the way it is writen now. If This is possible then I will need to build some kind of report but maybe this will probabily need some extra code to be writen.

Best Regards.

Giuseppe Angelini
myphplist
phpLister
 
Posts: 8
Joined: 11:58am, Tue 31 Jul, 2012

Re: link the PHPList user table to a company table

Postby duncanc » 7:06am, Sat 11 Aug, 2012

You can easily add extra tables to the database, which phplist will know nothing about.

If you add an extra column to the user table then phplist will also know nothing about that, so I would recommend using the user attribute approach to link a user with a company. That way the company id can be edited and displayed by phplist . You will have to develop any extra functionality yourself.
duncanc
Moderator
 
Posts: 2440
Joined: 6:34am, Sat 08 May, 2010
Location: London

Re: link the PHPList user table to a company table

Postby myphplist » 9:35am, Sun 12 Aug, 2012

Hello,
Thanks for your answer.
Wath doe you mean when you say I can create an extra table which phplist will know nothing about it.
How can I create an extra table. I guess whit phpmyadmin.
Now after I create such table can I have a kind of combo box in phplist linked to this company table.

Best Regards.

Giuseppe Angelini
myphplist
phpLister
 
Posts: 8
Joined: 11:58am, Tue 31 Jul, 2012

Re: link the PHPList user table to a company table

Postby duncanc » 10:02am, Sun 12 Aug, 2012

Yes, you can use phpmyadmin to create new tables, or add columns to existing tables. But the phplist code will know nothing about those. It knows only about its tables, and the columns within those tables.

If you create a user attribute for company, then you will begin to see how the phplist tables relate to each other.

You will need to be proficient in php and sql if you want to modify the phplist code. I would recommend not to.
duncanc
Moderator
 
Posts: 2440
Joined: 6:34am, Sat 08 May, 2010
Location: London

Re: link the PHPList user table to a company table

Postby myphplist » 1:01pm, Sun 12 Aug, 2012

OK,
I have a couple of things to try at my office tomorrow then I will let you know about it.
Thanks again for your help.

Best Regards.

Giuseppe Angelini
myphplist
phpLister
 
Posts: 8
Joined: 11:58am, Tue 31 Jul, 2012

Re: link the PHPList user table to a company table

Postby myphplist » 8:08am, Mon 13 Aug, 2012

Hello,
This morning I have created my company table in phplistdb and nom I have a new table with the following fields:
Company number (int), Company name (text), Company Address (text).
Now I have tried to create an attribute Company number in phplist but it is not possible to have the right data type, I mean it is not possible to anter an INT data type in the attributes of phplist.
So. How can I do to link my user list to my company table.

Any help will be welcom.

Best Rewgards.

Giuseppe Angelini
myphplist
phpLister
 
Posts: 8
Joined: 11:58am, Tue 31 Jul, 2012

Re: link the PHPList user table to a company table

Postby duncanc » 8:57am, Mon 13 Aug, 2012

One way to do this is create a new attribute of 'select' type, then enter all of the companies as control values. phplist will assign an incrementing sequence number as the unique value for each company, so you will have to map that onto your own company id.

Or, create a text line attribute and populate it directly with your company id.

You can then join the user table to your company table via the user_attribute and user_user_attribute tables.

But bear in mind that phplist has not been designed to be extended in this way so you are not necessarily going to get a good solution.
duncanc
Moderator
 
Posts: 2440
Joined: 6:34am, Sat 08 May, 2010
Location: London

Re: link the PHPList user table to a company table

Postby myphplist » 9:25am, Mon 13 Aug, 2012

Hello,

Thanks for your answer.

I have just created a text line (NumFirm) attribute and have populated it directly with my company id.

Now, I don't see how Ican join the user table to my company table via the user_attribute and user_user_attribute tables.

Thanks again for your help.

Best Regards.

Giuseppe Angelini

duncancModerator Posts: 1092Joined: 7:34am, Sat 08 May, 2010Location: London
myphplist
phpLister
 
Posts: 8
Joined: 11:58am, Tue 31 Jul, 2012

Re: link the PHPList user table to a company table

Postby duncanc » 10:44am, Mon 13 Aug, 2012

Ah sorry, for a text line attribute, you need to join on on only the user_attribute table.
For a select attribute it is more complex.

For a key of attribute id (the attribute id of your company attribute, say 1) and the user id you can get the company id for the user.
duncanc
Moderator
 
Posts: 2440
Joined: 6:34am, Sat 08 May, 2010
Location: London

Re: link the PHPList user table to a company table

Postby myphplist » 11:13am, Mon 13 Aug, 2012

Hello,
I think that every thing is alright now.
I have my company id as an attribute for the user table linking to the record in the company table to which my users belong. And know, how can I do if I want to print the company name and company address of my users. Of course the address and company name are fields of the company table.
I guess I need some piece of code.Can you please give me an example code as a kind of template for my futures reports.

Best Regards.

Giuseppe Angelini
myphplist
phpLister
 
Posts: 8
Joined: 11:58am, Tue 31 Jul, 2012


Return to phpList Hosted

Who is online

Users browsing this forum: No registered users and 1 guest