Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Direct acess from email-link to a password protected wordpress site

Posted on 2011-03-09
5
168 Views
Last Modified: 2012-05-11
I have a client where part of the site is a member section, where pople have to log in with a user name and password given from webmaster, to get access.

The user is registered in the database.

It is now a need for having the opportunity to click on a link in a received e-mail who takes you to the member area without login in manually.

I would be impressed if anyone know how this can be done in Wordpress, and also if they tried to explain it to me.

Thanks!
0
Comment
Question by:toiler
  • 3
5 Comments
 
LVL 31

Expert Comment

by:gwkg
ID: 35089689
Wordpress would be pretty insecure if that were possible.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 35089695
It's possible, just a heckuva lot of extra work and totally circumvents all of the hard work that went into making WordPress secure.
0
 
LVL 31

Expert Comment

by:gwkg
ID: 35089779
This should do it

If you add the users name into the url as 'user' and a secret key as 'key', try this in your functions.php file:

function auto_login() {
if (!is_user_logged_in() && $_GET['key']='your-secret-key') {

$user_login = $_GET['user'];

//get user's ID
$user = get_userdatabylogin($user_login);
$user_id = $user->ID;

//login
wp_set_current_user($user_id, $user_login);
wp_set_auth_cookie($user_id);
do_action('wp_login', $user_login);
}
}
add_action('init', 'auto_login');
0
 

Author Comment

by:toiler
ID: 35093359
Thanks alot for help!

gwkg:
Do I have to make this link manually for each member mail? You see, we are talking about  500 members.
0
 
LVL 31

Accepted Solution

by:
gwkg earned 500 total points
ID: 35096121
If you want to log each person in to their own account the link would need their user name.  If you are using something like Constant Contact, MailChimp, etc. to do the mailing you should be able to make a userdefined field that you can put each persons user name into one time and then include it in the email link as a variable that changes for each person in the same way you would put Hi ##FIRSTNAME##, to personalize the email.

The other way would be to have one generic account that everyone logs into to the see the content.  Of course this will be even less secure.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question