Title: Page Guard
Author: fculross
Published: <strong>21 Tháng 3, 2017</strong>
Last modified: 22 Tháng 8, 2022

---

Tìm kiếm plugin

![](https://ps.w.org/page-guard/assets/banner-772x250.png?rev=1621895)

Plugin này **chưa được cập nhật với 3 phiên bản mới nhất của WordPress**. Nó có 
thể không được hỗ trợ và bảo trì, và có thể xung đột với các phiên bản WordPress
mới nhất.

![](https://ps.w.org/page-guard/assets/icon-128x128.png?rev=1621897)

# Page Guard

 Bởi [fculross](https://profiles.wordpress.org/fculross/)

[Tải về](https://downloads.wordpress.org/plugin/page-guard.zip)

 * [Chi tiết](https://vi.wordpress.org/plugins/page-guard/#description)
 * [Đánh giá](https://vi.wordpress.org/plugins/page-guard/#reviews)
 *  [Cài đặt](https://vi.wordpress.org/plugins/page-guard/#installation)
 * [Nhà phát triển](https://vi.wordpress.org/plugins/page-guard/#developers)

 [Hỗ trợ](https://wordpress.org/support/plugin/page-guard/)

## Mô tả

Page Guard uses a single URL parameter or POST variable as a means of providing 
a token to guard access to any page on which this plugin’s shortcode is placed. 
Output of alternative content can be made to occur when the token is missing or 
fails to match what is expected – if the token received matches the expected one,
the controlled content can be revealed to the visitor.

For this version, an additional shortcode attribute “title” also allows the page
title to be changed conditionally PROVIDED JAVASCRIPT IS ENABLED IN THE BROWSER (
it has no effect if JavaScript is turned off!)

The shortcode to use is ‘pageguard’ – its attributes are:

    ```
    tokenparam (required) -> a string value containing the name of the token URL param - e.g. 'mytoken'
    eq (optional) -> a string value containing the expected value of the tokenparam - e.g. 'x34ggj45b'
    ne (optional) -> as for "eq" but when used, shortcode will output content on non matching token
    absent (optional) -> when absent="1", shortcode will output content on detection of missing token
    title (optional) -> a string containing a page title to apply when the parent shortcode's criteria are met 
    ```

Syntax examples:

    ```
      show block on matching token -
        [pageguard param="token" eq="download"]
        Text to be output on matching token found
        [/pageguard]

      show block on non match + change title
        [pageguard tokenparam="token" ne="download" title="Downloads - invalid token"]
        Error text for output when token fails to match
        [/pageguard]

      show this on no token found + change title
        [pageguard tokenparam="token" absent="1" title="Downloads - missing token"]
        Error text for output when token is missing
        [/pageguard]
    ```

### Usage

A typical use scenario might be to control access to a downloads page. Suppose you
have a PayPal “Buy Now” button on your site which allows visitors to make a payment
for say, an eBook or audio recording. When setting up the button in your PayPal 
account you specify a URL on your site to which the visitor is returned after they’ve
made payment. On this return page you’ve added a link the visitor can use to download
their purchase – however, you don’t want any non paying visitors to have access 
to the download link(s) on the page! If you also want the page title to reflect 
any error conditions, you an use the “title” attribute to do this (please be aware
however that this functionality depends on JavaScript being enable in the user’s
browser – it disabled, “title” has no effect.)

Add a parameter to the end of the return URL (using any name and value you want)
when you set up your button in PayPal e.g.

    ```
    "http://your.wordpress.site/download/?dltoken=x34ggj45b"
    ```

Next, add pageguard short codes for the cases you intend to handle to your return
page in WordPress –

    ```
    [pageguard param="token" eq="x34ggj45b" title="Title for matched token"]
    Text to be output on matching token found
    [/pageguard]

    [pageguard tokenparam="token" ne="x34ggj45b" title="Title for failed match"]
    Error text for output when token fails to match
    [/pageguard]

    [pageguard tokenparam="token" absent="1" title="Title for missing token"]
    Error text for output when token is missing
    [/pageguard]
    ```

This will correctly display the main content for the page when Page Guard detects
a matching token. It also provides for the possibility of providing different error
content for the page in the event of the token being incorrect or missing.

## Cài đặt

 1. To install the plugin, download the zip file and upload via the plugin interface
    of your WordPress site or install the plugin through the WordPress plugins screen
    directly.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress

## Đánh giá

Không có đánh giá nào cho plugin này.

## Người đóng góp & Lập trình viên

“Page Guard” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.

Những người đóng góp

 *   [ fculross ](https://profiles.wordpress.org/fculross/)

[Dịch “Page Guard” sang ngôn ngữ của bạn.](https://translate.wordpress.org/projects/wp-plugins/page-guard)

### Muốn tham gia phát triển?

[Duyệt code](https://plugins.trac.wordpress.org/browser/page-guard/), check out 
[SVN repository](https://plugins.svn.wordpress.org/page-guard/), hoặc theo dõi [nhật ký phát triển](https://plugins.trac.wordpress.org/log/page-guard/)
qua [RSS](https://plugins.trac.wordpress.org/log/page-guard/?limit=100&mode=stop_on_copy&format=rss).

## Nhật ký thay đổi

#### 1.1

Added JavaScript based support for changing page title to match shortcode criteria

#### 1.0

First implementation

## Meta

 *  Phiên bản **1.1**
 *  Cập nhật lần cuối **4 năm trước**
 *  Số lượt cài đặt **Ít hơn 10**
 *  Phiên bản WordPress ** 4.7 hoặc cao hơn **
 *  Đã kiểm tra lên đến **6.0.14**
 *  Ngôn ngữ
 * [English (US)](https://wordpress.org/plugins/page-guard/)
 * Thẻ
 * [post](https://vi.wordpress.org/plugins/tags/post/)[query string](https://vi.wordpress.org/plugins/tags/query-string/)
   [url](https://vi.wordpress.org/plugins/tags/url/)
 *  [Nâng cao](https://vi.wordpress.org/plugins/page-guard/advanced/)

## Đánh giá

Chưa có đánh giá nào được gửi.

[Your review](https://wordpress.org/support/plugin/page-guard/reviews/#new-post)

[Xem tất cả đánh giá](https://wordpress.org/support/plugin/page-guard/reviews/)

## Những người đóng góp

 *   [ fculross ](https://profiles.wordpress.org/fculross/)

## Hỗ trợ

Có điều gì muốn nói? cần giúp đỡ?

 [Xem diễn đàn hỗ trợ](https://wordpress.org/support/plugin/page-guard/)

## Ủng hộ

Bạn có muốn hỗ trợ vào sự phát triển của plugin này?

 [ Ủng hộ plugin này ](https://gitlab.com/fculross/wp-plugins/wikis/Donate)