Membership Auto Login

8 posts by 4 authors in: Forums > CMS Builder
Last Post: May 17, 2012   (RSS)

Re: [Illume Magazine] Membership Auto Login

By Jason - July 6, 2010

Hi,

Here is what you can try (Note that this example is assuming your using the signup form that came with the plugin)

First, you need to add a hidden field to the form to hold the page that the user was at previously. Add this to the end of the form:


<?php if(@$_REQUEST['previous']): ?>
<input type="hidden" name="previous" value="<?php echo $_REQUEST['previous'];?>" />
<?php else: ?>
<input type="hidden" name="previous" value="<?php echo $_SERVER['HTTP_REFERER'];?>" />
<?php endif ?>

</form>


The next change is to execute the login and the redirect. Closer to the top of the page you'll see a line that says:
_websiteLogin_sendSignupMessage();

This is the function that sends the email. We're going to add this code below it:

_websiteLogin_sendSignupMessage();
$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL']=@$_REQUEST['previous'];
_websiteLogin_login();


What this will do is set the redirect url to the page the user was at before going to the sign up form and then execute the login function.

Give this a try.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Membership Auto Login

By ILLUME-MEDIA-LABS - July 6, 2010 - edited: July 6, 2010

Hi Jason,

Thanks! This works perfectly. Now my question is that if I am using lightbox for the login/sigup/profile/reminder features, and if the user goes to the signup screen from the login screen, 'previous' just goes back to the 'login' screen and we get the message 'you have already logged in'.

How can we go back to the parent, and close the lightbox?

Also, are we able to add an avatar field for image upload? If so, how?

Re: [Illume Magazine] Membership Auto Login

By Jason - July 7, 2010

Hi,

So you're having a lightbox popup coming from the login page?

One thing you could do is have a login link in your header, so that it appears on every screen. Then, after a user has signed up, or logged in, you don't have to do a redirect at all, just close the window, then the user never moves off their current page.

Creating a file upload is a little more advanced. I've attached an example file for uploading an image.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Attachments:

uploadaddform.php 5K

Re: [Jason] Membership Auto Login

By RGC - May 15, 2012

I have downloaded the attached file and I am unclear which part of the code needs to be configured to allow members to upload files to the User Accounts menu MySQl table accounts where i have created a new field called uploads.

I know I have to have the correct path to the lib/viewer_functions.php file and I have changed line 5 $tableName ='news' to 'accounts'. But I do not know what gets configured next. Where do I define the new accounts field called uploads? and what other parts of the code need to be changed in order to get this feature working?
Rod

Re: [rgc] Membership Auto Login

By Jason - May 16, 2012

Hi,

It looks like you're on the right track. The only other thing you should need to do is tell the script the name of your upload field.

In the file, around line 91, you should see this:

<?php // load uploads
$fieldName = 'uploads';
$tempUploads = getUploadRecords($tableName, $fieldName, $recordNum, $preSaveTempId);
?>


Change the value of $fieldName from "uploads" to the name of the upload field in your accounts section.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Membership Auto Login

By RGC - May 16, 2012

Hi Jason .... Thanks for the response. I realize now the purpose of this code is to let the logged in user add a new record. This is not what I am trying to accomplish. I would like the logged in user to be able to add additional uploads to an existing field within an existing record - specifically the system generated Accounts table into their own account into a field called 'client-uploads'
Can you provide what this code will look like?
Rod

Re: [rgc] Membership Auto Login

By robin - May 17, 2012

Hey,

At the top of the script you using there are these options:
$tableName = 'news';
$recordNum = null; // you must set either $recordNum or $preSaveTempId to null
$preSaveTempId = @$_REQUEST['preSaveTempId'] ? $_REQUEST['preSaveTempId'] : uniqid('x');
$errorsAndAlerts = '';

For users to modify their own records, something like this should work:
$tableName = 'accounts';
$recordNum = $CURRENT_USER['num']; // you must set either $recordNum or $preSaveTempId to null
$preSaveTempId = null;
$errorsAndAlerts = '';

Then in the uploads setup, use the field you want:
<?php // load uploads
$fieldName = 'client-uploads';
$tempUploads = getUploadRecords($tableName, $fieldName, $recordNum, $preSaveTempId);
?>


Hope that helps,
Robin
Robin
Programmer
interactivetools.com