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.

Linking from Front End to Back End

November 17, 2010 2:02pm

Subscribe [4]
  • #1 / Nov 17, 2010 2:02pm

    squiid

    39 posts

    Hi,

    I’ve successfully set up an “Edit This” link many times like this:

    {if member_group == 1 OR member_group == 6}<br><a href="http://{cp_url}?S=0&D=cp&C=content_publish&M=entry_form&channel_id=7&entry_id=53&use_autosave=nclass=hand">Edit This » </a>{/if}

    I just deployed a site to a client’s server, and any link like this is redirecting to the login form. However, the user is definitely logged in.

    I’m wondering if you guys can give me a clue about why this might be happening. Since it works on many sites on my development server, but not on client X’s server, I’m wondering if it’s a misconfiguration with cookies or something like that?

    Thanks in advance for your help 😊

    Shaun

  • #2 / Nov 18, 2010 8:21am

    Sue Crocker

    26054 posts

    Shaun, what’s happening? Is the link not there, or does it go to the wrong place in the back end?

    How are you determining they’re logged in?

  • #3 / Nov 18, 2010 11:12am

    squiid

    39 posts

    Sue,

    [It might be easier to see this weird behavior yourself, I attached the site and login info to this post. I’ll try and explain in words below:]

    The way I know the user is logged in is because the “Edit This” link only shows up after log in by someone in member group id #1 or #6.

    When the link is clicked, instead of going to the appropriate Edit page in the CP, it redirects to a login form:

    http://example.com/system/index.php?S=0&D=cp&C=login&M=login_form&return=Qz1jb250ZW50X3B1Ymxpc2gmYW1wO009ZW50cnlfZm9ybSZhbXA7Y2hhbm5lbF9pZD0xMCZhbXA7ZW50cnlfaWQ9NTE=

    At this point, if I try to visit any page in the CP, I’m redirected to the login form. The weird part is this: if I go back to the front end, and click refresh, I’d expect the Edit This links to go away since it seems like I’m logged out, but no, they’re still there!

    If I then go to a CP page, type in the credentials, I am logged in to the CP (but of course the links still dont’ work, and repeat this whole process)

    If I click Log Out, I’m really logged out, and I can tell this by the fact that the Edit This links disappear on the front end.

    Weird.

    Shaun

  • #4 / Nov 18, 2010 7:45pm

    Sue Crocker

    26054 posts

    It still could be an issue of having your control panel backend set to Sessions and Cookies. If you haven’t changed that, the session may have expired. If you switch to Cookies Only, you should be OK. One other issue could be the difference between www and non-www versions of the site. Might that be the issue?

    See: http://eehowto.com/howto/articles/howto-add-an-edit-this-link-in-ee2

  • #5 / Nov 18, 2010 8:47pm

    squiid

    39 posts

    Setting the Control Panel Session Type to Cookies Only worked! Thank you 😊

    One more quick question—

    should I use logged_in_group_id, as in the article you linked, or member_group, or group_id in the conditional? Does it matter whether I’m inside or outside an {exp:channel:entries} loop? I’ve seen different answers in various places and just wanted to know the “official” answer.

    Thanks again!

  • #6 / Nov 19, 2010 11:12am

    Ingmar

    29245 posts

    Yes, scope matters. If you’re using “logged_in_group_id”, that’ll work with or within a loop and is therefore preferred by many.

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

ExpressionEngine News!

#eecms, #events, #releases