The functions implemented in this article:
Control whether the bullet box is displayed or not
Function usage scenarios
In a previous article Wrote, discuz implements automatic registration and login. But we don't want that prompt message to come out.
After a brief search on the Internet, some said that the background can be set, but when I took a look at the back, I found that the setting was only for certain fixed scenes.
Then we can write a display method suitable for our project
Analysis of pop-up box implementation
Anyone who has used it for a while discuz knows that the front desk The pop-up box is actually determined by the background showmessage
method.
We used code to trace that this method is in the upload/source/function/function_core.php
file, about line 1424
Then we are tracking dshowmessage
This method
The final file of this method is upload/source/function/function_message.php
here
Then we pull the code to the end, and we can see a variable of show_messge
and a template address loaded
At this time we Find the location of this template: upload/template/default/touch/common/showmessage.htm
In this template we can see a variable show_message
.
In order to confirm that the show_message in the template and the show_message in the PHP file are consistent, let’s do a test
Modification: upload /source/function/function_message.php
Line 238
Then test the results on the page and there is no problem. The two variables are consistent
Implement your own display method
After the above test, we learned that the upload/source/function/function_message.php file The show_message on line 238 is consistent with the show_message of the template upload/template/default/touch/common/showmessage.htm.
Then we can declare a variable. If you want to display your own style, declare a variable and then control it in the template.
The following is a KaKa case: as long as you have this requirement KaKa Ka’s solution can 100% solve your problem
This code is to determine whether the user is registered, and if so, log in directly. (No need to worry here, Kaka’s case came from the original system.)
You can see that I added a new variable in showmessage called is_login, and the value is 1
Since we need to use this value in the template, let’s follow suit and declare is_login as a global variable in the upload/source/function/function_message.php file
Then with this value you can use it in the upload/template/default/touch/common/showmessage.htm template
Add yourself to this If is enough
There is also a particularly simple way to control entry in line 239 of upload/source/function/function_message.php Template
#So what needs to be done at this time! Just build this template
Copy the showmassge file in the upload/template/default/touch/common directory
Then modify this file, let Just jump directly after entering.
Achieve the effect
The pop-up box is gone when logging in
There are still things that should be found in other places
Summary
After summarizing the contents of this article After all the files have been modified! If you want to use your own defined template, you can use it directly
is_login is an identifier of your custom template
showmessage('login_succeed', 'forum.php',['username'=>$username,'is_login'=>1],array('showdialog' => 1));
The above is the detailed content of How discuz controls the display of bullet boxes independently. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version
God-level code editing software (SublimeText3)