Announcement

Collapse
No announcement yet.

user Vs. userfield

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • user Vs. userfield

    ok correct me if am wrong

    but as far as i know the user and userfield tables should have the same number right?

    when i open phpmyadmin

    i get different field numbers

    user = 8,283
    userfield = 8,259

    if this is abnormal any ideas on how i can fix it?

    and is it a big problem?

    N.B.

    some of my members get a hard time logging in


    Good times are for friends to share

  • #2
    Both tables should contain the same number of users! If a user is missing from userfield he can't be seen in the memberlist and he can't save his Location, Biography and so on in his Profile. To fix this you can use this script:
    PHP Code:
    <?php
    error_reporting
    (7);
    if (
    function_exists("set_time_limit")==and get_cfg_var("safe_mode")==0) {
      @
    set_time_limit(1200);
    }
    require(
    "./global.php");
    cpheader();
    echo 
    "Checking if User is missing in Table Userfield...<br><br>\n";
    $getusers=$DB_site->query("SELECT userid from user ORDER BY userid");
    while (
    $getuser=$DB_site->fetch_array($getusers)) {
      
    $getuserfield=$DB_site->query_first("SELECT userid from userfield WHERE userid='".$getuser[userid]."'");
      
    $getuserfield=$getuserfield[userid];
      if (!
    $getuserfield) {
        echo 
    "Inserting User #".$getuser[userid]." into Table 'Userfield'...<br>\n";
        
    $DB_site->query("INSERT INTO userfield (userid,field1,field2,field3,field4) VALUES ('".$getuser[userid]."','','','','')");
      }
    }
    echo 
    "<br><br>Finished...now continuing to check if a no-longer-existing user is still shown in Table 'Userfield'.<br><br>\n";
    $getuserfields=$DB_site->query("SELECT userid from userfield ORDER BY userid");
    while (
    $getuserfield=$DB_site->fetch_array($getuserfields)) {
      
    $getuser=$DB_site->query_first("SELECT userid from user WHERE userid='".$getuserfield[userid]."'");
      
    $getuser=$getuser[userid];
      if (!
    $getuser) {
        echo 
    "Removing User #".$getuserfield[userid]." from Table 'Userfield'...<br>\n";
        
    $DB_site->query("DELETE FROM userfield WHERE userid='".$getuserfield[userid]."'");
      }
    }
    echo 
    "<br><br>Finished...now both tables, <b>user</b> and <b>userfield</b> should contain the same amount of users!<br>\n";
    cpfooter();
    ?>
    Save the code to a new file called userfield.php, upload it to your admin directory and execute it.
    I have written this a few minutes ago for you and after testing it several times I think it should work without problems.
    After executing this script, both tables should show the same amount of users (It only affects the table userfield. It doesn't change anything in the table user!).

    But: Please make a Backup of your DB before using this Script

    Greetings,
    Mystics
    Last edited by Michael König; Thu 14th Feb '02, 6:34pm.

    Comment


    • #3
      thanx alot

      that was great


      they are the same
      8,323
      Good times are for friends to share

      Comment


      • #4
        ok i noticed this after using the code?

        some members have more posts than shown under their nicknames???

        how can i fix this?
        Good times are for friends to share

        Comment


        • #5
          I don't think that have anything to do with my script because there is nothing in it, that handles with the user's post count...

          To fix it go in your Admin-CP -> Update Counters -> Update User's Post Counts

          Comment


          • #6
            this script helped me alot
            i had about 1,000members w/out a userfield
            thanx for the script
            and thanx to smachol for identifying my problem
            Rap Lyrics - Hip Hop Forums - Funny Pictures - Hip Hop Honeys - Rap Videos

            Comment


            • #7
              Well, I think, this wouldn't work for users in forums where fields have been added and/or removed.

              I think you should exchange
              PHP Code:
                  $DB_site->query("INSERT INTO userfield (userid,field1,field2,field3,field4) VALUES ('".$getuser[userid]."','','','','')"); 
              with
              PHP Code:
                  $DB_site->query("INSERT INTO userfield (userid) VALUES ('$getuser[userid]')"); 
              HTH

              Stadler
              Last edited by Stadler; Thu 20th Feb '03, 3:27pm.
              Hints & Tips:
              [[vB3] More Spiders / Indexers / Archives for vB3 - list]|[List of one-time-emails to ban]


              http://sfx-images.mozilla.org/affili...efox_80x15.png

              Comment


              • #8
                Originally posted by Mystics
                Both tables should contain the same number of users! If a user is missing from userfield he can't be seen in the memberlist and he can't save his Location, Biography and so on in his Profile. To fix this you can use this script:
                For some STRANGE unknown reason one of my admins could no longer login. When she tries to login she gets recognised and she greeted by her name .. but when the page takes her back to .. the forum does not recognize her as being loggedin.

                I ran Mystics script -above- and it recognized that user was not in the Userfiled tableand inserted it .. now All works.

                Many thanks ..

                Comment


                • #9
                  I now seem to get a new error when i try to edit a user via the admin panel.

                  <-- Database error in vBulletin Control Panel 2.2.8:
                  Invalid SQL: UPDATE userfield SET userid=7,field1='',field2='',field3='',field4='',field7='',field8='',field11='' WHERE userid=7
                  mysql error: Unknown column 'field7' in 'field list'
                  mysql error number: 1054 -->

                  Any help?

                  Comment


                  • #10
                    Hi,

                    try, what I've posted before:
                    Originally posted by Stadler
                    Well, I think, this wouldn't work for users in forums where fields have been added and/or removed.

                    I think you should exchange
                    PHP Code:
                        $DB_site->query("INSERT INTO userfield (userid,field1,field2,field3,field4) VALUES ('".$getuser[userid]."','','','','')"); 
                    with
                    PHP Code:
                        $DB_site->query("INSERT INTO userfield (userid) VALUES ('$getuser[userid]')"); 
                    HTH

                    Stadler
                    Hints & Tips:
                    [[vB3] More Spiders / Indexers / Archives for vB3 - list]|[List of one-time-emails to ban]


                    http://sfx-images.mozilla.org/affili...efox_80x15.png

                    Comment


                    • #11
                      Hello friends ...
                      I have followed all instructions here .... but still same problem ...

                      Comment


                      • #12
                        And I foget to say the starnge thing !!..

                        amount of user = 840
                        amount of userfield = 840 !!!
                        Last edited by OmaniMan; Mon 19th May '03, 12:35pm.

                        Comment


                        • #13
                          OmaniMan, please start a new thread with all the relevant details about your specific problem and what exactly you've done.
                          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                          Change CKEditor Colors to Match Style (for 4.1.4 and above)

                          Steve Machol Photography


                          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                          Comment


                          • #14
                            Ok the script works for missing users in the "userfield table", BUT what if you have 6000 members in the userfield and only 3500 members in the "user table"?

                            But all of them can still log in and post with no issues.
                            Gentoo Geek

                            Comment


                            • #15
                              There are no adverse effects to having this if state if everyone can login. I would think this could only happen if you pruned your user table directly via the database.

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X