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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,020
  • Total Topics: 21,332
  • Online today: 737
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 366
  • Total: 366

block permission according to message count.

Started by deniz, April 19, 2006, 06:15:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bloc

It was before 0.9 even I mentioned that..the intial reason was that it was so easy to set access wrong when based on post count. And TP did use its own handling of membergroups in certain sections. complicating things. That has now changed, all is based on what you set in "permissions" screen of SMF. Maybe is time to upgrade that part too.

Sineksekiz

Quote from: Bloc on October 30, 2008, 01:51:07 PM
It was before 0.9 even I mentioned that..the intial reason was that it was so easy to set access wrong when based on post count. And TP did use its own handling of membergroups in certain sections. complicating things. That has now changed, all is based on what you set in "permissions" screen of SMF. Maybe is time to upgrade that part too.

I agree. I apperaciate IchBinâ,,¢  and  lanedreses helps however including them we all know this is not the proper way. But actually this code has got its benefits as well. You can target members less and more then certain amount of posts in a single block.

Put the Content A in to if and content B in to else statement so if a member has less then 100 post it will see the content A otherwise Content B. Downside of it is even considering its simplicity most of the people would get confused because of PHP coding. We can't expect everybody to know how to use an if else statment.

So we get this feature in the next beta? : DDD

Sineksekiz

#22
Hi

I think I spoke too soon before completely check it. This does not work. Does not matter however I change the equation It shows nothing to anybody. I belive variable posts or the way we call it does not exists. Since I have tried to do everything with the equation (><=) I think we are looking for wrong variable or we are looking for it before we call it.

If you had another look that would be great. By the way my theme is midnight and I am using smf 1.1.6 and TP 0.98...

Thank you.

IchBin

Did you check the permissions on the block to allow other membergroups? The code works fine for me.

Sineksekiz

Quote from: IchBinâ,,¢ on November 01, 2008, 01:03:24 AM
Did you check the permissions on the block to allow other membergroups? The code works fine for me.

Yeah I did. Still no go. Could it be the themes fault or my TP version? It is allowed to see by all member groups, not collapsable, frames are used and tried showin <100 and >100 and tried with 2 types of user account.

I know I am doing something wrong.

Yet again my system is SMF 1.1.6, TP v0.9.8, Midnight (by Crip)...

Thank you...

Ianedres

The code you posted (in your reply here) should have brackets for the if/else clause:
global $user_info;
if ($user_info['posts'] < 100)
{ echo 'For user less then 100 count'; }
else
{ echo 'For user has more'; }

Sineksekiz

Quote from: Ianedres on November 01, 2008, 12:19:21 PM
The code you posted (in your reply here) should have brackets for the if/else clause:
global $user_info;
if ($user_info['posts'] < 100)
{ echo 'For user less then 100 count'; }
else
{ echo 'For user has more'; }


I've already tried brackets... I think the problem is $user_info or $user_info['posts'] because it doesn't show if or else statments. It is just a blank block. Nothing in it....

IchBin

Put this in your block and tell me if your see the [posts] element of the array.

global $user_info;
echo '<pre>',print_r($user_info),'</pre>';


Brackets aren't necessary unless you plan to put more than one executed line inside the if or else statement.

Sineksekiz

I have done that and it worked great... Then I realised that all the details printed without " ' " sighn so I wonder if it would work if I would write [posts] instead of ['posts'] and it worked too.

So if


global $user_info;
if ($user_info['posts'] < 100)
{ echo 'For user less then 100 count'; }
else
{ echo 'For user has more'; }


try


global $user_info;
if ($user_info[posts] < 100)
{ echo 'For user less then 100 count'; }
else
{ echo 'For user has more'; }


it should work.

Thanks IchBinâ,,¢. This time you accidentally saved me. : DDD

IchBin

$user_info[posts] should not work. Without the single quotes php will treat it like a number instead of a string.

This website is proudly hosted on Crocweb Cloud Website Hosting.