how to hide 'Courses' block before logged in

how to hide 'Courses' block before logged in

- shefali mittal の投稿
返信数: 4

Hi All,

I am using Moodle version 1.9.

I want to hide my courses block intially before user logged in. It should appear after the user logged in.

If anyone know the solution, please help me.

Many Thanks,
Shefali

shefali mittal への返信

Re: how to hide 'Courses' block before logged in

- John White の投稿
Shefali,

I presume you have already changed Front Page Settings pre-logon to none,none,none,none.

If you want to keep the courses block on the front page, but only show this post-loggon edit the file...

blocks/course_list/block_course_list.php

...find the lines...

function get_content() {
global $THEME, $CFG, $USER;

...and immediately next add...

if (!isloggedin()) {
return NULL;
}

Save and test well!

Regards,

John



shefali mittal への返信

Re: how to hide 'Courses' block before logged in

- Shane Elliott の投稿
画像 Core developers 画像 Plugin developers
Hi Shefali,

You can also use the roles in moodle to achieve a similar result:
1. Turn editing on;
2. Click on the "Assign Roles" icon on the block (roles)
3. Click the "Override Permissions" tab
4. Click "Guest"
5. Choose "Prevent" for the "View Block" capability

This is different from John's suggestion in that it will only affect this instance of the block whereas changing the code will affect all instances of the block. So just choose the solution that works best for you.

Cheers,
Shane.
shefali mittal への返信

Re: how to hide 'Courses' block before logged in

- Patrick Malley の投稿
Or ( to completely overwhelm you with options), add the following to a .css file:

.notloggedin .block_course_list {
display:none;
}