HTML (on profile field) icon

HTML (on profile field)

This simple bloc allows outputing HTML content in a bloc with several versions based onthe check of custom profile fields values (2 checks)
Price option: Free

Supports Moodle 1.9-3.3 See all versions
Latest release: 8 years ago
Installations: 46
Downloads (last 90 days): 30

Frankenstyle name: block_profilespecifichtml
Blocks

Comments

Product ratings and reviews are coming to Moodle Marketplace. Until then, existing comments remain available to read, but new posts have been disabled.

Please update this plugin 3.10 3.11 4.0
Thx
Hi Ciaran,
If you still having issues with "Exception - syntax error, unexpected '==' (T_IS_EQUAL) " then alter the code in block_profilespecifichtml.php line 109. You need to add if(!empty($uservalue)){
if ($this->config->op1 == '~=') {
$expr = "\$res1 = preg_match('/{$this->config->value1}/', '{$uservalue}'}) ;";
} else {
if(!empty($uservalue)){
$expr = "\$res1 = {$uservalue} {$this->config->op1} '{$this->config->value1}' ;";
}
Hi again, we applied the latest githib version rather than the last downloadable plugin version as it was more up to date and the error disappeared. Unfortunately none of the custom or standard profile fields seem to pick up on the conditional formula i.e. no users match even though they have the field values. Oh well.
hi Valery,
I can't seem to get this to work on Moodle33.
No matter if I use a custom field or any standard field I get this error "Exception - syntax error, unexpected '==' (T_IS_EQUAL) ". The fiekd name does not have a - in it. Any ideas please? It will be a great solution if I can get this working.
many thanks\merci
Ciarán
hi Valery,
got solutions, if we don't write message for unmatched users then its not appearing . Thanks once again.
Hi Valery,
Thanks for sharing such nice block.
Is it possible to hide block to unmatched users using this block.
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.
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.
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!
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.
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