General developer forum

 
 
Peacock
Sticky blocks - default weight
 

How can I assign default weight to course blocks across the site? Say for example, I would like to set default weight for the following blocks as:

  • Latest news -9,
  • Activities -8,
  • Recent Activity -7,
  • Upcoming events -6 etc.

I would like to maintain consistency across the courses.

 
Average of ratings: -
Picture of Oliver Stearn
Re: Sticky blocks - default weight
 

Hi Indira,

Maybe this link is helpful?

You should be able to go into any block and set the default region and weighting (if you are an admin). You can also set which courses it appears on i.e. to get it to appear on all courses you need to set the default to 'any type of course main page'. It should keep the defaults across all the courses it appears on (unless there is a weighting conflict).

Hope that helps smile

 
Average of ratings: -
Peacock
Re: Sticky blocks - default weight
 

Hi Oliver,

I know how to set default weight on each course page. But, I need to make a herculean effort to do so for 400+ courses for each semester. So, I'm looking for a code customization for adding default blocks to a  newly created course with Any type of course main page option. Any type of course main page option is not available for configuring blocks on site home (attached screenshot).

Regards,
Indira

 

 


 
Average of ratings: -
Picture of Richard Oelmann
Re: Sticky blocks - default weight
Group Particularly helpful MoodlersGroup Testers

No, but there is a work around

Add the blocks on the site home page, which allows you to set the Display anywhere and creates the block as a system level block

Then go to a course and modify that to show on any course main page -

the block will stay as a system level block (rather than having a specific course/category as its original location) and will now appear on course pages in the region and with the default weight it has been given

HTH

Richard

Edit: The other alternative although I dont think you can set specific weights, but you can set default regions/order, is to edit the default blocks on a page so that new courses have the blocks you want added - I believe you can do this in the site config.php.

 
Average of ratings:Useful (1)
Peacock
Re: Sticky blocks - default weight
 

Thanks Richard for the work around.  It's useful.

 
Average of ratings: -