Solved

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

Posted on 2011-03-09
5
164 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now