ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Automatic login & import using Datagrab and Logmein

July 30, 2012 6:52am

Subscribe [1]
  • #1 / Jul 30, 2012 6:52am

    Evolve Websites

    110 posts

    Hi there,

    I’m trying to setup an automatic import of data into EE using the Databrab (http://devot-ee.com/add-ons/datagrab) addon combined with CRON.

    - I’ve got the Datagrab import working correctly when I’m logged in.

    - I’ve also setup a template to run these imports that is working correctly.

    - When I tried to automate this using CRON, I realised that we needed to be logged in to be able to run the import

    - I then came across the Logmein addon (http://devot-ee.com/add-ons/logmein), which looks as though it may do what’s needed

    - I’ve added the addon and the relevant code to my template, but when I try to run this template I get the message ‘Error. You are not authorized to post in this channel

    - I’ve tried making the user that is being logged in have SuperAdmin priviledges, but it still doesn’t work

    - I’ve come across a thread (http://ellislab.com/forums/viewthread/201569/#944002) that seems to discuss something similar, but can’t seem to get it working

    Here’s the code in my template:

    <!-- 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.
    The expire parameter is optional and sets the expiration time in seconds of the cookie. -->
    {exp:logmein:now username="guest_importer" if_member_group="6" expire="300"}
    
     {exp:ajw_datagrab:run_saved_import id="1"}
     {exp:ajw_datagrab:run_saved_import id="2"}
    
    <!-- To log the current member out use: -->
    {exp:logmein:logout}

    Any help will be massively appreciated!

  • #2 / Jul 30, 2012 1:46pm

    Bhashkar Yadav

    727 posts

    Hi Tom,

    The login and import are running same time due to which you are getting this error i.e import isn’t getting that user is logged in.

    So the best way put the logmein tag in a template and import tag into another template.

    like:

    {exp:logmein:now username="guest_importer" if_member_group="6" expire="300"}
    {redirect="template_containing_import_tag"}


    I hope, it would help you.


    Best Regards,
    Bhashkar

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases