Skip Navigation

[Resolved] Show pending users in VIEW results

This support ticket is created 4 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 11 replies, has 2 voices.

Last updated by leilaG 4 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#1577703

Hi, is it possible to show pending users in VIEW results?

#1578153

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

What do you mean by pending users?

It's not something from WordPress core.

I assume you mean something different than users with a custom role of 'pending'?

#1578449

Hi Nigel, We use gravity forms for new user registrations and these users are in the pending user role until they activate their accounts.

#1578453

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2020-04-08 at 13.07.22.png

When you create a User View you specify the roles of the users the View will display in the first section (screenshot).

Does the "pending" role not appear there?

If not, then maybe that's not how it is implemented in Gravity Forms.

We'd need more details about the settings for such users to be able to say any more.

#1585645

Hi Nigel, no it doesn't show, so I'm guessing this would be a compatibility issue?

#1586275

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

We'd need some details about how it's implemented to understand why.

Users are not like posts, where posts can have a draft status, for example, or individual post types can be registered so as to not be publicly queryable or searchable (essentially private).

If a user exists with some role then it should be possible to query those users (using the WordPress function get_users() or the underlying class WP_User_Query) based on their role.

Maybe the "pending" users are implemented some other way, not actually using roles?

Can you find documentation about these details or further information from Gravity support?

#1592339

Okay we'll get intouch with gravity forms to see how this is set up. thanks

#1592549

From Gravity forms support team:

"Gravity Forms uses the WordPress core system for user registration, therefore pending users are stored the same way that WordPress does by default. Basically, rows in the WordPress core table wp_signups with a value of 0 for the "active" column are pending users."

#1592751

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The table "wp_signups" only occurs on multisite installations, it's not part of standalone WordPress sites.

I just registered a new test user using WordPress's own registration page and didn't activate the user, i.e. it is pending activation by following the link in the registration email to set up a password, that's as close as core WordPress has to a "pending" user.

The user gets added to the wp_users table (which is a core WP table), and is effectively identified as pending by the presence of a user_activation_key value.

If I create a View to display users with any role it will include this "pending" user in the results.

So, when adding users natively to standalone sites you can display them with a View.

Are you using multisite?

I would have to set up a multisite network to verify what happens in that case.

But a View to display users will only return users included in the wp_users table, so if users created with your GF registration form do not appear in the output of a user View that indicates GF is not populating the wp_users table with the pending users.

If you are still in contact with their support you could explicitly ask how to retrieve such pending users using the standard WP_User_Query class (https://developer.wordpress.org/reference/classes/wp_user_query/), ask for an example.

If it is not possible, then it will be impossible to create a user View to display such users.

If it is possible, it may be possible to modify the Views query to match what is required.

#1594109

Hi Nigel,

No we are not using a Multisite.

We asked Gravity forms for the example, this was their reply:

The WP_User_Query class does not support querying the signups table, in fact WordPress core does not include an API for it, they use custom queries in the few places they use it.

In the User Registration add-on we had to create our own custom queries to interact with that table. Check the get_pending_activations function in the plugins/gravityformsuserregistration/includes/class-gf-pending-activations.php file.

#1594653

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

OK, thanks for the details.

In which case, returning to your original question: is it possible to show pending users in VIEW results?

The answer is no, because a View to display users queries the wp_users table to find the users (based upon the standard WP_User_Query class). There is no way for such a query to return users stored somewhere else, because they are not in fact users, they are something else.

I was trying to think of a way to use the Views API to modify the query using the GF function their support directed you to, but it cannot work because the "users" are not users. I'm afraid in this case you will need an entirely bespoke solution. Perhaps Gravity Forms could help you with a custom shortcode to output such "users".

#1594807

Okay that makes sense, thanks for looking into that, we'll look for a different solution.