Solved

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

Posted on 2011-03-09
5
170 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
[X]
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
  • 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Suggested Solutions

Who says nothing in life is free? WordPress.com is a freebie. WordPress.org's downloadable publishing platform is free. Heck, even WordPressMU is free. WordPress is an open source project, which means it can be used on any personal or commerc…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to Import and export files in 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 : Click on Too…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

734 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