Table of Contents
Discuz & UCenter 修改手记,discuz论坛
一、解决email必须填写的问题
二、解决用户必须手工登录1次论坛的问题
Home php教程 php手册 Discuz & UCenter 修改手记,discuz论坛

Discuz & UCenter 修改手记,discuz论坛

Jun 13, 2016 am 09:18 AM
amp discuz Revise Notes forum

Discuz & UCenter 修改手记,discuz论坛

最近在整JAVA和UCENTER的东西,受限于项目架构需要,无法完全以UCENTER为中心,所以在对接过程中遇到了许多不愉快的事情。经历多番研究,终于解决了其中了两个大问题,现记录下来,以备日后查看。

一、解决email必须填写的问题

项目并不要求用户注册时填写email,但UCENTER API要求必须输入email才可以通过验证,不得已必须得修改UCENTER代码才能绕过。以下是改动的代码:

/uc_server/control/user.php 69行:

<span>1</span> <span>//</span><span> NOTE: 解决email必须填写的问题
</span><span>2</span> <span>//if(($status = $this->_check_email($email)) < 0) {
</span><span>3</span> <span>//    return $status;
</span><span>4</span> <span>//}</span>
Copy after login

二、解决用户必须手工登录1次论坛的问题

由于BBS屏蔽了DISCUZ自带的注册、登录、找密等操作,所以必须要实现单点登录。当中遇到了一个非常蛋疼的问题:主站注册的账户同步到UCENTER之后,UCENTER并不会通知其他应用,也就是说默认情况下,其他应用(包括DISCUZ在内)无法在新用户注册之后立即更新用户列表。细细研究之后发现,DISCUZ是在本地注册、登录等事件中才会与UCENTER同步。这导致了,在主站新注册的用户,无法在BBS单点登录成功——因为在BBS中根本不存在这个用户。解决的方法有两个,一是用户手工登录一次BBS,BBS自带的机制会自动将用户信息从UCENTER同步过来;二是修改DISCUZ系统代码,在单点登录请求时自动同步用户数据。在权衡了各方面因素之后,决定采用第二套方案。以下是改动的代码:

/api/uc.php 192行:

<span> 1</span> <span>//</span><span> NOTE 解决用户必须手工登录1次论坛的问题</span>
<span> 2</span> <span>$member</span> = getuserbyuid(<span>$uid</span>, 1<span>);
</span><span> 3</span> 
<span> 4</span> <span>if</span> (!<span>$member</span><span>) {
</span><span> 5</span>     <span>$init_arr</span> = <span>explode</span>(',', <span>$_G</span>['initcredits'<span>]);
</span><span> 6</span>     <span>$groupid</span> = <span>$_G</span>['regverify'] ? 8 : <span>$_G</span>['newusergroupid'<span>];
</span><span> 7</span> 
<span> 8</span>     C::t('common_member')->insert(<span>$uid</span>, <span>$get</span>['username'], <span>md5</span>(random(10)), <span>$get</span>['email'], <span>$_G</span>['clientip'], <span>$groupid</span>, <span>$init_arr</span><span>);
</span><span> 9</span> 
<span>10</span>     <span>$member</span> = getuserbyuid(<span>$uid</span>, 1<span>);
</span><span>11</span> <span>}
</span><span>12</span> 
<span>13</span> <span>if</span>(<span>$member</span><span>) {
</span><span>14</span>     dsetcookie('auth', authcode("<span>$member</span>[password]\t<span>$member</span>[uid]", 'ENCODE'), <span>$cookietime</span><span>);
</span><span>15</span> }
Copy after login

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to change the personal name in the group on DingTalk_How to modify the personal name in the group on DingTalk How to change the personal name in the group on DingTalk_How to modify the personal name in the group on DingTalk Mar 29, 2024 pm 08:41 PM

1. First open DingTalk. 2. Open the group chat and click the three dots in the upper right corner. 3. Find my nickname in this group. 4. Click to enter to modify and save.

Can Douyin Blue V change its name? What are the steps to change the name of corporate Douyin Blue V account? Can Douyin Blue V change its name? What are the steps to change the name of corporate Douyin Blue V account? Mar 22, 2024 pm 12:51 PM

Douyin Blue V certification is the official certification of a company or brand on the Douyin platform, which helps enhance brand image and credibility. With the adjustment of corporate development strategy or the update of brand image, the company may want to change the name of Douyin Blue V certification. So, can Douyin Blue V change its name? The answer is yes. This article will introduce in detail the steps to modify the name of the enterprise Douyin Blue V account. 1. Can Douyin Blue V change its name? You can change the name of Douyin Blue V account. According to Douyin’s official regulations, corporate Blue V certified accounts can apply to change their account names after meeting certain conditions. Generally speaking, enterprises need to provide relevant supporting materials, such as business licenses, organization code certificates, etc., to prove the legality and necessity of changing the name. 2. What are the steps to modify the name of corporate Douyin Blue V account?

A must-have for Discuz users! Comprehensive analysis of renaming props! A must-have for Discuz users! Comprehensive analysis of renaming props! Mar 12, 2024 pm 10:15 PM

A must-have for Discuz users! Comprehensive analysis of renaming props! In the Discuz forum, the name change function has always received much attention and demand from users. For some users who need to change their name, name change props can easily modify the user name, and this is also an interesting way of interaction. Let’s take an in-depth look at the renaming props in Discuz, including how to obtain them, how to use them, and solutions to some common problems. 1. Obtain name-changing props in Discuz. Name-changing props are usually purchased through points or the administrator

How to modify the address location of published products on Xianyu How to modify the address location of published products on Xianyu Mar 28, 2024 pm 03:36 PM

When publishing products on the Xianyu platform, users can customize the geographical location information of the product according to the actual situation, so that potential buyers can more accurately grasp the specific location of the product. Once the product is successfully put on the shelves, there is no need to worry if the seller's location changes. The Xianyu platform provides a flexible and convenient modification function. So when we want to modify the address of a published product, how do we modify it? This tutorial guide will provide you with a detailed step-by-step guide. I hope it can help. Everyone! How to modify the release product address in Xianyu? 1. Open Xianyu, click on what I published, select the product, and click Edit. 2. Click the positioning icon and select the address you want to set.

Discuz Forum Permission Management: Read Permission Setting Guide Discuz Forum Permission Management: Read Permission Setting Guide Mar 10, 2024 pm 05:33 PM

Discuz forum permission management: Read the permission setting guide In Discuz forum management, permission setting is a crucial part. Among them, the setting of reading permissions is particularly important, as it determines the scope of content that different users can see in the forum. This article will introduce in detail the reading permission settings of the Discuz forum and how to flexibly configure it for different needs. 1. Basic concepts of reading permissions In the Discuz forum, reading permissions mainly include the following concepts that need to be understood: Default reading permissions: Default after new user registration

Discuz Editor: an efficient post layout tool Discuz Editor: an efficient post layout tool Mar 10, 2024 am 09:42 AM

Discuz Editor: An efficient post layout tool. With the development of the Internet, online forums have become an important platform for people to communicate and share information. In the forum, users can not only express their opinions and ideas, but also discuss and interact with others. When publishing a post, a clear and beautiful format can often attract more readers and convey more accurate information. In order to facilitate users to quickly type and edit posts, the Discuz editor came into being and became an efficient post typesetting tool. Discu

How to change the automatic screen lock time on an Apple phone. Introduction to how to adjust the screen lock time on an Apple phone. How to change the automatic screen lock time on an Apple phone. Introduction to how to adjust the screen lock time on an Apple phone. Mar 23, 2024 am 08:01 AM

1. First, click Settings on the screen. 2. Then click [Display and Brightness]. 3. Then click [Auto Lock]. 4. Then set the time that needs to be automatically locked. 5. After the setting is completed, click the return button to complete the setting.

Detailed explanation of steps to modify Discuz domain name Detailed explanation of steps to modify Discuz domain name Mar 11, 2024 am 11:00 AM

Detailed explanation of the steps to modify the Discuz domain name. Specific code examples are required. With the development and operation of the website, sometimes we need to modify the domain name of the Discuz forum. This may be due to brand change, website SEO optimization, or other reasons. No matter what the reason is, modifying the Discuz domain name is a process that requires careful operation. Today we will introduce the steps of modifying the Discuz domain name in detail and provide specific code examples. Step 1: Back up data. Before modifying the domain name, you must first ensure that the website

See all articles