Announcement

Collapse
No announcement yet.

Custom Fields Import from phpBB

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

  • Custom Fields Import from phpBB

    First of all, I would like to thank Steve and Jerry for helping me out on the other problem that I had. It is now working.

    I have another question.

    Over the years that I have been running phpBB, I have added many hacks to it. Some of them I don't care if they tranfer over to vB, but a couple of them I would like to transfer automatically from phpBB. These are custom fields added to the user profile.

    Can Impex add these interactively? (I am guessing that coding is required to do this, but I am not a coder.)

    Thanks.

  • #2
    Yes.

    If you look at lines 88-91 of the impex/system/ubb_classic/004.php (just for example)

    Code:
    $this->add_custom_field(.....)
    That sets the fields up so impex knows what they are.

    Then lines 272-275 of the same file.

    Code:
    $try->add_custom_value()
    There are some custom set ups in the phpBB user file, though they are a little missleading as they set up default values, for custom ones check out the file and code above.
    I wrote ImpEx.

    Blog | Me

    Comment


    • #3
      Thanks Jerry. For phpBB, which file should I look at? I am not at home to check it out right now.

      I am going to place my order for a second license today or tomorrow.

      Thanks for the great help.

      Comment


      • #4
        The phpBB2 user module file is :

        impex/systems/phpBB2/004.php

        Look at lines 71-73 (add_custom_field()) and then add your ($try->add_custom_value()) line 182 with the values.

        e.g. if you have a field "cool_value" in your user table you want to bring in you'll need this :

        At the top, to create it in the database :

        Code:
        $this->add_custom_field($Db_target, $tdt, $ttp, 'cool_value', 'the users cool factor');
        Then at the bottom, to import it for each user :

        Code:
        $this->add_custom_value('cool_value', $user['user_cool'] );
        Where ['user_cool'] is the field name in the user table.
        I wrote ImpEx.

        Blog | Me

        Comment


        • #5
          Hi Jerry,

          I saw in that file at line 182, it has:

          $this->add_default_value
          not
          $this->add_custom_value

          So, is this right?


          I have added:
          $this->add_custom_field($Db_target, $tdt, $ttp, 'realname', 'the imported user real name');

          and added this at the bottom:
          $try->add_default_value('RealName', $user['user_realname']);


          One additional import that I would like to have is birthday. I know birthday is not custom field in vB. How do I import that?

          Thank you.
          Last edited by ywang98; Mon 18th Jul '05, 7:56pm.

          Comment


          • #6
            Hi Jerry,

            I was able to import the real name after playing around a bit. Thank you!

            I still need to import the birthday. Please give me some pointers when see this. Thank you.

            Comment


            • #7
              Originally posted by ywang98
              I still need to import the birthday. Please give me some pointers when see this. Thank you.
              Birthday is a default in vBulletin so it should be imported.

              What version of phpBB2 are you importing from ? how is the birthday stored in your database, as I've seen it a few diffrent ways with hacks now, I didn't think phpBB2 had it by default.
              I wrote ImpEx.

              Blog | Me

              Comment


              • #8
                I've just checked the 2.0.16 schema and there is no birthday by default.

                Though if you tell me how its stored in your dB I can show you how to import it to vBulletin correctly.
                I wrote ImpEx.

                Blog | Me

                Comment


                • #9
                  Jerry,

                  It was installed as a hack in phpBB. I had to add a field in the phpbb_users table for this.

                  The field is: user_birthday
                  Type: INT
                  Length/Values: 11
                  Null: Not Null
                  Default: 999999

                  Thanks.

                  Comment


                  • #10
                    Oh, the value of October 5, 1965 is -1549, the value of October 13, 1970 is 285, the value of April 1, 1962 is -2832, the value of February 2, 1979 is 3319.

                    I don't know how these are calculated, that is why I listed them here for your reference.

                    Comment


                    • #11
                      Hi Jerry,

                      Do you need me to supply you with more data to do this?

                      Thanks.

                      Comment


                      • #12
                        What is the hack that added the birthday ?
                        I wrote ImpEx.

                        Blog | Me

                        Comment


                        • #13
                          Hi Jerry,

                          I realized that it would be necessary for you to look at the code to see how the calculation is done.

                          I have included the hack here as an attachment.

                          I really appreciate your help.

                          Comment


                          • #14
                            I removed the attachment because of forum rules, though I belive I've figured it out anyway :

                            Try adding this with the other user module code :

                            PHP Code:
                            if ($user['user_birthday'] AND $user['user_birthday'] != 999999)
                            {
                                
                            $bd $user['user_birthday']*86400+86400;
                                
                            $year     date("Y"$bd);
                                
                            $month     date("m"$bd);
                                
                            $day     date("s"$bd);
                                
                                
                            $try->set_value('nonmandatory''birthday',            "{$month}-{$day}-{$year}");
                                
                            $try->set_value('nonmandatory''birthday_search',    "{$year}-{$month}-{$day}");                

                            The dates match up with your examples.
                            I wrote ImpEx.

                            Blog | Me

                            Comment


                            • #15
                              Oops! Sorry about the attachment. I didn't know.

                              I will give this a try tonight. Thank you so much.

                              Another quick question:

                              In my new forum (a new license) running still in test mode. I still have the phpBB board running, and people are still visiting it and putting new content on it.

                              My question is that when I am ready to move the forum over completely, I can go ahead and import using Impex again and it will overwrite the users, threads, and posts that was already imported at an earlier phpBB database image. Is this assumption correct?

                              I noticed that if I try to import the forums over again, it doubles up. Just wanted to make sure that the threads, posts, and users won't do that.

                              Comment

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