Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Custom admin menus #5757

Closed
wants to merge 3 commits into from
Closed

Sync Custom admin menus #5757

wants to merge 3 commits into from

Conversation

artpi
Copy link
Contributor

@artpi artpi commented Nov 25, 2016

Why?

One of the problems with Calypso for Jetpack users is that users not only don't have custom functionality from plugins / themes, but they also don't have any link nor indication about this custom functionality.

This can be especially annoying for AT customers.

Solution

  • Call 'admin_menu'
  • Capture custom items
  • Sync

API

WPCOM part of this: D3506-code

screen shot 2016-11-25 at 21 08 57 pm

Calypso side

Calypso side of this needs some thinking. In the above example submenus for edit.php?post_type=event need to hook into Menu items created by Custom Post Type event, hence pinging @aduth.

CC @enej

@artpi artpi self-assigned this Nov 25, 2016
@artpi artpi changed the title Sync Custom Menus Sync Custom admin menus Nov 25, 2016
@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Status] In Progress labels Nov 27, 2016
@jeherve jeherve modified the milestones: Community, 4.5 Nov 27, 2016
wp_set_current_user( Jetpack_Options::get_option( 'master_user' ) );
/** add_menu_page and add_submenu_page hook into admin_menu. Documented in wp-admin/includes/menu.php */
do_action( 'admin_menu', '' );
/** Lets clean up user switch */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't these docblock comments with the double leading *s? also, I thought we preferred // line comments in code to prevent nesting errors with block comments

@enejb
Copy link
Member

enejb commented Dec 12, 2016

We need to add some test to this. Since the menus only appear on the admin side. I think it should only ever sync this option when we are on the admin side and not though things like cron. Since plugins could be adding the actions and filters only on the admin side and so when we sync this value though cron of the front end the value would not be the same as expected.

I also think it is reasonable to assume that we should try to update the menus value when a new plugin is installed.

@@ -176,6 +176,26 @@ public static function get_plugins() {
return apply_filters( 'all_plugins', get_plugins() );
}

/**
* Returns items inserted to wp-admin admin page menu by custom plugins and themes.
* They usually do that bu hooking in admin_menu and calling add_menu_page and add_submenu_page.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bu -> by

@eliorivero eliorivero added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Dec 13, 2016
@dereksmart dereksmart modified the milestones: Not Currently Planned, 4.5 Dec 20, 2016
@samhotchkiss
Copy link
Contributor

Hey @artpi @lezama @enejb -- is this being actively worked on? What needs to happen to get it merged?

@artpi
Copy link
Contributor Author

artpi commented Feb 7, 2017

@samhotchkiss : No, it is not worked on at all since I have not coerced anyone to agree on business decision on this.

That is my private expectation that once we enable AT we will get a flood of "I installed a plugin and now cant get to it" questions.
We don't heve a consensus yet If we want to pursue the route I have outlined here.
I think we can continue in thes shape - it just syncs data. Later we can decide if we want this to show items on calypso side.

What needs to happen to get it merged?

Someone has to say "We want this in Jetpack" and I don't want to force stuff in Jetpack that should not be there

@samhotchkiss
Copy link
Contributor

Alright, @artpi -- I'm going to go ahead and close for now, let's reopen as we get closer on AT and want/need to flesh out this sort of solution

@samhotchkiss samhotchkiss removed the [Status] Needs Review This PR is ready for review. label Feb 8, 2017
@jeherve jeherve deleted the new/custom-admin-menus branch February 8, 2017 20:04
@jeherve jeherve restored the new/custom-admin-menus branch February 8, 2017 20:05
@dereksmart dereksmart deleted the new/custom-admin-menus branch May 31, 2017 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Sync [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants