Changeset 2708812
- Timestamp:
- 04/12/2022 08:46:09 PM (4 years ago)
- File:
-
- 1 edited
-
tori-ajax/trunk/README.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tori-ajax/trunk/README.txt
r2708785 r2708812 71 71 }` 72 72 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?= 74 You can use the fourth parameter to set the mode to *'both'*. 75 75 By default, the mode is set to *'private'* for authenticated Ajax actions for logged-in users. 76 76 You can also use *'public'* to expose the Ajax action to non-authenticated Ajax actions for logged-out users 77 77 **Summary** 78 78 *both* - For exposing the Ajax action to authenticated Ajax actions for logged-in users and non-authenticated Ajax actions for logged-out users. 79 Example 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 79 89 *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 90 Example 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 100 Or 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. 110 Example 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 }` 81 119 82 120 == Screenshots == … … 84 122 1. Sample theme functions PHP code 85 123 2. Sample Javascript code 124 3. Sample theme functions PHP code for authenticated and non-authenticated Ajax actions. 125 4. Sample theme functions PHP code for authenticated Ajax actions. 126 5. Sample theme functions PHP code for non-authenticated Ajax actions. 86 127 87 128 == Changelog == … … 91 132 92 133 = 1.0.1 = 93 * Fixed: Uncaught ArgumentCountError on nonce issue.134 * Fixed: Uncaught ArgumentCountError during the nonce check. 94 135 * JSON output for nonce messages. 95 136
Note: See TracChangeset
for help on using the changeset viewer.