Welcome to Geeklog Thursday, November 21 2019 @ 11:30 am EST

Geeklog Forums

Prevent disabling a block?


Status: offline

griffman

Forum User
Junior
Registered: 23/04/02
Posts: 28
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.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
That`s one of the most ticklish corners where users can misadjust things. This part is not even produced through a thtml but comes from the code.

http://project.geeklog.net/tracking/view.php?id=787
http://project.geeklog.net/tracking/view.php?id=786
 Quote

Status: offline

griffman

Forum User
Junior
Registered: 23/04/02
Posts: 28
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.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
I`d have greyed out the check boxes but there is no thtml Cry

Can you do this in the core code and tell me the hack?
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
Is any developer looking at this bug?
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/04
Posts: 555
Location:Champaign, Illinois
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:
[code]
<div class="preferences-blocks">
{boxes_checklist}
</div>
[/code]
then for each block you want to hide add a rule to your style.css
[code]
.preferences-blocks input[value="10"], .preferences-blocks input[value="10"]+span {
display: none;
}
[/code]
Where the value is the block id. And you must target the <input /> and the <span />

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
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?
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/04
Posts: 555
Location:Champaign, Illinois
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:
[code]
.preferences-blocks input[value="10"], .preferences-blocks input[value="10"]+span {
display: none;
}
[/code]

any tutorial online?

http://css-tricks.com/category/beginner/

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

mystral-kk

Site Admin
Admin
Registered: 19/03/06
Posts: 100
Location:Japan

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".

[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); [/code]
-- mystral-kk, "Every cloud has a silver lining."
 Quote

All times are EST. The time is now 11:30 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content