trừ khi chúng ta lưu các thay đổi, thay đổi sẽ kéo dài cho đến khi phiên làm việc hết hạn. Các thông số sử dụng này không được sử dụng như một cửa hàng tạm thời. Để lưu trữ dữ liệu tạm thời, chúng ta nên sử dụng các phiên họp và người sử dụng nhà nước, chúng ta sẽ thấy cả hai trong phần tiếp theo. | Chapter 7 When we perform any modifications to the user s session unless we save the changes the modifications will last only until the session expires. User parameters are not used as a temporary store. To store temporary data we should use the session and the user state we will see both in the next section. ị ợL If we store temporary data in user parameters we run the risk Ị ị ị of saving the data accidently to the user s database record. Ị A common design issue is the extension of the user beyond their predefined attributes. There are three common ways of dealing with this Add additional fields to the _ _users table. Create a new table that maintains a one-to-one relationship with the __users table. Use the user s parameters to store additional data. The first option can cause some major problems. If several extensions choose this method there is a chance that there will be a naming conflict between fields. The second option is a good choice if the extra data is searchable ordered or used to modify results returned from the queries. To maintain the table successfully we would have to create a plugin to deal with the events onAfterstoreUser and onAfterDeleteUser explained in Chapter 6. The final option is ideal if the extra data is not subject to searches ordered or used to restrict query results. We might implement these parameters in one of the three ways Manually edit the parameters using the setParam method. This is suitable if there are not many parameters or the user never modifies the parameters using a form. Use JParameter as the basis to create a form in which users can modify the parameters. Allow the user to modify the parameters via the user s component. To do this we need to modify the file for more information about editing XML see Chapter 10 . Before we begin there is something we need to understand. A JUser object essentially has two sets of parameters a RAW parameters string or array params and a JParameter object _params . Both of .