Posted on: 06/17/09 10:45am
By: griffman
Is there any way to prevent a user from disabling a block in their preferences? I have a couple of blocks that need to remain enabled, but I don't see any settings anywhere to mark them as permanent. Is the only solution to modify usersettings.php? If it is, what's the best way to get that done?
thx;
-rob.
Re: Prevent disabling a block?
Posted on: 06/17/09 01:14pm
By: 1000ideen
Re: Prevent disabling a block?
Posted on: 06/17/09 01:24pm
By: griffman
Thanks; looks like the answer, at least for now, is "no." I had done this in a prior release by modifying usersettings.php to add in the block IDs I didn't want to show on the list. I hate modifying the core, though, and was hoping there was a better solution.
-rob.
Re: Prevent disabling a block?
Posted on: 06/17/09 01:26pm
By: 1000ideen
I`d have greyed out the check boxes but there is no thtml
Can you do this in the core code and tell me the hack?
Re: Prevent disabling a block?
Posted on: 11/29/12 09:36am
By: 1000ideen
Is any developer looking at this bug?
Re: Prevent disabling a block?
Posted on: 11/29/12 10:01am
By: suprsidr
This would be a nice feature, but its not a bug.
You can do this strictly in the theme.
/layout/your theme/preferences/boxesblock.thtml add a class to the <div /> surrounding the block:
Text Formatted Code
<div class="preferences-blocks">
{boxes_checklist}
</div>
then for each block you want to hide add a rule to your style.css
Text Formatted Code
.preferences-blocks input[value="10"], .preferences-blocks input[value="10"]+span {
display: none;
}
Where the value is the block id. And you must target the <input /> and the <span />
-s
Re: Prevent disabling a block?
Posted on: 11/29/12 11:31am
By: 1000ideen
I`m trying to do this now. How do I see the block ID?
What is meant with "target the <input /> and the <span />" ? any tutorial online?
Re: Prevent disabling a block?
Posted on: 11/29/12 12:33pm
By: suprsidr
I`m trying to do this now. How do I see the block ID?
Either view the page source of the preferences page, or simpler view the edit url of the block in the block editor.: /admin/block.php?mode=edit&
bid=10
What is meant with "target the <input /> and the <span />" ?
In CSS we target selectors to add our styles to.
I've already supplied an example:
Text Formatted Code
.preferences-blocks input[value="10"], .preferences-blocks input[value="10"]+span {
display: none;
}
any tutorial online?
http://css-tricks.com/category/beginner/[*3]
-s
Re: Prevent disabling a block?
Posted on: 12/01/12 12:50am
By: mystral-kk
If you use GL-1.8 or newer, maybe this will work. Append the following code at the tail of "public_html/javascript/profile_editor.js".
Text Formatted Code
// Prevents users from checking certain topics
(function($) {
var disables = ['Geeklog', 'General']; // Topic IDs you don't want users to choose
$('ul.checkboxes-list li input[type=checkbox]').each(function() {
if ((this.name === 'topics[]') && ($.inArray(this.value, disables) >= 0)) {
this.disabled = true;
}
});
})(jQuery);