Home

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.

Download LogMeIn
Current Version: 1.2 (released 19 December 2008)

* Works with ExpressionEngine 1.6 and higher.

Top

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.

Top

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}
	
Top

Installation

  1. Download and unzip logmein.zip
  2. Upload pi.logmein.php to the system/plugins folder.
Top

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:

Top

Changelog

Version 1.2

  • Added if_member_group parameter

Version 1.1

  • Added expire parameter
  • Added logout tag

Comments

Blank Avatar
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

Blank Avatar
Rudolf
23 November 2007


This is so sweet ! Thanx for sharing it.

Blank Avatar
AJP
27 November 2007


This was a lifesaver! Thanks!

Blank Avatar
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.

Blank Avatar
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!

Blank Avatar
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

Blank Avatar
Lee
21 February 2008


Thanks for this really useful plugin. Lovely site you have here!

Blank Avatar
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!

Blank Avatar
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.

Blank Avatar
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.

Blank Avatar
Lee
11 March 2008


Ben, many many thanks. Do you have a donate link?

Blank Avatar
Ben
22 March 2008


just added one under the download link.

thanks in advance!

Blank Avatar
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):


$group_id = $SESS->userdata['group_id'];
if ($group_id == 1)
{
return '';
}

Blank Avatar
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!

Blank Avatar
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.

Blank Avatar
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?

Blank Avatar
Create Sean
28 May 2008


Just saw this on the EE forums and downloading now - thanks a bunch.

Blank Avatar
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

Blank Avatar
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...

Blank Avatar
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?

Blank Avatar
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.

Blank Avatar
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

Blank Avatar
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

Blank Avatar
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!

Blank Avatar
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;
}

Blank Avatar
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

Blank Avatar
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

Blank Avatar
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

Blank Avatar
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.

Blank Avatar
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

Blank Avatar
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.


Leave A Comment

name (required)
email (required but will be kept completely private)
website