Discuz & Ucenter Revision-2014.12.19

Source: Internet
Author: User
Recently in the whole Java and ucenter things, constrained by the project architecture needs, not completely ucenter-centric, so in the docking process encountered a lot of unpleasant things. After a lot of research, finally solved two of the major problems, is now recorded for future review.

First, to solve the problem of email must fill in

The project does not require users to fill out email when registering, but the Ucenter API requires you to enter an email to verify that the Ucenter code must be modified to bypass. Here's the code for the change:

/uc_server/control/user.php 69 Lines:

1 // Note: Solve the email must fill in the question 2 //if (($status = $this->_check_email ($email)) < 0) {3//    return $status; 4 //}

Second, to resolve the user must manually login 1 times the issue of the Forum

Because BBS blocked the discuz with the registration, login, find secret operations, so you must achieve single sign-on. There is a problem with a very sore egg: after the master registered account is synced to Ucenter, Ucenter does not notify other apps, which means that by default, other apps (including discuz) cannot update the user list immediately after the new user has registered. After careful study found that Discuz is in the local registration, login and other events will be synchronized with the Ucenter. This led to a new registered user in the main station, unable to successfully log in BBS single point-because there is no such user in BBS. There are two ways to solve the problem, one is the user manually log in once Bbs,bbs the mechanism will automatically synchronize the user information from the Ucenter, the second is to modify the Discuz system code, the single sign-on request automatically synchronize user data. After weighing the various factors, it was decided to adopt a second set of options. Here's the code for the change:

/api/uc.php 192 lines:

1 //NOTE The user must manually login 1 times the forum issue2 $member= Getuserbyuid ($uid, 1);3 4 if(!$member) {5     $init _arr=Explode(',',$_g[' Initcredits ']);6     $groupid=$_g[' Regverify ']? 8:$_g[' Newusergroupid '];7 8C::t (' Common_member ')->insert ($uid,$get[' username '],MD5(Random (10)),$get[' Email '],$_g[' ClientIP '],$groupid,$init _arr);9 Ten     $member= Getuserbyuid ($uid, 1); One } A  - if($member) { -Dsetcookie (' auth ', Authcode ("$member[Password]\t$member[UID] ", ' ENCODE '),$cookietime); the}

The above describes the Discuz & Ucenter revision notes-2014.12.19, including aspects of the content, I hope to be interested in the PHP tutorial friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.