I'd like to send customers an email with a link to their (private) profile/account page.
This link should contain login credits so they can click to go to their profile page and log in at the same time.
How can I add login info to a url?
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.Sign up to join this community
You can use the add-on LogMeIn to do this exact thing. All it needs is the username to feed into the template. You can achieve that in a variety of ways, some being more secure than others.
The most direct (not so secure) method would be to do the following:
1) Create a template, for example
profile/logmein, and put the LogMeIn tag in it like this:
2) Then have the email you send include a link to the logmein template with their username in the last segment: site.com/profile/logmein/username
Once the user hits that page it'll redirect them to wherever you have that set up.
It's really too simple.
In the admin, if you go to the page of the user (members -> view all -> [select desired user]) You can copy the url of that page and send that to them. This allows them to log in and go directly to their account page.
As far as automatically logging them in, that is dangerous and would be a big security concern. You should never automatically log someone in via and email link. But if you are willing to try you need to enable html in your emails (not all clients support it) and you would have to make hidden inputs to tie directly to your cp. (please do not do that though)
Edit: I do not believe that you can tie a form directly to the login of EE. There are session keys for the form that are for authentication to check that you are in a browser and on that specific page.
Expressionengine logs you in by checking your username and password in the database and then creating a session (a cookie and a corresponding database entry).
It would be pretty simple to add another field in the members table and create a GUID for each member that you use to identify and authenticate the member. You can create either an EE plugin or a CI or raw PHP script that provides a landing page that accepts the GUID as a url parameter and performs the pseudo login. You can then send the url with the GUID via a mailmerge, mailchimp or whatever to your users.
I'm sure you know, but you should do your own risk analysis to be sure that this method is secure enough. Make sure whatever group these members are in doesn't have control panel access etc.