logout w/o "do you really log out"-page? (v.2.2/postit, allc)

logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -
Number of replies: 16

Hi,

Our users want to log out w/o having "Do you really log out" page like on Afterburner and Standard? 

themes: Postit, Allc (2.2.2+)

 

Found the code in renderers.php (Afterburner), but...

// Add a login or logout link
if (isloggedin()) {
$branchlabel = get_string('logout');
$branchurl = new moodle_url('/login/logout.php');
}

 

 

Average of ratings: -
In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

And your question is?

What is w/o suposed to mean?

Please be more specific?

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -

Hi,

1) Afterburner, Standard

When you log out, you don't get an extra page saying, "do you really want to log out?" and log out w/o any warning.

2) postit or allc,

You do.

login/logout.php

 

Our users don't like it...

In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Are you sure you mean Afterburner?

To stop this happening in Post-IT you need to change the link to this...

<a href="<?php echo $CFG->wwwroot.'/login/logout.php?sesskey='.sesskey(); ?>">

That should fix it.

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -

Afterburner on my test Moodle 2.2.4+ doesn't lead to the page.

"Log out" is linked to  exactly the same as w/ Standard.

 

Web inspector on Safari showed,

full URLs

1. Afterburner

http://localhost:8888/moodle22/theme/index.php?device=default&choose=afterburner&sesskey=pEOxoxSke7 

2. Standard

http://localhost:8888/moodle22/theme/index.php?device=default&choose=standard&sesskey=pEOxoxSke7

So they behave same?

 

I found the similar code somewhere (I can't remember). So it should be (), empty.

<?php echo $CFG->wwwroot.'/login/logout.php?sesskey='.sesskey(); ?>

 

 I'll test it today.

Thank you again.

In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

If you use the LOGOUT in Afterburner menu it goes to the confirm logout page as the image shows. However if you choose the Logout in the top right of the header that is normal Moodle logout, which is what you must be meaning.

Anyway the session key is what triggers the quick exit.

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -

Thank you. It worked.

>if you choose the Logout in the top right of the header that is normal Moodle logout, which is what you must be meaning.

Yup.

 

re: allc based theme,

I'm repairing a theme based on allc. This theme's custumised too much sad (I didn't do this!).

1) profileblock and frontpage are added

profile.php

<li><a href="<?php echo $CFG->wwwroot'/login/logout.php?sesskey='sesskey(); ?>">><img src="<?php echo $OUTPUT->pix_url('profile/logout', 'theme')?>" />&nbsp;<?php echo get_string('logout');?></a></li>

I added the code you gave me.

 

frontpage.php

<div id="profile_logout">
<a href="<?php echo $CFG->wwwroot; ?>/user/profile.php"><img src="<?php echo $OUTPUT->pix_url('profile/profile', 'theme')?>" />&nbsp;<?php echo get_string('myprofile');?></a>&nbsp;&nbsp;|&nbsp;<a href="<?php echo $CFG->wwwroot; ?>/login/logout.php"><img src="<?php echo $OUTPUT->pix_url('profile/logout', 'theme')?>" />&nbsp;<?php echo get_string('logout');?></a>
</div>

 

Q: how can I change the blue-coloured code so Logout can work as normal Moodle logout?

In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

This line is wrong...or you copied it wrong?

<?php echo $CFG->wwwroot'/login/logout.php?sesskey='sesskey(); ?>

It should be this...you missed off the 'concatenate' dots which are VERY IMPORTANT!!! 

<?php echo $CFG->wwwroot . '/login/logout.php?sesskey=' . sesskey(); ?>

CLICK HERE TO LEARN MORE ABOUT PHP 

<?php echo $CFG->wwwroot . '/login/logout.php?sesskey=' . sesskey(); ?>

To answer your question, the code above (green on black) is what you need for both.

 

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -

? I didn't copied the code and missed the dot.

I did it even for frontpage.php, but didn't work. So I wondered which file I should look into...

"Logout" beside You are logged in as... works as normal Moodle logout like on the original Allc.

In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Sue,

I am wondering now are we talking about the same thing?

What are you trying to do?

  1. Do you want to have "You are logged in as Sue (Logout) in top right corner of page?
    or
  2. Do you want the original profile.php to work as normal logout?

The code for each is as follows:

  1. <?php echo $OUTPUT->login_info();  ?>
  2.  <div id="profile_logout">
    <a href="<?php echo $CFG->wwwroot; ?>/user/profile.php"><img src="<?php echo $OUTPUT->pix_url('profile/profile', 'theme')?>" />&nbsp;<?php echo get_string('myprofile');?></a>&nbsp;&nbsp;|&nbsp;<a href="<?php echo $CFG->wwwroot . '/login/logout.php?sesskey=' . sesskey(); ?>"><img src="<?php echo $OUTPUT->pix_url('profile/logout', 'theme')?>" />&nbsp;<?php echo get_string('logout');?></a>
    </div>

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -

Both.

Because I somebody else modified the allc, I don't know what's gone wrong yet.

It still leads to "do you really want to log out".

My own themes or themes I've modified have no problems now, because I know what I've done.

In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

In that case can you upload the frontpage.php so I can see what changes have been made, then I can offer a solution so that you can correct it in your copy.

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -

Voila.

Thank you for your help in advance...

In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Sue, It looks like you changed the wrong part of My Profile.

If you look in frontpage.php you will see that you put the session key code in the wrong place (see pink highlight)...so the old login code is still there!!! (see red underlined text). There is also a "> missing off the profile link.

<div id="profile_logout">
    <a href="<?php echo $CFG->wwwroot . '/login/logout.php?sesskey=' . sesskey(); ?> "><img src="<?php echo $OUTPUT->pix_url('profile/profile', 'theme')?>" />&nbsp;<?php echo get_string('myprofile');?></a>&nbsp;&nbsp;|&nbsp;<a href="<?php echo $CFG->wwwroot; ?>/login/logout.php"><img src="<?php echo $OUTPUT->pix_url('profile/logout', 'theme')?>" />&nbsp;<?php echo get_string('logout');?></a>
</div>

The code you need is this - use ALL of it to replace what is there. Or use my file...whatever is best for you.

<div id="profile_logout">
    <a href="<?php echo $CFG->wwwroot; ?>/user/profile.php"><img src="<?php echo $OUTPUT->pix_url('profile/profile', 'theme')?>" />&nbsp;<?php echo get_string('myprofile');?></a>&nbsp;&nbsp;|&nbsp;<a href="<?php echo $CFG->wwwroot.'/login/logout.php?sesskey='. sesskey(); ?>"><img src="<?php echo $OUTPUT->pix_url('profile/logout', 'theme')?>" />&nbsp;<?php echo get_string('logout');?></a>
</div>

 

Cheers

Mary

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by sue sugizaki -

Ooops. blush

Thank you again for your help. It works... needless to say.

In reply to sue sugizaki

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Success at last!

Cheers

In reply to Mary Evans

Re: logout w/o "do you really log out"-page? (v.2.2/postit, allc)

by christian iraola -

Wow, i've been looking for this for so long. Thanks sue for bringing this up and of course to the ever helpful Ms Mary Evans, thank you so muchsmile