Results 1 to 7 of 7

Thread: status vs group_id?

  1. #1
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default status vs group_id?

    in the idx_users table, what is the difference between status and group_id?

    what are the possible values for each and how/when/where is each value used in INDEXU???
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  2. #2
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    status is for determine users status:
    - 0 : not active / not yet enter validation code
    - 1 : active user

    group id:
    - 0 : admin
    - 1 : editor
    - 100 : normal user

  3. #3
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Originally posted by dody
    group id:
    - 0 : admin
    - 1 : editor
    - 100 : normal user
    hmmm....all new users are assigned a group_id of 2.

    The ApproveEditor function in link.class.php does not change the group_id. I cannot find where the group_id in the idx_user is ever changed when a user is approved as an editor. Thus, all users are have a group_id of 2

    I'm confused about the GetUserAuthentication function in users.class.php

    the function itself shows GetUserAuthentication($group_id = 100) {

    that would assign the group_id a value of 100 ( a normal user per your definition above although they all have a value of 2 in the database )

    Since group_id is assigned a value of 100, it would seem like passing a parameter thru the GetUserAuthentication would not work.

    passing 0 would not work: if($users_obj->GetUserAuthentication(0)!=0){

    In cp/index.php you have
      // get editor menu
      if($users_obj->GetUserAuthentication(1)==0){

    doesn't the GetUserAuthentication($group_id = 100) mean that the 1 is never used inside to the function ( wouldn't it need to be GetUserAuthentication($g_id, $group_id = 100). Then $g_id would have the value of 1 inside the GetUserAuthentication function?)

    QUESTION: is
      !$users_obj->GetUserAuthentication()==0
    the same as
      $users_obj->GetUserAuthentication()!=0


    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  4. #4
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    GetUserAuthentication($group_id = 100) mean the default value is 100 if there's no paramenter.

    It's my carelessness having value 2 and 100 for normal user. Both are the same. Sorry for ambigiuity.

    even both work well, but
    $users_obj->GetUserAuthentication()!=0 is more readable

  5. #5
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    OK, I see! said the blind man...: rolleyes:

    Now that I understand how passing parameters in PHP works ( well, at least in this situation ).

    If you do not pass a parameter, then GetUserAuthentication() uses this section.
    Code:
             if ($group_id == 100) {
              if($COOKIE_USER_AUTHENTICATED && $COOKIE_PASSWORD == $pwd) return 0;
              else return 1;
            }
    If you do pass a parameter, then GetUserAuthentication(1) uses this section.
    Code:
            else {
              if($COOKIE_USER_AUTHENTICATED && $COOKIE_PASSWORD == $pwd && $group_id == $gid) return 0;
              else return 1;
            }
    My question is this: I cannot find where the group_id is set to 1 for an approved editor.

    Thus, if the group_id is not set to 1 for an editor, then in /cp/index.php the following line will fail

    Code:
      // get editor menu
      if($users_obj->GetUserAuthentication(1)==0){
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  6. #6
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    If you do pass a parameter, then GetUserAuthentication(1) uses this section.
    Yooooo .... correct! Please read php manual for detail passing a value to function

    My question is this: I cannot find where the group_id is set to 1 for an approved editor.
    Thus, if the group_id is not set to 1 for an editor, then in /cp/index.php the following line will fail
    I check the codes again, indexu never sign group_id to 1 to editors, it just replate editor status to 1. It's my mistake, group id not working perfectly: 0 for admin, and others for normal users.
    (now you know why i re-write all codes again, it's more than year and half old codes, and my mistakes on bad coding )

  7. #7
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Originally posted by dody
    Yooooo .... correct! Please read php manual for detail passing a value to function
    OK! I am trying to learn some PHP... Trying to teach an old dog like me some new tricks takes time..!

    Originally posted by dody
    It's my mistake, group id not working perfectly:...and my mistakes on bad coding )
    your code is excellent, not need to apologize, and certainly not to me...
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

Similar Threads

  1. Checking linkbacks Mod
    By esm in forum v3.2
    Replies: 26
    Last Post: 09-21-2004, 08:18 PM
  2. e-mail reports
    By eddieeddie in forum Pre-Sales Questions
    Replies: 13
    Last Post: 07-22-2003, 09:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •