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

Ensure the "Let's get started" link appears #23

Merged
merged 2 commits into from
Aug 27, 2020

Conversation

kienstra
Copy link
Contributor

@kienstra kienstra commented Aug 27, 2020

Changes

  • Creates a custom method to output the "Let's get started" link

Background

Before, edit_post_link() didn't echo anything because in get_edit_post_link(),
current_user_can( 'edit_post', $post->ID ) was false.

I don't know why it was false.

Testing instructions

In my local, the only way I could reproduce it was creating a new WP instance, and this issue only appeared the first time I activated GCB.

  1. Comment out this line or delete all of your GCB blocks
  2. Deactivate GCB
  3. Activate GCB
  4. Expected: The "Let's get started" link should appear:

link-should-now-appear

Fixes getblocklab/block-lab#509

Before, edit_post_link() didn't echo
anything because in
get_edit_post_link(),
current_user_can( 'edit_post', ->ID )
was false.
But this only seemed to happen the very
first time the plugin was activated in WP.
@kienstra
Copy link
Contributor Author

kienstra commented Aug 27, 2020

Hi @lukecarbis,
Could you please review this when you have a chance?

Thanks, Luke!

@kienstra
Copy link
Contributor Author

kienstra commented Aug 27, 2020

Ah, I just remembered that GCB Pro doesn't have onboarding. It's on an activation hook in the free plugin, and that of course never gets activated when it's included with Composer.

Copy link
Contributor

@lukecarbis lukecarbis left a comment

Choose a reason for hiding this comment

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

Looks and works great! Thanks. 👍

@lukecarbis
Copy link
Contributor

Also, you should update WordPress to 5.5. ;)

@kienstra
Copy link
Contributor Author

Thanks! I'll work on getting onboarding working in the Pro plugin.

@kienstra
Copy link
Contributor Author

Haha, yeah 😄

@lukecarbis
Copy link
Contributor

Great pickup (on the GCB Pro onboarding).

@lukecarbis
Copy link
Contributor

lukecarbis commented Aug 27, 2020

@kienstra One option is to just duplicate this snippet in the free plugin but change the activation hook $file param to the Pro filename:

register_activation_hook(
$this->get_file(),
function() {
$onboarding = new Onboarding();
$onboarding->plugin_activation();
}
);

I'm pretty confident keeping that in the free version would be allowed.

@kienstra
Copy link
Contributor Author

Good idea, that should be all that's needed.

@kienstra kienstra merged commit 7b75647 into develop Aug 27, 2020
@kienstra kienstra deleted the fix/lets-get-started-link branch August 27, 2020 23:00
kienstra added a commit that referenced this pull request Oct 18, 2020
The same issue that caused
the submenus to not display
also caused the link
to not display.
Now that the capability is added
earlier, this works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QA: Yes, I do "Want to see how it's done"
2 participants