AI Verified

Name

Access for all to Elementor submissions

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

lowthian

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://www.lowthiandesign.com

History

Last modified:

22/10/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Access for all to Elementor submissions

 
                    
1if (!class_exists('ElementorFormSubmissionsAccess'))
2{
3 
4 class ElementorFormSubmissionsAccess
5 {
6 
7 static function isJustEditor()
8 {
9 return current_user_can('edit_posts') && !current_user_can('manage_options');
10 }
11 
12 
13 static function filterRestEndpoints($endpoints)
14 {
15 if (self::isJustEditor())
16 {
17 error_reporting(0); // there are a couple of PHP notices which prevent the Ajax JSON data from loading
18 foreach($endpoints as $route=>$handlers) //for each endpoint
19 if (strpos($route, '/elementor/v1/form') === 0) //it is one of the elementor endpoints forms, form-submissions or form-submissions/export
20 foreach($handlers as $num=>$handler) //loop through the handlers
21 if (is_array ($handler) && isset ($handler['permission_callback'])) //if this handler has a permission_callback
22 $endpoints[$route][$num]['permission_callback'] = function($request){return true;}; //handler always returns true to grant permission
23 }
24 return $endpoints;
25 }
26 
27 
28 static function addOptionsPage()
29 {
30 if (!self::isJustEditor()) return;
31 add_menu_page('Submissions', 'Submissions', 'edit_posts', 'e-form-submissions', function(){echo '<div id="e-form-submissions"></div>';});
32 }
33 
34 
35 static function hookIntoWordpress()
36 {
37 add_filter ('rest_endpoints', array('ElementorFormSubmissionsAccess', 'filterRestEndpoints'), 1, 3);
38 add_action ('admin_menu', array('ElementorFormSubmissionsAccess', 'addOptionsPage'));
39 }
40 }
41 
42 ElementorFormSubmissionsAccess::hookIntoWordpress();
43} //a wrapper to see if the class already exists or not

0

Related Snippets

Please see some snippets below related to this snippet..

General

AI Verified

0

WhatsApp and Call Icon

Added: 5 months ago

Last Updated: 5 months ago

Display Sticky WhatsApp and Call image/icon on website

General

Unverified

0

Hide Item when Another Appears

Added: 1 month ago

Last Updated: 1 month ago

Any item/container with the ID 'Hex' will disappear from view when any item/container with 'Fex' appears in view.

General

AI Verified

0

Migrate BasePress -> BetterDocs: 2. Analytics

Added: 8 months ago

Last Updated: 8 months ago

<p>Use these to migrate data from BasePress to BetterDocs, or clone them and customize to migrate to some other structure.</p> <p>Import all 4 snippets, then run them in order. This will handle docs,...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

AI Verified

1

View update info on posts

Added: 2 weeks ago

Last Updated: 2 weeks ago

WordPress Admin

AI Verified

1

Link to clear Bunny CDN

Added: 4 months ago

Last Updated: 4 months ago

I wanted a way for my clients to have a one click "Clear Bunny CDN" without having to go into other settings. Worked with AI and BunnyCDN support on this.

General

AI Verified

0

Gravity to Stripe Description

Added: 8 months ago

Last Updated: 8 months ago