Blocks ::: block_links
Maintained by Stephen Bourget
This block is allows a site administrator to display links to users based on specific user profile fields
Latest release:
215 sites
21 fans
Current versions available: 4

This block is allows a site administrator to display links to users based on specific user profile fields


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3


Stephen Bourget (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Fri, Jun 24, 2016, 4:14 AM
    I've added some documentation which should explain that, but if you have data in the user profile fields then you can restrict the link so it will only be displayed to users who have the matching information in their user profile (We use the block here where we have multiple schools sharing the same Moodle install and we want to display different resources to different users based on where they are located) It works well if you have your user information sync from an external system like LDAP and lock the profile fields that you are storing the user specific information. (In our case it we use institution)
  • Fri, Aug 12, 2016, 5:04 PM

    Hi Stephen. Thanks for clarification and for adding the info. It helped and I was able to test the plugin successfully.

    One thing I found not intuitive to me is that I would naturally expect that links are stored per block instance, not globally. I can imagine that in your particular use-case, cross-site management of links is easier though. Still, maybe it is something you should elaborate a bit in the plugin description. Otherwise I found the code readable and following Moodle coding standards. Well done on that.

    I am happy to approve this block now. You are cleared to land, welcome to the Plugins directory.

  • Tue, Aug 23, 2016, 2:58 PM
    Thank you for this useful plugin! But how can we add more profile fields to be selected instead from these 4 (institution, department etc)? Which files can i edit?

    Moreover, can we add custom profile fields?

    Thank you!
  • Tue, Aug 23, 2016, 10:10 PM
    To add new fields, you will need to do the following:

    1. Create a constant for the field you want to use.

    2. To add the field to the drop down list, you need to edit the settings.php file and add the constant to the array

    3. Then add an additional condition to the select case structure to match the link to the user:

    It should be possible to a custom field as well.
    Should you add other fields, feel free to submit a patch or pull request to github.
  • Wed, Aug 24, 2016, 3:02 PM
    Thank you Stephen for your reply and your help!

    There is an extra step as well.

    4. Add an additional condition to the select case structure to select the availble values of field when adding a link. This case will be a query to distinct values of the specific field:
  • Sat, Aug 19, 2017, 7:10 PM
    Is there a way to get this plugin to work with version 3.1.3+?
    My organisation is not in the position to upgrade yet due to recruitment issues?
    This would solve my problem of access to some custom reports i have created in php/sql
  • Sun, Aug 20, 2017, 6:22 AM
    Yes, just use the version (M2.9 (2016062302)) It works with Moodle 2.9 - 3.2.
  • Mon, Aug 21, 2017, 6:37 PM
    Excellent Thank you smile
    Just one other thing. is it easy to add Description profile field to the dropdown list of field?
  • Sat, Aug 26, 2017, 5:44 AM
    It's possible to add it, but you would need to modify the code for the plugin. The areas you would need to modify are listed in the comment above from August 23 & 24 2016.
  • Tue, Sep 12, 2017, 1:17 AM
    How difficult would it be to make links appears as single buttons instead of text links? That might be way better in terms of graphical appearance. Thoughts?
  • Tue, Sep 12, 2017, 1:23 AM
    It's possible. You would need to modify the code for the plugin. You need to modify the add_link() function ( which is used to create the HTML for each link.
  • Wed, Sep 27, 2017, 11:10 PM
    Hi Stephen.. Is it possible to allow this block to be displayed on the front page or a page resource rather than just a course? My rational for this is to enable custom external report links available to certain groups based on a specific institution
  • Thu, Sep 28, 2017, 12:24 AM
    There is no restriction on where you can add this block. So it should be possible to add it onto the front page or on a report page as long as your theme supports adding other blocks in that location.
  • Thu, Sep 28, 2017, 4:55 PM
    Hi Stephen Thank you for the rapid reply just for information using Adaptable theme it does not provide the option in 'block' to add it on frontpage so do i need to contact theme developer?
  • Fri, Oct 27, 2017, 6:28 PM
    HI Stephen
    Thank you for an excellent plugin that has saved myself alot of work smile
    I have followed the posts regarding adding extra field (description) to drop downs but i dont understand what it is i need to do in step 4 of the instructions? I have added the field to settings and lib.php. Would you mind giving me some direction please?
1 2
Please login to post comments