Your Moodle version

Blocks: HTML (on profile field)

block_profilespecifichtml
Maintained by Picture of Valery Fremaux Valery Fremaux
This simple bloc allows outputing HTML content in a bloc with several versions based onthe check of custom profile fields values (2 checks)
30
334
1

This bloc is a clone of the standard HTML block but provides custom profile field control over the version of content which is displayed.

Up to 2 fields can be checked and combined with logical (AND, OR, XOR) operators.

The Moodle 2.x versions are the result of the French state level project "ENTLibre 2.0" Of the National Funding program "Investissement d'Avenir"

Contributors

Picture of Valery Fremaux
Valery Fremaux (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Michael Milette
    Sat, Jun 27, 2015, 3:42 AM
    Hi Valery, the link to "More documentation on this plugin" results in a 404 error.

    Can you give me a sample scenario of when I might want to use this plugin?

    Best regards,

    Michael
  • Picture of Chris Chapman
    Thu, Nov 5, 2015, 6:35 PM
    Hi Michael - a scenerio for our institution is to show relevant and personalized news/content for staff (and students) in a particular department. Havn't installed yet, running 2.9 so will see how it works and maybe make a few mods.
  • Picture of Nicholas Stefanski
    Thu, Apr 21, 2016, 6:35 AM
    Hi, I love the concept, but unfortunately I am having trouble with it on 2.7

    We have a custom profile field "Campus", since all of our campuses aare serviced by a single LMS. I had an embedded slideshow for each campus, and wanted users to only see theirs, so I made a block for each campus and used the rule "Campus = [campus name]". No content for all users, just content for matching users. The first two campuses worked perfectly, but the third group was able to see all three slideshows. I tried various other ways of doing the rule, including using the "Like" operator, but every rule either let the third campus see all of the slideshows or no slideshow at all.

    The only thing that I can think of is that while the first two campuses are a single word, "Austin" and "Boulder", the third campus is two words with a special character: "Boulder - Online". Since this profile field is a multi-select, If tried making a new selection "Boulder Online", but when I set a user to have that as their campus, the slideshow was not visible at all. So I don't know if there's a second issue going on with caching the profile field setting or something?

    Anyone have any thoughts on this, please let me know!
  • Picture of Valery Fremaux
    Thu, Apr 21, 2016, 8:36 PM
    Hi Nicolas

    Actually i do not tried what happens in table mdl_user_profile_data when a field is multiselect. The profile field resolution uses an internal eval() statement to build the comparison expression. I would not believe (before testing) that a hyphen would break the = or event Regular expression matching. I will have some tests ASAP on the use case.
  • Picture of Nicholas Stefanski
    Sat, Apr 23, 2016, 12:52 AM
    Valery,

    I did some additional testing. I switched to using the "Institution" field to avoid any possible problems with using a multi-select profile field, or a custom field in general. Here are the inputs and what I saw:

    institution result
    Austin User sees only correct blocks
    Boulder User sees only correct blocks
    Boulder - Online User sees all blocks
    Boulder Online User sees no blocks
    BoulderOnline User sees only correct blocks
    Online User sees only correct blocks
    Isla Nublar User sees no blocks

    So it looks to me like the hyphens are indeed breaking something, and causing users to see all blocks using that user field. If there is a space, but no hyphen, then the opposite happens, and the user does not even see the blocks that they should based on the field rules. I am using this on Moodle 2.7, so I don't know if there was a change in core code from 2.6 that would've caused this?

    I'm going to just switch to using Institution names without spaces and special characters (thank goodness for bulk user actions and CSV uploads!), but I thought I'd share my findings in case you want to update the block for the newer Moodle releases.
Please login to post comments