Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-09
5
Medium Priority
?
173 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 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Now that you've installed WordPress 2.9 (http://www.experts-exchange.com/articles/Web_Development/Blogs/WordPress/WordPress-2-9-What-to-Expect-When-Upgrading-to-WordPress-2-9.html?) on your site, you need to install some plugins to get the most out …
How to create your own WordPress Theme Before I begin with the theme design tutorial, I would like to give you the basics of what is required to make a WordPress Theme. The most basic WordPress theme only requires 2 files: a style.css file and an…
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 set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

715 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