TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,970
  • Latest: bynw
Stats
  • Total Posts: 196,046
  • Total Topics: 21,335
  • Online today: 374
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 105
  • Total: 105

Defaults for Checkboxes (TP 1.05)

Started by espressoguy, September 24, 2008, 06:23:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

espressoguy

In the edit screen for a block ("Panels and Blocks>Edit Block") there is a setting for:

"Choose your membergroups that will able to see this block."

...followed by four checkboxes; one for each membergroup.

What controls the default status of these checkboxes?  I would like the checkbox for "Guests" to be disabled by default so that if global moderators create a new block, it will not be visible to guests unless they enable it.   (would like to do the same for category Access also).

Thanks for the help !

wayco

It looks like the code you're looking for is in Themes/default/TPortalAdmin.template.php starting at/around line 2405. I did a little horsing around and found that the guest group has $mg['id'] set to -1. By adding a little code the guest group does not come up with checked set. I did not test further, but this should get you started.

on or around line 2410,
  Find the code:  if(in_array($mg['id'],$tg))
  and change it to: if(in_array($mg['id'],$tg) && $mg['id']!='-1')

I found this by reverse-engineering the code; loaded the page, viewed the source looking for "Guests". Examining that part of the source I found reference to tp_group and scanned all files for that term. Then I looked at the code in each of the 3 files containing that term and saw the comment // loop through and set membergroups, so I played with it. I had it show me what was in the variables and when I found what I wanted just added another condition to the line that marks the membergroup checked. Hope this helps.

espressoguy

Thanks Wayco ...an initial check shows that your suggestion seems to work on categories; will continue checking.  Your method of reverse-engineering the code sounds correct; thanks for the help.

wayco

Glad I could help.

For what it's worth, it seems that the files in the default theme are used UNLESS present in another theme, so you can make changes globally (default) or for individual themes only.

This website is proudly hosted on Crocweb Cloud Website Hosting.