Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Define user_rights don't work

Asked Modified Viewed 3,153 times
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
  • Started this discussions
asked
Veteran Member

Hi folks.

This time it's myself that need a bit of help.

Im trying to MOD this:
if (iMEMBER) {
CODE FOR MEMBERS
}

To this - where I should be able to set the user rights via the infusions admin-part:
$result = dbquery("SELECT foat_access FROM ".DB_FOAT." WHERE foat_id='1'");
$data = dbarray($result);

$access = $data['foat_access']; // foat_access is set to iMEMBER
   
if ($access) {
CODE FOR MEMBERS
}


But this ain't working - guests still can see it - and I really can't see why it wont work... ? The output from foat_access is saying iMEMBER.

If I manually type in iMEMBER instead of $access then it's working.

I tried to put it in a while-loop but still not working.

Any ideas ?
0 replies

7 posts

M
maoriorgnz
M
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 12 threads in the forums
answered
Junior Member

Hi, I am playing with this idea too - I want to have a different message in the welcome panel for members.

I just put the following in the welcome-message-panel.php and it works :)

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
if (iMEMBER) {
echo "What would you like to do today?";
} else {
echo stripslashes($settings['siteintro'])."\n";
}[/syntaxhighlighter]
0 replies
N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
answered
Senior Member

Quote

smokeman wrote:
But this ain't working - guests still can see it - and I really can't see why it wont work... ? The output from foat_access is saying iMEMBER.


Thats because you wrote if $access .. meaning if the data exists then show this. Your not checking if there a member. Only checking if data within the table exists for the id.

Simple fix below.

if (iMEMBER && $access) {
CODE FOR MEMBERS
}


or if your $data string equals iMEMBER.

if (iMEMBER && $access=="iMEMBER") {
CODE FOR MEMBERS
}
Edited by NetriX on 25-03-2011 09:26,
0 replies
M
MarcusG
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
answered
Member

This won't work.

Better:
if (iMEMBER && $access == "iMEMBER") {
// Code for Members
}


But i would realize this via checkgroup() (Members = 101, Admin = 102 and so on)
0 replies
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
  • Started this discussions
answered
Veteran Member

Hi folks - thx. for your answers.

Hmm, Im a bit in doubt here..

What I want is to be able to choose, via the infusions admin-part, the following from a <select></select>:

Quote


iGUEST
iMEMBER
iADMIN
iSUPERADMIN
- that means that it's not only the iMEMBER-function Im looking for to get working - but I want to be able to choose from the all 4 user_rights above.

But I think I will look nearliere into what @marcus said.

If I find a solution I will sure post it here.

Again - thx. peeps.
0 replies
M
MarcusG
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
answered
Member

It's really simple with checkgroup().

All you have to do is save the access with group id. This can simply be copied from any admin page that sets the user access.

Your code then looks like this:

if (checkgroup($access)) {
//your code
}
0 replies
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
  • Started this discussions
answered
Veteran Member

Bingo!

There it was - thx very much Marcus! :D
- and thank you to the other users that have tried to help too.
0 replies
M
MarcusG
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
answered
Member

You're very welcome :)
0 replies

Category Forum

Panels and Infusions

Labels

None yet

Statistics

  • Views 0 views
  • Posts 7 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

S
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
  • Started this discussions
N
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
M
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
M
M
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 12 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet