Change WordPress user roles and capabilities › Forums › Bug Reports › bug that prevents access to pardot / gravity forms functionality
- This topic has 7 replies, 2 voices, and was last updated 5 years, 4 months ago by Vladimir.
-
AuthorPosts
-
04/07/2019 at 06:41 #5778jamesburdenParticipant
Hi, there seems to be a bug with URE and being able to access the settings of a plugin called Pardot Connector (https://northernbeacheswebsites.com.au/pardot-to-gravity-forms-connector/). On an installation with only WordPress and Gravity Forms activated the Pardot Connector plugin works fine. If I activate URE then I cannot access any of the options, settings or pages that are related to the Pardot Connector plugin. So I cannot access its settings page (it simply doesn’t appear in the menu) and I cannot access the Pardot Connector options within Gravity Forms settings.
I am logging in with full administrator access. My role has all options ticked in URE settings.
I have a staging site environment set up that replicates the problem, and would be grateful if you could let me know what might be causing this issue. If you need admin access to the site I can provide that.
Thanks for your time
James
04/07/2019 at 07:19 #5779VladimirKeymasterHi James,
Check if you have full access to Gravity Forms itself after activate User Role Editor. It may be related too.
GF plugin itself changes its work with permissions if detects plugin which allows to edit user roles. It requires capabilities from more detailed list in this case. GF add-on may follow it.Go to Users->User Role Editor, select ‘Administrator’ role and look if there are any not granted capabilities from “Gravity Forms” group.
04/07/2019 at 08:07 #5780jamesburdenParticipantHi Vladimir – thanks for the quick response.
Yes, all gravity forms capabilities are granted to the administrator role. As I said in the message above – all capabilities are granted to the administrator role.
04/07/2019 at 08:15 #5781VladimirKeymasterCan you share “Pardot Connector” plugin with me to check what prevents access?
Use DropBox similar service, share with support [at-sign] role-editor.com04/07/2019 at 08:20 #5782jamesburdenParticipantHi Vladimir – have uploaded to dropbox and shared with you.
04/07/2019 at 08:56 #5783VladimirKeymasterJames,
I got it, thanks.
Quick workaround add new capability ‘gform_full_access’ and grant it to ‘administrator’ role.
I will investigate later (1-2 days) what another capability is required by GF for Pardot add-on in case role does not have ‘gform_full_access’ capability.04/07/2019 at 16:50 #5784jamesburdenParticipantGreat – thanks Vladimir – that works.
Look forward to hearing any updates from you regarding further investigations you do.
09/07/2019 at 02:31 #5801VladimirKeymasterHi James,
Gravity Forms adds menu for add-on if current user has access to this add-on. Permission is checked this way:
if ( $this->current_user_can_any( $this->_capabilities_plugin_page ) ) { //creates the subnav left menu add_filter( 'gform_addon_navigation', array( $this, 'create_plugin_page_menu' ) ); }
current_user_can_any() function works this way:
public static function current_user_can_any( $caps ) { if ( ! is_array( $caps ) ) { $has_cap = current_user_can( $caps ) || current_user_can( 'gform_full_access' ); return $has_cap; } foreach ( $caps as $cap ) { if ( current_user_can( $cap ) ) { return true; } } $has_full_access = current_user_can( 'gform_full_access' ); return $has_full_access; }
Thus,
_capabilities_plugin_page
property is a key for access to the plugin. If user does not can_capabilities_plugin_page
, code checks if user has older style full access to the GF plugin – ‘gform_full_access’._capabilities_plugin_page
property of the base class for any add-on GFAddOn is empty by default:/** * @var string|array A string or an array of capabilities or roles that have access to the plugin page */ protected $_capabilities_plugin_page = array();
“Pardot Connector” (PC) plugin does not define this property too. Thus the only way to get access to PC plugin when role editor plugin is active and GF uses detailed capabilities list instead of the single
gform_full_access
is to grant to a rolegform_full_access
.Workaround (fix): add
$_capabilities_plugin_page
property to PC plugin, like this (look at the last line in the code fragment below):class PardotGravityFormsConnectorAddOn extends GFFeedAddOn { protected $_version = PARDOT_GRAVITYFORMS_CONNECTOR_VERSION; protected $_min_gravityforms_version = '1.9'; protected $_slug = 'pardot-gravityforms-connector'; protected $_path = 'pardot-gravityforms-connector/pardot-gravityforms-connector.php'; protected $_full_path = __FILE__; protected $_title = 'Pardot Gravity Forms Connector'; protected $_short_title = 'Pardot Connector'; protected $_capabilities_plugin_page = 'gravityforms_edit_settings';
This way ‘administrator’ role will get access to PC plugin without ‘gform_full_access’ capability.
-
AuthorPosts
- You must be logged in to reply to this topic.