Aug 29 2010

vBulletin Login Integration

I run a roleplaying chat website that has a forum and a separate chat section. However, the forum is integrated into the main site, and the chat. I was recently looking at moving from phpBB to vBulletin as the forum software[1], but needed to make sure that I could still plug the chat and the rest of the site into that easily. Apparently the vBulletin people are paranoid about giving out any code that is in any way related to vBulletin, even this sort of thing. So I did some digging, and found out how to do it.

Here's an example of how to do that. It really is pretty simple.

<?php
// This gets the vBulletin user login info
$curdir = getcwd();
chdir('/path/to/your/forums');  // Change to vBulletin directory
require_once('/path/to/your/forums/global.php');
chdir($curdir);  // Change back to previous directory

// This is the part that actually deals with users
if ($vbulletin->userinfo['userid'] == 0) {
  // User is not logged in; maybe show login form here
  echo "Not logged in.";
} else {
  // User is logged in
  echo "Welcome Back, <b>".$vbulletin->userinfo['username']."</b>";
  // See if user is in a certain user group
  if ($vbulletin->userinfo['usergroupid'] == '6' ) {
  // Maybe this is an admin usergroup, so show admin stuff here
  }
}
?>

So I hope someone else out there finds this useful. If you want to see what all data is contained in $vbulletin->userinfo, just do echo nl2br(print_r($vbulletin->userinfo, true)).

Caveat: I have yet to try this myself, so I'm not 100% sure it will work. But it seems to make sense, and is similar to integration of phpBB and SMF.

[1] Why move from phpBB to vBulletin, when vBulletin costs nearly $200? Overall vBulletin is just better, but here are a few more specific reasons, in order of importance:

  • vBulletin supports Facebook Connect out of the box. That means users don't have to sign up for an account on the forum — they can just click the Facebook Connect button, click to verify, and then bam… they have an account and they're logged in.
  • vBulletin has better anti-spam controls. My forum gets hit with more spam than regular posts. The best anti-spam measure is to require that new users pass a reCAPTCHA test. Modules that make phpBB do this are buggy at best. Granted, SMF (which is free) also has a module that does this pretty easily. It does not, as far as I can tell, currently have a working module for this. The best contender that I found costs $20, and seemed to have a broken implementation on their own site. Not very heartening.
  • vBulletin has a better plugin system. It's nowhere near as awesome as that of WordPress, but still much better than the "send file to server via FTP, edit your existing files" method of phpBB. Granted, a lot of the vBulletin community still does modifications in the old hack-ish way. SMF has a similar system to vBulletin. So as you can see, if it weren't for the damn Facebook Connect thing, SMF would probably win out. It's possible that between now and when I get around to this, the SMF mod will be working though.
  • vBulletin is neater. It's just got a lot more AJAX stuff, a WYSIWYG editor, and other little features that add up to making it a nicer overall experience.


Aug 26 2010

Dad

This post is mostly to get some things off my chest about the situation with my father, and also to let everyone know what's happened and how things are going. More important points in bold, for those who just want the bullet points.

The History

My father is an alcoholic. Has been for most of his life. But the story starts even before that. His father was also an alcoholic. He would work long hours at BF Goodrich, come home, have dinner, then drink. Grandpa didn't drink to get drunk; he drank to pass out. My father has told stories like once when playing cards with grandpa when he was a kid, granpda just passed out in the middle of it.

Dad also became an alcoholic. I'm not sure when he started drinking, but I do know that it was before I was born. For years he controlled it pretty well, but then it seemed to get out of hand. His second wife divorced him because of it, but it didn't get really bad until grandpa died. Not long after that, dad spiraled downward pretty fast. So far that grandma and one of his sisters put him in the hospital and forced him to take Antabuse. My memory is honestly a bit hazy, but I recall him being in and out a few times before he decided he wanted to get better. For the next 10 years, he kept his sobriety.

Recent News

But for the past 6-7 years, my dad has again been losing the battle with alcohol. I think it started when I moved to Atlanta. Part of me can't help but feel at cause, but the rational side of me knows that it's not my responsibility to be around to keep dad sober. He had some ups and downs, at one point had 2 years sobriety, but then began the downward spiral again. His alcoholism is compounded by depression and anxiety issues, as well as sleeplessness (he uses the "I drink so I can sleep" excuse that grandpa did). He also got involved with crack-cocaine, which would be more worrying to me than the alcohol if the alcohol issue weren't life-threateningly bad. Dad's AA friend Jeff started getting in touch with me to let me know when things got bad.

A few weeks ago, things got really bad. Dad called into work for an entire week, and during that time pretty much subsisted on beer alone. If you've seen Leaving Las Vegas, it was a lot like that. Only in real life, it's a lot more messy. Jeff said that when he went in to check on my dad (I'd given him a key to dad's house some time ago), he found him unconscious naked on the couch, with beer cans covering the floor, and fecal matter all over the kitchen floor, living room, hallway, and bathroom.

It was never this bad. The next day Jeff roused my dad so that he could talk to me on the phone. Previous to this, dad had always said that he just wanted to be numb, but that he didn't want to die. This time he told me, "I just don't want to live any more."

The Saga

That was all it took. The next day I drove up to Louisville and took out a mental inquest warrant on my father. That is a warrant saying that he is a danger to himself or others due to a mental illness. Alcoholism is considered a "voluntary mental illness" so warrants are only issued in cases where people are suicidal, homicidal, etc.

The warrant was completed that night, and within 45 minutes the police were on my father's doorstep. My father's condition was so bad (a few of the cops uttered such phrases as "holy mother of god") that they called an ambulance for him, which took him to the ER in the hospital. After they got him in stable condition (which took about 24 hours), they moved him to the psychiatric ward. The psych ward upheld the mental inquest, and sent him along to a rehab facility.

It took dad almost 2 weeks to completely sober up and come out of the mental fog. The facility he was at is supposed to be one of the best in the region (dad mentioned people from a few states away being there), and his therapist/social worker Maria seemed to be very experienced and skilled with people in dad's situation (though they said he was among the worst that they had to deal with). She knew exactly the sorts of pitfalls that he would face after coming out of rehab, and wanted to prepare him for those.

I could probably write several thousand words about this, but to sum up, dad wants to get better. At least, he says he does, and I hope that's true. The doctor told him that he doesn't have another run like that in him — if he goes back to drinking, he will die. He's currently in a transitional living house, supervised 24/7 but the guys in the house go out to a few meetings a day and have other scheduled activities, so it's a little more freedom than the intensive inpatient ward. They're basically teaching dad how to live sober again. When alcoholics get to the point my father did, they forget what it is they love in life. Their life becomes a cycle of drink, sleep, work. So they are going to teach my dad how to break that cycle, and form new habits of living. Dad also volunteered to go on Antabuse, which I think is a great sign.

He's been keeping in touch with me every day. There were (and to some extent, still are) concerns about his work,but I think everything will be fine there. He has a medical doctor saying that he needs to be under this care, and his work has a strong union, so I doubt that anything bad will come of it. Then again, they did fire him for going into treatment a decade and a half ago due to some loophole they have where you can't get more than one instance of temporary disability for the same mental illness. But he fought the man, and actually won that one after an 8-year-long battle.

Things are looking up. Let's hope they stay that way. My friends have all been very supportive, and I am truly blessed to have the great people in my life that I do.

Idea for a next post: With my parents, how did I end up not completely screwed up? Or am I?



Aug 25 2010

New AT&T DSL Service, Actiontec GT701D Modem

Recently AT&T was running a deal where their 6Mbps DSL service is $20 a month for an entire year, then $45/mo after that (they might still be running it). I was paying about $65/mo for cable modem service through Comcast, so even after buying the modem, this will save me about $500 the first year, and $240 every year thereafter. Slightly slower service, but really that’s a no-brainer for me.

The default modem that AT&T recommends is the Motorola 2210. According to all reviews I’ve read about this modem, it overheats and dies a little over a year after setup. So searching for alternatives, I found the Actiontec GT701D, which (as an added bonus) was also $30 cheaper. The only downside is that AT&T tech support can’t help much with the setup. I figure I’m handy with computers, so I’ll take the gamble on the cheaper and better modem.

Short story: everything worked out fine (eventually) and now I’m on my DSL connection.

The Actiontec didn’t initially connect up with the automagic detection, so I had to do a bit of snooping. It’s a very good thing that I still had my old ‘net connection running, to do some Google Fu. After a bit of searching I found the right settings. For anyone else out there in this situation, here’s what those settings are:

Username: attreg@att.net
Pass: attreg
VPI: 8 (this is for AL, FL, GA, KY, LA, MS, NC, SC, TN; other states use 0 for this)
VCI: 35
DSL Mode Setting: ADSL2 (EDIT: after a modem glitch and talking to Actiontec support, this is apparently supposed to be MMODE. No clue why ADSL2 worked before).
ATM QoS class: UBR

Note that the username/password are only for initial setup. You have to go to the registration URL to set up your real username/password. But do note that the password you use for your modem is the alphanumeric string that gets automatically assigned to you, not the one that you type in yourself.



Aug 9 2010

Subversion Checksum Mismatch Workaround

This post relates to Subversion, a version control system. This is used most commonly in programming to allow multiple programmers to work on the same set of files at the same time without stepping on each other’s toes. It also lets you “roll back” your code to any point in time, so if you screw something up, it’s ultra easy to go back to the point before that.

Some writers also use this sort of things to keep copies of their writing, and then if they change/remove something that they later decide they shouldn’t have, it’s easy to peek back at what it was like.

Anyway, sometimes when dealing with Subversion, you might get an error like this when trying to run svn update:

svn: Checksum mismatch for ‘/path/to/repository/.svn/text-base/some-file.php.svn-base’; expected: ‘e5b110ec4409891e81f38203d45e4f5d’, actual: ‘c84a851f87b9b62934b44adc457dcfd0′

There are two fixes for this.  The first is to just delete the directory containing the code where the checksum mismatch is (including the .svn directory below it), and run svn update again from one directory up. But if, like me, the checksum mismatch is in the base directory and it’s inconvenient to do that*, there is another solution. Basically you will check out a fresh copy of the affected directory, and copy over the SVN file with the checksum error.

  1. Check out a new copy of the repository in some other directory. If the problem is in a subdirectory, you only have to check out that subdirectory.
  2. Rename the file mentioned above (the one with the checksum error, /path/to/repository/.svn/text-base/some-file.php.svn-base in this example) to add -bak on the end of it.  It’s always good to have a backup.
  3. Copy that file from the working copy you created in step 1 to your “real” repository location.
  4. Run svn update to see if it works. If not, make sure that in step 3 you copied the file to the correct directory (it needs to go under the .svn/text-base/ directory).
  5. Once that works, you can delete the other working copy you checked out, as well as the -bak file you created.

I’m putting this here in the hopes that Google will index this, and someone else with the same problem might find it useful.

* In my case, I have a lot of images and other things that need to be there, but that aren’t in the SVN repository, so just wiping it out and checking out a whole new working copy of the repository doesn’t really work.