Custom userrole not able to save table

[ad_1]

Hi

I have set up assigned permission to access wpDataTable to a custom user role. For example, when a user with a custom user-role “rag_admin” login then that user can only access wpDataTable. So we have added a condition if the page is equal to wpDataTable then add “manage_options”. Everything is working okay just not able to save the tables.

Getting Error
There was an error while trying to save the table! parsererror

It is happening due to some permission glitch.

	if (isset($_GET['page'])) {
		$page = $_GET['page'];
		
		// if the page has "wpdatatables-"
		if (strpos($page, 'wpdatatables-') === 0) {
			if (in_array('rag_admin', $current_user->roles)) {
				$allcaps['manage_options'] = true;
			}
		}
	}

	return $allcaps;

hook:
add_filter('user_has_cap', 'myuser_capabilities', 10, 3);

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer