LogMeIn
This is an Expression Engine plugin that allows you to automatically log a site visitor in from any template without having to collect details from them, great for stand-alone entry forms.
Support can be found in the comments and in this EE forum thread.
Current Version: 1.2 (released 19 December 2008)
* Works with ExpressionEngine 1.6 and higher.
1. Concept
I developed this plugin because I wanted to allow site visitors to be able to submit stand-alone entry forms. The problem stems from the fact that in EE, visitors must be logged in to submit stand-alone entry forms. However quite often you will want to allow guests to submit forms without requiring them to create an account first. This plugin solves the problem by automatically logging them in for you.
Find out more about stand-alone entry forms.
2. How It Works
The plugin simply logs the visitor in as a user that you specify. So for example, you could set up a user account with username priveleged_guest, and assign it to any member group, say priveleged_members, that has weblog posting privelages to a weblog, say visitor_feedback
You could then put call the plugin from a template in which you have a stand-alone entry form that you want to allow guests to submit:
{exp:logmein:now username="priveleged_guest" if_member_group="3" expire="300"}
{exp:weblog:entry_form weblog="visitor_feedback"}
Name: <input type="text" name="name" /><br />
Email: <input type="text" name="email" /><br />
Feedback: <textarea name="feedback"> </textarea><br />
<input type="submit" value="submit" />
{/exp:weblog:entry_form}
The username parameter is required.
The if_member_group parameter is optional and defines the member group id that the current user must belong to (for example guest users).
The expire parameter is optional and sets the expiration time in seconds of the cookie. So in the example above the user will be logged in for only 5 minutes. The default value is 1 day.
You can also log the user out at any time by using the following tag:
{exp:logmein:logout}
3. Installation
- Download and unzip logmein.zip
- Upload pi.logmein.php to the system/plugins folder.
4. Download
You can download and use the plugin for free here:
If this plugin has helped you and you are feeling generous then feel free to make a small donation, it is much appreciated:
5. Changelog
Version 1.2- Added if_member_group parameter
- Added expire parameter
- Added logout tag


6. Comments
Mark Bowen
20 November 2007
Hi Ben,
This works absolutely brilliantly. Saw the link on the EE forums. Well done on such a great usable addition for EE!! :-)
Best wishes,
Mark
Rudolf
23 November 2007
This is so sweet ! Thanx for sharing it.
AJP
27 November 2007
This was a lifesaver! Thanks!
jason isaacs
27 December 2007
Hi, I am trying to use this plugin to fix a problem I'm having with the Expression Engine Simple Commerce Module. It doesn't record a purchase or send the follow up emails if the purchase is not made by a registered member. It looks like this should work, but I have installed it and set it up and I am still having no luck. I didn't know if you could shed some light on this problem.
CTAC
15 January 2008
Thank you for this helpfull plugin. As I understood, when user post them news on SAEF page, him automatically logged as priveleged_guest. And after posting, him also logged as priveleged_guest and hу can post any comments or forum posts as priveleged_guest. How can I automatically unlogin them painless right after posting.
Thank you!
Ben
18 February 2008
jason: make sure that the member group that the user is automatically being logged in is allowed to make purchases.
ctac: you could automatically redirect them to the logout page after posting using the return parameter in the SAEF
Lee
21 February 2008
Thanks for this really useful plugin. Lovely site you have here!
Chad Crowell
24 February 2008
Nice job -perfect for my needs- would love to see a logmeout version as well that allows you to secretly log them back out and then redirect them, say, to a thank you page. Using the standard logout function takes them back to the homepage. Thanks!
Lee
28 February 2008
Yes a logmeout plugin would be very useful. I wonder if it's just a case of editing the logmein code . Or if logmein could have a logout after x hours property.
Ben
02 March 2008
hi guys, i have released version 1.1 which is just for you! there are now two different ways of managing to log users out. please see the changelog and instructions above.
Lee
11 March 2008
Ben, many many thanks. Do you have a donate link?
Ben
22 March 2008
just added one under the download link.
thanks in advance!
Joshua
26 March 2008
Ben, thanks for the plugin. It works beautifully and allows me to get rid of the hacks to the standalone module I'd done a while back.
I added a check for whether the visitor is in the super admin group, as I was tired of getting logged out when I visited the page myself. You could probably expand this by adding another parameter in which users or groups to ignore could be set, but the following was enough for my needs (I added this after the username parameter check):
Christofer
12 May 2008
I'm trying to use this plugin with the Simple Commerce plugin but can't get it to work. I'm thinking that I might have to edit the mod.simple_commerce.php file to send the customer email to the address supplied by PayPal instead of getting it from the EE member database?
Anyone that have gotten LogMeIn with Simple Commerce email templates? Thanks!
Ori
20 May 2008
We're testing out the plugin and love it but we have this problem where intermittently we get a "You must be a logged-in member of this site in order to perform this action."
I've tried setting the expiration to long periods of time but sometimes it just fails and there's nothing we can do. I've noticed that the groupid sometimes changes between "guests" and the other user logmein specific user group we created (but the group id number always stays the same). This seems to have something to do with it.
Ori
20 May 2008
OK, I think I solved my problem. I think my cookie based security was creating conflicts between my guest group and my superadmin status.
By using separate browsers, I could always use logmein successfully (so there was no conflict).
But now I have a new problem. Logmein works fine for my main domain, but I have a different domain that points to a specific template group in EE. When I use that URL, I get the "You must be a logged-in member of this site in order to perform this action." But if I change just the domain name, to the main site, it works fine.
Once again this is probably because of the cookie-based security. Is there a way around this?
Create Sean
28 May 2008
Just saw this on the EE forums and downloading now - thanks a bunch.
Travis Smith
09 June 2008
I am getting intermittent failure with this module. I get the error "You must be a logged-in member of this site in order to perform this action."
When it fails, the screen_name and member_id is NOT set, but the group_id is set to 5 (member) instead of 3 (guest) -- so maybe I'm just getting partially logged in?
Any suggestions for how to troubleshoot / resolve this issue?
TTFN
Travis
Ben
18 June 2008
hi travis, if the group_id is set to 5 (member), then it is not the plugin that is logging you in, assuming that you pass the logmein plugin a username that is in the guest member group.
can you please check that you are indeed using the username of a member in the guest member group, so:
{exp:logmein:now username="username_of_member_in_guest_group"}
also perhaps you should try logging out first before trying to access the page where the plugin is used. let me know how it goes...
Tony Nibbles
24 June 2008
Gah!
I just can't get this to work.
Well, it works - as the {member_id} variable outputs the correct value, but my SAEF form never gets past the 'must be logged in' error.
I've set my member to guest, and the guest group has weblog posting privs to the right weblog.
Is this fully tested in EE 1.6.3?
Tony Nibbles
24 June 2008
....fixed through my own tinkering.
It's security settings in EE. Working on dev.url.com which is different from the defined site domain, causing hiccups in log ins etc.
Travis
25 June 2008
So, I determined that you need to be careful about the interactions between the logout and the login functions; if both are on a page (which I wouldn't have done, but it was someone else's code) they don't always take effect in the same order, which means you can get screwy results.
TTFN
Travis
Peter
07 August 2008
First of all, thanks *so* much for this plugin. It's extremely well done and useful.
I'm having a problem with it's use however that isn't directly a fault of the plugin but how I would like to use it.
I'm attempting to put a posting form on my home page. My site allows both 'guests' and members to post. In order to log-in a guest and not mess with users who already have logged in I have this code at the top of my home page template:
{if group_id == '3'}
{exp:logmein:now username="Guest" expire="1000" parse="inward"}
{/if}
In theory, this code should log someone in as a guest only when the are in the usergroup of 3 (guest access) and if someone is already logged in such as a regular member in usergroup 5 then they shouldn't be touched.
Problem is that no matter what I do the plugin is triggered and am ALWAYS logged in as a guest even though I'm already logged in as a different member.
Any clues as to how to fix this?
Thanks,
Peter
Peter
07 August 2008
To be sure I'd like to add that I used this code as well because it's the more logical choice but it also has the same results, it logs out the existing member and logs in "Guest" regardless of how the statement is constructed or where it goes in the page.
{if logged_out}
{exp:logmein:now username="Guest" expire="1000"}
{/if}
Thanks!
Ben
11 August 2008
hi peter,
the code you are using is actually working exactly as it should. the reason that it is logging users in as guests when they are not in the usergroup 3 is because of how EE templates process conditional statements - the content of the statement is not outputted, but it is processed.
so this code for example:
{if false}
{exp:logmein:now username="Guest" expire="1000"}
{/if}
will log the user in as a guest even though it should not!!
the solution? add the following code to the top of the now() function after the global declarations:
if ($SESS->userdata['group_id'] != 3)
{
return;
}
Peter
12 August 2008
Ben, It worked! thank you. Based on the code above I also modified the plugin with the following code which prevents logout of certain groups that you don't want to log out when they visit a page with the logmeout tag:
$group_id = $SESS->userdata['group_id'];
if ($group_id == '5' OR $group_id == '1' OR $group_id == '4')
return '';
else
if ($group_id == '6')
$group_id = $SESS->userdata['group_id'];
Simply put this code in the logout function after the globals. In this example only member group 6 will be loged out when they visit a page with the logout tag.
Cheers
Ben S
03 September 2008
Ben,
I successfully edited the plugin to not run when a user is already logged in within certain member groups.
Would you consider adding this functionality in so that it could be called from the tag, i.e.,
{exp:logmein bypass_member_group="1,4,6,9"...}
I would do it myself, but I suck at php.
Thanks,
Ben
James
13 October 2008
Hey Ben-
Does this plugin allow you to dynamically create a login? I want any visitor to the site to be able to post via the SAEF, but I would also like that user to be able to get notifications to comments made. So I was thinking that if they were automatically created as a user and made an author then they could get notification on comments.
This would of course require that as part of the SAEF they include their email and maybe just an autogenerated username/password (maybe using a timestamp).
Would this be possible with your plugin, or does it just log anyone in as the same user.
James
Ben
14 October 2008
hi james, i'm afraid the functionality you are talking about is beyond the scope of this plugin. it could be added in future, but would probably be better off as a new plugin.
James
16 October 2008
hey ben-
how long and how much would it take to get you started? you can email me if you want.
james
Ron van der Plas
20 October 2008
Hi ben,
Thanks for this great plugin. I have EE 1.6.4. Somehow the expire doesn't work. Can I check the cookie if it has the right parameters. What name has the cookie? Does EE have any parameters to set login? I have configured EE to use cookies.
kev
19 January 2009
any way to login , discreetly? like getting rid of the popups that show it being logged in... thx
dk
18 February 2009
Nice plugin Ben, but having trouble getting it to work. I'm running EE 1.6.7. Got a SAEF coded like this...
{exp:logmein:now username="guest_user"}
{exp:weblog:entry_form weblog="directory" return="advertise/thanks" preview="advertise/place_an_ad"}
...form stuff here
{/exp:weblog:entry_form}
{/exp:logmein:now}
Double-checked my user and member group privileges and all is well. Doesn't even work with a super admin username. Am I missing something?
Ben
18 February 2009
dk: the logmein tag is a single tag, the closing tag should not be there.
dk
18 February 2009
Doh! Sorry, didn't realize. All is well now, thanks.
Jason Hudnutt
22 February 2009
This is great! I do have one question though. On my blog entry page I need to have the {exp:logmein:logout} run before the comment entry form.
Any ideas? My forms come up with the LogMeIn user, which it should, but I don't want visitors to have to remove the fields.
I removed the value from the fields but I am still trying to find a way to remove the fields with the plugin.
Ben
23 February 2009
removing the values from the fields sounds like the best solution, unless you can make the guest email and name blank...
Jason hudnutt
23 February 2009
BTW, the links to other people's websites are showing up as "http://www.putyourlightson.net/projects/www.invokedprojects.com" I'm guessing something to do with http:// ?
Justin
06 March 2009
This plugin rocks. Thanks.
I just thought I'd share an experience with the SAEF that may help someone else.
I put logmein in my header template, but even after doing that, a SAEF in another template never worked right. You would have to refresh the SAEF to see the form. I think the SAEF was being rendered prior to the embedded template containing the logmein. Moving logmein into the same template as the SAEF fixed it.
Justin
Nate
20 March 2009
Does anyone know how to make it so I don't have to approve each entry made under the SAEF? I want the entries to post right away...GREAT PLUGIN BTW!!
Justin
09 April 2009
Howdy-
We're having an intermittent issue with the plugin. It needs some code samples to explain, so I put it in the forums: http://expressionengine.com/forums/viewthread/111158/. If you have any ideas for us, we welcome 'em!
Thanks!
JM
09 April 2009
I'm trying to use this GREAT plugin with a session variable and it's not working - specifically:
When I have this in my template it works:
{exp:logmein:now username="test@test.com"}
When I have this in my template it doesn't log me in:
{exp:logmein:now username="{exp:session_variables:get name="eml_address"}" parse="inward"}
I know the session variable "eml_address" is set to "test@test.com" as I can output it in the template?!
Thoughts?
Thanks!
JM
Ben
09 April 2009
JM: you're trying to run the session variables plugin within the logmein plugin and i assume the parse order is not correct - in other words, the session variables plugin is not being parsed before the logmein plugin. i'm not sure if there is a solution to this i'm afraid
JM
09 April 2009
Thanks Ben. I'm relatively new to EE/PHP and this has been one of the hardest things for me to get my head around. EE/PHP seems to be SEVERELY LACKING in how it handles simple variables?! I mean, I've got a plug-in that is setting a good-old nothing fancy session variable. And I want to use that variable in an EE template. It's like pulling teeth!?
Is there anyway to pass any sort of variable (session or not) to this "logmein" plugin??
Thanks,
JM
Ben
10 April 2009
i understand where you're coming from - templates are limited in that regard.
you can use global template variables (http://expressionengine.com/docs/templates/globals/index.html) with the plugin, such as {username} or {email}. not sure exactly what you're trying to pass though.
Melissa
14 April 2009
Thanks so much for the plugin!
I have one issue - I have a {exp:logmein:logout} on the member register page to get rid of any "priveleged guest" login, but it parses after the captcha is loaded. SInce I have captchas not be required for logged in members, and required for member signup, the captcha doesn't show up since it still sees a member logged in. Is there any way to get the logout to parse before the captcha?
Ben
15 April 2009
hi melissa, this issue is due to EE's parse order. can you ensure that {exp:logmein:logout} is called before the login form is. let me know if it makes a difference?
Melissa
16 April 2009
I put it at the very beginning of the template before the form, and no difference...
Melissa
21 April 2009
I figured out a solution, in case anyone else encounters this problem.
I made all the links to the register page to logout and redirect using the Logout Redirect plugin. Problem solved!
Todd
24 April 2009
After reading through several of the comments on this plug-in... it seems that the plug-in should be wrapped in a big IF statement. IF a user is already logged in... then treat them as they would normally be treated... but if a user is not logged in... then temporarily log them in as a member of whatever group is necessary. On the log-out page... it should probably only log out the members who are NOT part of the temporary group.
Todd
24 April 2009
Correction to my above post. Argh!
The log-out page should only log out members who ARE part of the temporary group.
Sorry about that.
Marc
29 April 2009
Thanks so much! I have your plug in working fine, but want to share one issue I see.
When I include the param if_member_group="6", then it does not work, but when I leave it out, it does. Not sure why -- the group id is correct, and is the group my user account is assigned to.
If you'd like to debug, I'm happy to assist.
Thanks, again!
Ben
30 April 2009
marc, it should be {if member_group=="6"}
James
04 June 2009
Hi Ben, fantastic plugin - I've almost got it working really nicely but I have an issue which I can't track down... Not sure whether it's related to your plugin or whether it's caused by FieldFrame or nGen File, but maybe you might have an idea? I've posted it here:
http://expressionengine.com/forums/viewthread/110252/P252/
J
Lamar
10 June 2009
I'm working on a new website for my organization. A requirement was that it authenticate users against our existing database. We hired a programmer to help link up the database with ExpressionEngine, and he made use of LogMeIn. It works pretty well -- to some degree. Users can log in and view members-only content and leave comments. However, we haven't been able to figure out how to allow them access to the forums (which are restricted to logged in members only). Any ideas?
trv
29 July 2009
I am trying to use logmein with SAEF but keep getting the "you must be logged in to submit" error message.
If I parse out the {group_id} info - I see group 60, the member group my logmein user is part of. But looking at {group_name} it always shows "guests". {Group_name} should be the group name for {group_id} correct?
Lamar
03 August 2009
Has anyone had any issues with using logmein with EE 1.6.8? We had a custom system created to authenticate our organization members off our existing database that used logmein, and since I updated the site to 1.6.8, the login feature hasn't worked. I'm trying to narrow down what might be the problem, and at the moment, I can't seem to get the logmein plugin to work at all.
credit card
04 August 2009
Wow that's interesting, it will help in making work more efficient I believe.Thanks for the mention, This shoes that you put a great deal of care to your work.
Shotwell
10 September 2009
This looks cool (we built something similar to log someone in simultaneously with a comment).
I also used Freeform on a client's site once due to the same issue this plugin solves. If you don't need the data to populate a weblog entry then it works great, otherwise here we are, back to LogMeIn. :)
jt
05 October 2009
Quick question. Will this work with just the core version of EE. I am wanting to use it on a non-profit site but wanted to see if it was possible.
Ben
06 October 2009
yes it will work with any version of EE
Tim
14 October 2009
yes, any version (1.5, 1.6 etc), but core does not contain the membership module, so probably not core. ??
and also, I have lots of trouble with the "you must be logged in" error. Is there some particular security setting in EE that must be used,
session or cookie or both?
Dave Smay
19 October 2009
Very nice.
Will
18 November 2009
Hi and thanks for this amazing plug in !
I'm kind of having a problem here : when i want to register has a new member ee tells me that I'm already logged in and won't load the register form.
the logmein tag is on the index and the register form is loaded with ajax when you click on "become a member"
any ideas ?
Thanks a lot
Will
Ben
18 November 2009
hi will, try deleteing or disabling your cookies. chances are you're not being logged out of EE properly.
therooster
30 November 2009
great plugin!! thax
Anna
21 December 2009
The plugin is not working with 1.6.8.
The user shows up as logged in when printing out {username} or {member_id} but the SAEF never shows.
The SAEF does show when I log into the CP as the user.
Seems like the problem is specific to incomplete cookies set by this plugin.
Anna
21 December 2009
In 1.6.8....
With the Logmein tag in the header, I get the correct member id (2) when I print out the {member_id} tag but the SAEF does not show.
When I use PHP to print the member_id, I get the incorrect member id (0).
Here is my PHP
global $SESS;
echo $SESS->userdata['member_id'];
----
Why aren't these matching? Obviously the member_id printed using PHP is the correct one because the SAEF isn't showing.
Gregory
08 January 2010
Hi Ben,
I didn't want to log out members and to login them as fake ones, so
I've added the following code at the top of now():
if ($TMPL->fetch_param('do_not_logout')) {
if ($SESS->userdata['username'] != '') return;
}
It would be nice to get it inside your official release.
jessicca
23 January 2010
now it seems to be very easy for anyone to use a plugin and know more about it.
jessicca
23 January 2010
now it seems to be very easy for anyone to use a plugin and know more about it.
» View all comments
Leave A Comment