collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 706
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Author Topic: Hiding blocks from admin  (Read 6711 times)

0 Members and 1 Guest are viewing this topic.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Hiding blocks from admin
« on: January 03, 2010, 01:11:56 PM »
Is there a way to hide blocks from admin but able to show to members and guests?

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Hiding blocks from admin
« Reply #1 on: January 04, 2010, 08:55:33 AM »
At the moment no.

But with the edit below it should be possible.

Code: ("Find (Sources/Subs-Portal.php)") [Select]
if (allowedTo('sp_admin'))
return true;

Code: ("Replace") [Select]
global $context;
if (allowedTo('sp_admin'))
{
if ($type == 'block' && $context['current_action'] != 'admin' && $id == 1)
return false;
else
return true;
}

Change the '1' to the id of the block that you don't want admin to be able to see. You can find the id of a block from the url when you are editing it.

Edit: Updated so that you can still edit the block in the admin panel.
« Last Edit: June 03, 2010, 03:35:14 AM by Nathaniel »
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Hiding blocks from admin
« Reply #2 on: January 04, 2010, 06:52:58 PM »
Wow!,.....  excellent. Thank you.

You have no idea how many times ive been wanting to do this.   I like to show some blocks to guests only but not members. ....but i saw them too and that bugged me.


Say,........ what if i wanted to add another block?   add another number?

like this? 
Code: [Select]
if ($type == 'block' && $id == 1,23,22,45 )??

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Hiding blocks from admin
« Reply #3 on: January 04, 2010, 07:25:13 PM »
No, that is not valid PHP syntax. Use the code below:
Code: [Select]
if ($type == 'block' && in_array($id, array(1,23,22,45)))
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Hiding blocks from admin
« Reply #4 on: January 04, 2010, 09:00:34 PM »
Thank you.

Do you mind splittin' this topic to "feature requests"?   I think it may be useful as if i make a block with a welcome message to guests only, i shouldnt see it if dont want to and obviously regular members wont see it either.   Maybe adding this feature to pages as well?

Thanx again,
Mick.

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Hiding blocks from admin
« Reply #5 on: January 04, 2010, 11:35:05 PM »
This is already a feature request that has been added to the ProjectTracker: http://simpleportal.net/index.php?issue=275

Marking as solved.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Hiding blocks from admin
« Reply #6 on: January 10, 2010, 08:46:28 AM »
It gives a fatal error when viewing the block in admin..

Code: [Select]
Fatal error: Function name must be a string in /home/******/public_html/Sources/PortalAdminBlocks.php on line 243

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Hiding blocks from admin
« Reply #7 on: January 10, 2010, 07:51:11 PM »
Code: [Select]
if (($type == 'block') && (in_array($id, array(1, 23, 22, 45))) || ((!empty($_GET['action'])) && ($_GET['action'] !== 'admin')))
Try that instead.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Hiding blocks from admin
« Reply #8 on: January 12, 2010, 01:19:47 PM »
Code: [Select]
if (($type == 'block') && (in_array($id, array(1, 23, 22, 45))) || ((!empty($_GET['action'])) && ($_GET['action'] !== 'admin')))
Try that instead.

That code turns OFF all the blocks from the forums :(

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Hiding blocks from admin
« Reply #9 on: January 12, 2010, 07:54:53 PM »
Try the code below:
Code: [Select]
if ($type == 'block' && in_array($id, array(1, 23, 22, 45)) && !(!empty($_GET['action'] && $_GET['action'] == 'admin'))
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Hiding blocks from admin
« Reply #10 on: January 14, 2010, 11:16:29 AM »
I get a parse error:

Code: [Select]
Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ')' in /home/*******/public_html/Sources/Subs-Portal.php on line 595

Offline ShadowMaster

  • Newbie
  • Posts: 3
  • SMF Version: 2 RC1.2
  • SP Version: 2.2.2
Re: Hiding blocks from admin
« Reply #11 on: January 14, 2010, 01:51:57 PM »
Code: [Select]
if ($type == 'block' && in_array($id, array(1, 23, 22, 45)) && !(!empty($_GET['action'] && $_GET['action'] == 'admin')))

Missing a closing brace.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Hiding blocks from admin
« Reply #12 on: January 14, 2010, 07:42:56 PM »
I get same error.



Im using the code in Reply #3 in which it works good but i cannot see the blocks in admin to edit.   The only way i see them if revert the code to its original state.

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Hiding blocks from admin
« Reply #13 on: February 03, 2010, 06:49:42 PM »
Apologies for the wait on this issue, try the code below:

Code: [Select]
if ($type == 'block' && in_array($id, array(1, 23, 22, 45)) && !(!empty($_GET['action']) && $_GET['action'] == 'admin'))
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Hiding blocks from admin
« Reply #14 on: February 03, 2010, 08:48:19 PM »
Apologies for the wait on this issue, try the code below:

Code: [Select]
if ($type == 'block' && in_array($id, array(1, 23, 22, 45)) && !(!empty($_GET['action']) && $_GET['action'] == 'admin'))

Excellent!   This worked.

Offline Nothingness

  • Jr. Member
  • **
  • Posts: 69
  • Gender: Male
  • I am...the architect of my own destruction...
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Hiding blocks from admin
« Reply #15 on: July 31, 2010, 07:29:58 AM »
Ok so it works but if I join a group where it had blocks to view...this method still override other permissions.

If it doesn't make sense here's the thread: http://simpleportal.net/index.php?topic=6109.msg35792#msg35792

Quote
Edit: Updated so that you can still edit the block in the admin panel.
I don't see the option to edit if in the blocks on the admin panel...


"Do you wallow in self-pity, or do you learn to use the gifts God gave you and command fear and respect, and defend against those who would do us harm"

Offline Sudhakar

  • Jr. Member
  • **
  • Posts: 67
  • Gender: Male
  • Simple Portal is Good
    • IT Acumens - An Edu Community
  • SMF Version: 2 RC1
  • SP Version: 2.2.1
Re: Hiding blocks from admin
« Reply #16 on: December 11, 2011, 03:47:49 PM »
Is this feature available on 2.4
- Thanks & Regards,
Sudhakar, IT Acumens