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

Move `count_users` out of roles foreach #964

Merged
merged 4 commits into from Apr 4, 2018

Conversation

Projects
None yet
2 participants
@frozzare
Copy link
Contributor

commented Apr 3, 2018

This pull request will move count_users out of roles foreach since it's expensive to call for every role. See #949 for more information.

This time against develop instead of master.

@@ -817,13 +817,14 @@ public function render_field( $field ) {
// Author or Role dropdown menu
$author_or_role_values = array();
$author_or_role_selected = array();
$users = count_users();

This comment has been minimized.

Copy link
@DavidCramer

DavidCramer Apr 3, 2018

Member

@frozzare You can move this even higher up, outside the foreach of the exclude_row. Perhaps place it at the beginning of the rule_list case.

@DavidCramer
Copy link
Member

left a comment

It's all cool. If you could move that a little higher to be optimized more, then we're all good.

@frozzare

This comment has been minimized.

Copy link
Contributor Author

commented Apr 3, 2018

Done!

@@ -771,6 +771,7 @@ public function render_field( $field ) {
break;
case 'rule_list':
$users = count_users();
$form = new Form_Generator();
$output = '<p class="description">' . esc_html( $description ) . '</p>';

This comment has been minimized.

Copy link
@DavidCramer

DavidCramer Apr 3, 2018

Member

Cool. Could you please align the = so the build can pass ;)

@@ -823,7 +824,7 @@ public function render_field( $field ) {
'value' => $role_id,
'text' => $role,
);
$users = count_users();

This comment has been minimized.

Copy link
@DavidCramer

DavidCramer Apr 3, 2018

Member

Also, clear up this line ;)

@DavidCramer
Copy link
Member

left a comment

@frozzare if you can address those two formatting issues, we'll be good to go.

frozzare added some commits Apr 3, 2018

@DavidCramer DavidCramer merged commit b18c5e1 into xwp:develop Apr 4, 2018

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.