Login Block on main page

Login Block on main page

by John Garvey -
Number of replies: 25

Hi,

I have recently configured a moodle for my wife (she is a teacher).  I have used version 1.6.  She has asked me to get the login block on the main page of the site, whereas at the moment, you have to click 'login' in the top right of the screen which opens up a new page.  I queried whether this was possible, but she has shown me a moddle where this is the case.  That moodle is version 1.5.  Can anyone assist me to get a login block on the main page.  I have looked at the 'sticy blocks' menu, but 'login' block is not listed.

Cheers.  John

Average of ratings: -
In reply to John Garvey

Re: Login Block on main page

by Chardelle Busch -
Picture of Core developers
Have you tried turning editing on on the front page, then adding it from the blocks menu?
In reply to Chardelle Busch

Re: Login Block on main page

by John Garvey -
Yes, but login is not listed on the blocks menu
In reply to John Garvey

Re: Login Block on main page

by silly billy -
Am having the exact same problem. Have searched the forums but to no avail sad
In reply to Chardelle Busch

Re: Login Block on main page

by Jeremy Knox -
I have the same problem.  We have a fresh install of 1.8.  The login block appears in admin/modules/blocks but does not appear as a selection in the dropdown box for adding blocks on the frontpage when in edit mode.  I cannot find anything else in the forums about this.  Any help would be greatly appreciated.
In reply to John Garvey

Re: Login Block on main page

by Vernon Williams -
Hi,

I am having exactly the same problem. Have you managed to solve it? If you have would you be good enough to let me know how this was done.

Many thanks,

Vernon Williams
Subject Leader of ICT
The City of Portsmouth Boys' School
vwilliams@cityboys.org.uk
www.cityboys.org.uk
In reply to Vernon Williams

Re: Login Block on main page

by Mat Cannings -
If you are logged in as admin and editing is on, then the login block should be showing somewhere but will just be a title with edit icons, or should be in the blocks dropdown menu. If that is definitely not happening then you may be able to manually edit the database to add the block. I would only do this if you are sure all else has failed.

Do not do this if you are unsure about using phpMyAdmin or do not fully understand the instructions, you will not need to delete anything so should not cause any damage.

Get a pen and paper handy and follow these steps very carefully.

1. In phpMyAdmin have a look at the table mdl_block in the name column find login, check the number in the id column and make note of it.(mdl_ is the prefix I chose when setting up moodle, your prefix may be different)

2 View mdl_block_instance table and reorder the columns based on pageid (click on the pageid column heading).
All the rows with pageid = 1 are details for blocks on the homepage. See if you have a row where blockid matches the number that was noted in step 1. If there is one make sure the visible column has 1 in it, if not then edit the row and change to 1. This should fix your problem. If not then move on to step 3 (only do step 3 if you are sure there is no row with pageid=1 and blockid the same as the value from step 1)

3. Have another look at the all the rows where pageid = 1, you should notice that there are some that have l and some that have r in the position field, these represent the blocks on the left and right of the homepage, hopefully you should also notice that in the weight column you have values ranging from 0 to however many blocks you have on that side. Make note of the highest weight value where the position is l.

4. Insert a new row in this table, do not enter a value in the id field, enter the value from step 1 into blockid, enter 1 into page id, enter course-view into pagetype, enter l into position, for weight enter a value 1 higher than the value found in step 3, in visible select 1 and then put nothing in the configdata field. Save this newly entered row.

You should now have a login button on the homepage on the left hand side at the very bottom.


Average of ratings: Useful (1)
In reply to Mat Cannings

Re: Login Block on main page

by Amy Riebli -

I, too, am having a similar problem.  

I have chosen it on the dropdown list and it adds the block, but it is blank, and when I turn editing off it disappears.  Do I have to configure it some how?  If so, how do I go about doing that?

In reply to Amy Riebli

Re: Login Block on main page

by Martin V -
When the login block is added in editing mode it appears to be blank. If it then 'disappears' when one ends editing mode, that's OK, because it is only supposed to appear when one is NOT logged in. Either log out to see if the block is working, or simply open the site in another browser.

Regards.
In reply to Mat Cannings

Re: Login Block on main page

by ray s. -
I am trying to add a login block on the frontpage of my site, but do not see the login block. Is there another way around having to mess with the db to add a login?

regards
In reply to ray s.

Re: Login Block on main page

by Jason Meinzer -
I recently ran into this problem and while I can't recommend the fix I ended up using, I did discover this workaround that doesn't involve editing the database. If "Login" is not appearing in the list of blocks, edit lib/blocklib.php and find this function:

function blocks_get_missing(&$page, &$pageblocks) {

$missingblocks = array();
$allblocks = blocks_get_record();
$pageformat = $page->get_format_name();

if(!empty($allblocks)) {
foreach($allblocks as $block) {
if($block->visible && (!blocks_find_block($block->id, $pageblocks) || $block->multiple)) {
// And if it's applicable for display in this format...
if(blocks_name_allowed_in_format($block->name, $pageformat)) {
// ...add it to the missing blocks
$missingblocks[] = $block->id;
}
}
}
}
return $missingblocks;
}

Add this line right above "return $missingblocks;":

$missingblocks[] = <your login block id>;

Where <your login block id> is found in the login block links under Modules/Blocks/Manage Blocks. That is, if you mouse over the "Delete" link for the login block, you should see a URL ending with "...delete=XX&sesskey=...". In this example, the ID is XX, so you'd add $missingblocks[] = XX; above return $missingblocks; and then it should appear in the menu.
In reply to Mat Cannings

Re: Login Block on main page

by Philippe Verdenal -
I am running Moodle 1.8.2 (2007021520), MySQL 4.1.22, PHP 4.4.7.

I checked [mdl_block] and [mdl_block_instance]. As per your previous post, everything is OK in both tables (login block with correct configuration).

The login block is shown only in editing mode (not visible in normal mode).
There is absolutely no way to see it in the front page...

I have read for a while quite a few discussions referring to this issue but none of them gives a reliable solution.
Should a new issue be raised in the Issue Tracker?

Thanks for any assistance.
Cheers.

In reply to Mat Cannings

Re: Login Block on main page

by Rafael Ortiz -
Thank you, Mat Cannings! I was trying to solve this problem many days ago. I had to do every steps, but finally I made it. Great solution.

¡Gracias, Mat Cannings! Hace días estaba tratando de resolverlo. Tuve que hacer cada paso, pero finalmente lo conseguí. Gran solución.

In reply to Rafael Ortiz

Re: Login Block on main page

by Neil Winton -
Hi everyone. I'm having the same problem (running 1.9). While I accept that the solution outlined above may work, I'm not up to the job of editing the files.

Is there no easy workround of this problem? (Like making the Login block available in the dropdown block selector?) This is surely a pretty common request...
In reply to Neil Winton

Re: Login Block on main page

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hi Neil smile We've met elswhere in cyberspace! If you are running 1.9 and you have admin rights on the front page then you absolutely should be able to turn editing on, choose ' add a block' and find log in there. If you can't then I suggest going to siteadmin on the front page >blocks>manage blocks and checking that the login block isn't actually hidden -ie, has its eye closed. If it is, open its eye and try again.
In reply to Mary Cooch

Re: Login Block on main page

by Neil Winton -
Hi Mary! Long time no speak, hope you're well and keeping busy.

I've checked to see if the block is hidden, but no joy sad . I've resorted to making it mandatory to sign in to the site so that'll take care of the log in problem, but it's not ideal.

Having done a further search on these forums, I see that it's a fairly common problem... all of which suggests to me that there might be a glitch in this version of Moodle.
In reply to Neil Winton

Re: Login Block on main page

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Is the issue here actually trying to login without opening a new window or is it trying to get a login block on the side? Because you make a login block yourself by adding an html block and hyperlinking to the login page I suppose - but then you still get sent to a new window sad
In reply to Mary Cooch

Re: Login Block on main page

by Neil Winton -
I see what you mean. I was hoping to have a login block on the front page so that it was easy to spot. The standard login links at the top and bottom of the page are fine if you know where they are.

I had this on our earlier install, but am in the process of revamping it having upped to 1.9… I'm almost sorry I bothered now!

Oh well… roll on version 2.0. wink

Thanks for your help.
In reply to Neil Winton

Re: Login Block on main page

by Jenny Gray -
I have a standard 1.9.2 install with the normal login block on the home page, no problems. There must be some configuration thingy you need to tweak. Sadly I'm not sure what else to suggest.

Have you tried the instructions from Mat Cannings further back in this thread (March 07)? They should still be valid. Also, make sure your debugging level is set up high in case there are any useful error messages being output. (You can set that at Site administration > Server > debugging, and I apologise if that's teaching you to suck eggs).
In reply to Mat Cannings

Re: Login Block on main page

by Shail Jai -

I just want to say …… Excellent …….

thnx but i have also some problem can u help me..

i want to design my site like this.

http://www.itil-campus.com/moodle/

thnx in advance if u can guide me but keep in mind that i am new in this field.

once again thnx

In reply to Shail Jai

Re: Login Block on main page

by Judy Perry -
Nice skin!

Where'd that come from?

Does anyone have a good way of setting up polls ala Slashdot?
In reply to John Garvey

Re: Login Block on main page

by titus permadi -
Hii, I've solved this problem (i use moodle 1.9)

1. Login first
2. Go to Users Menu, chose Edit your profile
3. Choose Tab: Roles
4. Click: Administrator
5. Select Role to Assign: Administrator
6. Choose your Name/email, then Add
7. Click: Assing roles in User: Admin User
8. Back to: Front Page Setting
9. Click: Turn Editing On
10. Look at Block: Choose Login
11. That's all

From:
Titus Permadi

In reply to titus permadi

Re: Login Block on main page

by ramya yanamaddi -
thanks, for your post, working f9
In reply to ramya yanamaddi

Re: Login Block on main page

by Louis Gephardt -
I was successful in adding the Login block to my Blocks menu and adding it to the Frontpage settings area. However, when I log out it disappears. Does anyone have any idea how to get it to display when the user hasn't logged in yet (you know... when you would *need* it?)

v1.9