authentication buttons placing in header Aardvark Postit

authentication buttons placing in header Aardvark Postit

by Marcin Stanowski -
Number of replies: 3

Hi,

I placed authentication button in the header just above the login and password fields. The problem is that I tried manipulating with the code but I cannot make it any higher than this what I show in the  screen below. Can you hint on where to put include marker in the header. I did this in profileblock of Aardvark Postit.

Thanks a buch.

Marcin

Average of ratings: -
In reply to Marcin Stanowski

Re: authentication buttons placing in header Aardvark Postit

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

Hi You need to add this in Page...in the layout/defualt.php NOT profile OK

Try adding this...in between page and graphicwrap

<div id="page">
<div id="google-button"><!-- put your code here --></div>
<div id="graphicwrap">

Add this css to CSS in Aardvark Post-IT settings page

#google-button { position: relative; top: 0; right: 0;}

Then you can change values for top and right to make it sit where you want...OK?

smile

Mary

In reply to Mary Evans

Odp: Re: authentication buttons placing in header Aardvark Postit

by Marcin Stanowski -

Hi,

Thank you veeery much for kind help.

I did as you explanied and placed <div id="page">
 <div id="google-button"><?php include('gouth.php')?>
</div>
<div id="graphicwrap">

I added css code to custom css page of Aardvark Post-it setting, tried putting the css code manualy in files as well, but to no avail.

Of course, just as you suggested it helped a bit but I cannot position  it so the authentication buttons are over loging fields.

Actually the buttons seem not to repond to css changes.

Could you please take a look: http://e.poznajsiebie.org and tell me what I am doing wrong.

please, find gouth.php attached

Regards,

 

Marcin

<?php //get previous auth provider $allauthproviders = optional_param('allauthproviders', false, PARAM_BOOL); $cookiename = 'MOODLEGOOGLEOAUTH2_'.$CFG->sessioncookie; if (empty($_COOKIE[$cookiename])) { $authprovider = ''; } else { $authprovider = $_COOKIE[$cookiename]; } ?> <center> <br/><br/><br/> <?php echo get_string('signinwithanaccount','auth_googleoauth2'); ?> <br/><br/> <div style="width:'1%'"> <?php $displayprovider = ((empty($authprovider) || $authprovider == 'google' || $allauthproviders) && get_config('auth/googleoauth2', 'googleclientid')); $providerdisplaystyle = $displayprovider?'display:inline-block;':'display:none;'; ?> <div class="singinprovider" style="<?php echo $providerdisplaystyle; ?>"> <a href="https://accounts.google.com/o/oauth2/auth?client_id=<?php echo get_config('auth/googleoauth2', 'googleclientid'); ?>&redirect_uri=<?php echo $CFG->wwwroot; ?>/auth/googleoauth2/google_redirect.php&scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email&response_type=code"> <img src="<?php echo $CFG->wwwroot ?>/theme/YOURTHEME/pix/GOOGLELOGO.jpg" /> </a> </div> <?php $displayprovider = ((empty($authprovider) || $authprovider == 'facebook' || $allauthproviders) && get_config('auth/googleoauth2', 'facebookclientid')); $providerdisplaystyle = $displayprovider?'display:inline-block;':'display:none;'; ?> <div class="singinprovider" style="<?php echo $providerdisplaystyle; ?> padding-left: 20px;"> <a href="https://www.facebook.com/dialog/oauth?client_id=<?php echo get_config('auth/googleoauth2', 'facebookclientid'); ?>&redirect_uri=<?php echo $CFG->wwwroot; ?>/auth/googleoauth2/facebook_redirect.php&scope=email&response_type=code"> <img src="<?php echo $CFG->wwwroot ?>/theme/YOURTHEME/pix/FACEBOOKLOGO.png" /> </a> </div> <?php $displayprovider = ((empty($authprovider) || $authprovider == 'messenger' || $allauthproviders) && get_config('auth/googleoauth2', 'messengerclientid')); $providerdisplaystyle = $displayprovider?'display:inline-block;':'display:none;'; ?> <div class="singinprovider" style="<?php echo $providerdisplaystyle; ?>"> <a href="https://oauth.live.com/authorize?client_id=<?php echo get_config('auth/googleoauth2', 'messengerclientid'); ?>&redirect_uri=<?php echo $CFG->wwwroot; ?>/auth/googleoauth2/messenger_redirect.php&scope=wl.basic wl.emails wl.signin&response_type=code"> <img src="<?php echo $CFG->wwwroot ?>/theme/YOURTHEME/pix/MESSENGERLOGO.jpg" /> </a> </div> </div> <?php if (!empty($authprovider)) { ?> <br/><br/> <div class="moreproviderlink"> <a href='<?php echo $CFG->wwwroot . (isset($CFG->alternateloginurl) ? $CFG->alternateloginurl : '/login/index.php') . '?allauthproviders=true'; ?>' onclick="changecss('singinprovider','display','inline-block');"> <?php echo get_string('moreproviderlink', 'auth_googleoauth2');?> </a> </div> <?php } ?>
In reply to Marcin Stanowski

Re: Odp: Re: authentication buttons placing in header Aardvark Postit

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

Hi

You got this ALL wrong, both with the code I told you to add, you actually added another 'page' div which was not necessary...I thought I made that part clear? sad

The second thing is that you named your images in capital letters, like FACEBOOKLOGO. This is NOT ALLOWED in Moodle. ALL filesname and image names have to be in lowercase. So chane it to 'facebooklogo'

Thirdly you were using old php code for images it is now...

<php echo $OUTPUT->pix_url('imagename', 'theme'); ?> where imagename is the nam of you image and theme means it should be in the pix folder of your theme.

OK - to save you time I have corrected the mistakes in the attached file. But PLEASE make sure you change the names of the images to lowercase as I have done in the code, otherwise they will not work.

Now all you need to do is...

  1. put gouth.php inside your theme's layout folder like so... aardvark_postit/layout/gouth.php
  2. add the following code just BELOW <div id="page"> ... like so

    <div id="google-button"><?php include('gouth.php'); ?></div>

Last of all ...

Add the CSS I gave you before to Aardvarks CSS setting page. Unless you prefer to add the CSS directly into postit_styles.css you can.

Finally ...

Remember to Purge all caches by going to Site Administration > Development > Purge al caches

And that is it!

Hope this helps?

Mary