Plugin Author
finnj
(@finnj)
Hi,
I agree that most admins use the back end for editing pages, and originally Frontier Post would not redirect for pages, but this was enabled by request of FP users.
I will make it work, I just need understand why it doesn’t work for multi site. Is this for a “normal” admin on a site, or is the super admin ?
I do not have a multisite setup and I do not have the time to set it up.
What version of Frontier Post are you using ?
Are you managing capabilities from another plugin (ex. User Role Editor), if not can you link to a screen dump of you capabilities settings ?
Do you have a test setup, and are you able to do simple php changes to try and fix this ?
Plugin Author
finnj
(@finnj)
One addtional thing, in the Frontier settings ther is Debug Info – in that section all capabilities are listed.
The redirection checks for frontier_post_redir_edit and frontier_post_can_page
Can yu check how this looks for the admin and the super admin profiles ?
Hello. Thank you for such a prompt support. I had no idea you would respond so fast since most developers take few days here. Much appreciated.
Using WP 4.4.1
Frontier Edit 3.8.1
Here is link to Dropbox folder containing several screenshots.
https://www.dropbox.com/sh/syjvlm9y638zzbc/AAB4aIHOfvqRQn2PAfDwmT27a?dl=0
I don’t think the settings are any different than how I had it setup and working on single site install. It appears it just happened once the site went multisite.
On Debug page, there wasn’t a separate capabilities for super admin and admin. just had 1 administrator, and those capabilities have been shown on one of the screenshots.
Thank you!
Also, I do have full access so I’m able to do php changes via child theme or code snippet.
Also, unfortunately, only have this Multisite and Frontier Edit on live site and not test environment.
Sorry on Screenshot i blocked out the URL since its public. If you’d like a more private discussion, please let me know.
Thank you much appreciated! great plugin nonetheless.
Plugin Author
finnj
(@finnj)
Hi,
I still do not understand why the current code doesn’t work – Frontier Post does not change the the edit url unless the user has the frontier_post_redir_edit capability, and if it is a page the user must also have the frontier_post_can_page capability.
Only reason I can thing of is that current_user_can() always will return true for Super Admins – I have tried to look this up, but didn’t find any confirmation – But to check if that is correct, you can try the following.
edit frontier_post.php in the ../wp-contents/plugins/frontier-post directory
(remember to take a copy of frontier-post.php before editing, but the copy MUST NOT be in frontier-post directory as it is the main plugin file, and that would confuse wordpress)
insert the below 2 lines in the frontier_edit_post_link() function as the first 2 lines:
(I believe it is in line 439)
function frontier_edit_post_link( $url, $post_id )
{
//Do not change anything for super admins editing pages
if ( get_post_type($post_id) === "page" && current_user_can('manage_network_options' )
return $url;
Let me know how it goes, and I will make sure I add it to the next release, maybe supported by an option the the advanced settings.
PS I am out on travel, so I can not test the above code….
Plugin Author
finnj
(@finnj)
OK, did some deep diving, and it turns out that Super Admins has all capabilities, unless specifically denied, so the above “should work”
FYI:
Below code is from: https://developer.wordpress.org/reference/classes/wp_user/has_cap/
// Multisite super admin has all caps by definition, Unless specifically denied.
if ( is_multisite() && is_super_admin( $this->ID ) ) {
if ( in_array('do_not_allow', $caps) )
return false;
return true;
}
Thank you very much.
I’m sorry, requesting a clarification.
Do I add both snippets or just the last one? Do I add both to the frontier_edit_post_link() function?
Just don’t want to do something hastily before I get confirmation.
Thanks a bunch!
Plugin Author
finnj
(@finnj)
you should add the following 2 lines just after the curley bracket in function function frontier_edit_post_link
if ( get_post_type($post_id) === "page" && current_user_can('manage_network_options' )
return $url;
Oh I misread it previously! sorry about that.
So I put those 2 lines within the function frontier_edit_post_link() and I get the following error.
Parse error: syntax error, unexpected ‘return’ (T_RETURN) on line 443
Plugin Author
finnj
(@finnj)
try
f ( get_post_type($post_id) === "page" && current_user_can('manage_network_options' ) )
return $url;
added )
awesome that did the trick!
The link is correctly going to backend.
Thanks a lot for your patience!
Plugin Author
finnj
(@finnj)
Hi,
I have now implemented a solution based on a setting in advanced settings.
version 3.8.6
I have tried to document the logic here: http://wpfrontier.com/frontier-post-edit-link/
Does it make sense ?