Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #1246  
Old 16 May 2010, 08:11
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
First and foremost: Performance. Why run the whole file, go through the whole variable/template registering and rendering process etc. just to show nothing in the end?

Next, you break UI consistency by not using the usual way of handling such errors: You need to code your error message yourself instead of using the standard no permissions message, which is phrased and thus works with multi language environments.

Last, but not least: There is a standard procedure in vB to do this, and that's the way I did it. Just look at the original files. And if there is a standard way, it should be used.

Anyway, I really don't follow your argumentation - how often do your Admins need to change which usergroups get access to a custom page? This does not seem like a weekly operation to me, does it? This is a set it and forget it decision, is it not?
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #1247  
Old 16 May 2010, 08:37
Arsov14 Arsov14 is offline
 
Join Date: Mar 2010
Dont work for me
Reply With Quote
  #1248  
Old 16 May 2010, 09:07
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Your php code does not get parsed. Make sure your file has the .php extension and starts with <?php.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #1249  
Old 16 May 2010, 09:41
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
Originally Posted by cellarius View Post
First and foremost: Performance. Why run the whole file, go through the whole variable/template registering and rendering process etc. just to show nothing in the end?

Next, you break UI consistency by not using the usual way of handling such errors: You need to code your error message yourself instead of using the standard no permissions message, which is phrased and thus works with multi language environments.

Last, but not least: There is a standard procedure in vB to do this, and that's the way I did it. Just look at the original files. And if there is a standard way, it should be used.

Anyway, I really don't follow your argumentation - how often do your Admins need to change which usergroups get access to a custom page? This does not seem like a weekly operation to me, does it? This is a set it and forget it decision, is it not?
Cellarius, don't get me wrong, i'm no coder by any means, it's just thats the way i have always (not too many times) done it. As for the whole admin's....etc changing things, i was purely talking from ease of operation for myself, i have used a similar conditional to allow certain usergroups to view some content, then when i have added usergroups it made it ease for me to find and change. I wasn't questioning your method & capability, just asking for information as to why, now that i know i would implement that, but it does make it difficult for adding or removing usergroups access.

--------------- Added 16 May 2010 at 09:50 ---------------

Could it be incorporated in a pluggin where you can state which templates cannot be accessed?

Could you also tell me how to do this in a php statement?
<if condition="is_member_of($vbulletin->userinfo, array(1, 2, 3))">.
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!

Last edited by Simon Lloyd; 16 May 2010 at 09:50. Reason: Auto-Merged DoublePost
Reply With Quote
  #1250  
Old 16 May 2010, 09:51
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Originally Posted by Simon Lloyd View Post
Cellarius, don't get me wrong, i'm no coder by any means, it's just thats the way i have always (not too many times) done it.
Of course you are free to do so if you prefer that method, I just don't think it should be recommended, as it just is not how it is done in vB and does have drawbacks.
As for the whole admin's....etc changing things, i was purely talking from ease of operation for myself, i have used a similar conditional to allow certain usergroups to view some content, then when i have added usergroups it made it ease for me to find and change.
Then it would be still better to add an AdminCP setting where you can add/change those usergroups easily. You still would have to remember to do it, and a code fragment at the top of a php file seems not harder to find than a conditional in a template, IMHO.
I wasn't questioning your method & capability,
I did not take it that way.
just asking for information as to why, now that i know i would implement that, but it does make it difficult for adding or removing usergroups access.
As I said: Not really. Opening a php file and changing the code there is not really harder than editing a template. If you don't want to do that, set up an AdminCP setting for it. That would probably be the most comfortable way.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #1251  
Old 16 May 2010, 09:56
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
Originally Posted by cellarius View Post
.....
As I said: Not really. Opening a php file and changing the code there is not really harder than editing a template. If you don't want to do that, set up an AdminCP setting for it. That would probably be the most comfortable way.
Thanks, as i said i'm no coder so how could i do that as that would be great to just add the templates that i want governed by the setting and the usergroups i want to allow access?
Could it be incorporated in a pluggin where you can state which templates cannot be accessed?

Could you also tell me how to do this in a php statement?
<if condition="is_member_of($vbulletin->userinfo, array(1, 2, 3))">.
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #1252  
Old 16 May 2010, 10:04
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Originally Posted by Simon Lloyd View Post
--------------- Added 16 May 2010 at 11:50 ---------------

Could it be incorporated in a pluggin where you can state which templates cannot be accessed?
You would have to establish your own hook in your custom php file. How to notify vB of the existence of the hook is explained by Paul here:
http://www.vbulletin.org/forum/showthread.php?t=83390

The code for your hook would be:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

BTW: That permisson does not prevent templates from being accessed. It kicks in much earlier - it prevents the main part of the php page from being processed.

Could you also tell me how to do this in a php statement?
<if condition="is_member_of($vbulletin->userinfo, array(1, 2, 3))">.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #1253  
Old 16 May 2010, 10:28
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
Cellarius, if you wouldn't mind helping a little further, i have created an xml for the hook (as per Pauls' thread), custom_template_permission (custom) is how it's shown in the plugins hook location dropdown, what would i need to add template names and permissions to a plug in?, when the plugin is created would the options be in the admincp nav as a button?
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #1254  
Old 16 May 2010, 10:35
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Add the php code for the hook (see my prev post) at the top of the custom code section of your custom php file.
To disallow usergroups from this custom php page add this to the plugin:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This will prevent all members from the usergroups 1,2,3 to see the page. To turn it around use

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Note the ! in front of is_member_of. This will prevent all users except usergroups 1,2,3 from accessing the page, so only members of usergroups 1,2,3 will be able to see it.

No, this will add no option to your admincp. This adds a normal hook, and you would need to edit the plugin in the plugin sectin of AdminCP. If this is for your own use only, this is the way I'd do it. An AdminCP option just adds unnecessary overhead. Honestly, I wouldn't even add that hook. Just edit your custom php file directly - thats the most performant and simple way, really.

And once again: This code does not block access to templates. It blocks access to the whole php file, so to say.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #1255  
Old 16 May 2010, 10:43
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
I appreciate the time you took to answer, for now i will add it to the custom php, i was asking the other questions for building things in to the admincp in future.
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #1256  
Old 18 May 2010, 12:35
danishravian danishravian is offline
 
Join Date: Mar 2010
how to make a php page with it???

which may display some data from sql database.???
Reply With Quote
  #1257  
Old 18 May 2010, 12:41
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Originally Posted by danishravian View Post
how to make a php page with it???
Just as is explained in the article.

which may display some data from sql database.???
By adding the relevant code to php page you created by following the article in the first post.

Really, it's barely possible to answer unspecific questions like that.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #1258  
Old 18 May 2010, 14:56
danishravian danishravian is offline
 
Join Date: Mar 2010
i made my custome page by this tutorial.
now i want to display some data from sql database on it through PHP.

all i got till now is that data is currently comming from Template???
can you please tell me where to write my php code??
Reply With Quote
  #1259  
Old 18 May 2010, 15:06
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
If you have your custom page up and running following this tutorial then the purpose of this article and thread is achieved. It can't be the place for every custom programming question. You need to open your own thread for your question. Even better, do some reading before: http://www.vbulletin.org/forum/showthread.php?t=119350
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #1260  
Old 18 May 2010, 15:12
danishravian danishravian is offline
 
Join Date: Mar 2010
Thnx For Replying, Im Still Clueless...I Know All Database Queries.
My Question is just that where to write my PHP code and queries to display data properly on this page.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 04:01.

Layout Options | Width: Wide Color: