Plugin Directory

Changeset 2708812


Ignore:
Timestamp:
04/12/2022 08:46:09 PM (4 years ago)
Author:
alvinmuthui
Message:

README.txt content update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tori-ajax/trunk/README.txt

    r2708785 r2708812  
    7171}`
    7272
    73 = How to register action for both logged in and non logged in users? =
    74 * You can use the fourth parameter to set the mode to *'both'*.
     73= How to register action for both logged in and non logged in users?=
     74You can use the fourth parameter to set the mode to *'both'*.
    7575By default, the mode is set to *'private'* for authenticated Ajax actions for logged-in users.
    7676You can also use *'public'* to expose the Ajax action to non-authenticated Ajax actions for logged-out users
    7777**Summary**
    7878*both* - For exposing the Ajax action to authenticated Ajax actions for logged-in users and non-authenticated Ajax actions for logged-out users.
     79Example
     80`if ( function_exists( 'toria_add_ajax' ) ) {
     81    toria_add_ajax(
     82        'simple',
     83        'my_simple_ajax',
     84        get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js',
     85        'both'
     86    );
     87}`
     88
    7989*private* - For exposing the Ajax action to authenticated Ajax actions for logged-in users.
    80 *public* - For exposing the Ajax action to non-authenticated Ajax actions for logged-out users
     90Example
     91`if ( function_exists( 'toria_add_ajax' ) ) {
     92    toria_add_ajax(
     93        'simple',
     94        'my_simple_ajax',
     95        get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js',
     96        'private'
     97    );
     98}`
     99
     100Or
     101`if ( function_exists( 'toria_add_ajax' ) ) {
     102    toria_add_ajax(
     103        'simple',
     104        'my_simple_ajax',
     105        get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js'
     106    );
     107}`
     108
     109*public* - For exposing the Ajax action to non-authenticated Ajax actions for logged-out users.
     110Example
     111`if ( function_exists( 'toria_add_ajax' ) ) {
     112    toria_add_ajax(
     113        'simple',
     114        'my_simple_ajax',
     115        get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js',
     116        'public'
     117    );
     118}`
    81119
    82120== Screenshots ==
     
    841221. Sample theme functions PHP code
    851232. Sample Javascript code
     1243. Sample theme functions PHP code for authenticated and non-authenticated Ajax actions.
     1254. Sample theme functions PHP code for authenticated Ajax actions.
     1265. Sample theme functions PHP code for non-authenticated Ajax actions.
    86127
    87128== Changelog ==
     
    91132
    92133= 1.0.1 =
    93 * Fixed: Uncaught ArgumentCountError on nonce issue.
     134* Fixed: Uncaught ArgumentCountError during the nonce check.
    94135* JSON output for nonce messages.
    95136
Note: See TracChangeset for help on using the changeset viewer.