Hi there, I have the same errors – the plugin still works but errors show at the top of the admin page.
Thanks for a really useful plugin.
I’m thinking the developer may not be supporting this plugin anymore. It hasn’t been updated in over a year.
Here’s the fix. On line 18 of bp-pending-activations.php change this…
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(u.ID) FROM $wpdb->usermeta m1, $wpdb->users u WHERE u.ID = m1.user_id AND u.user_status = 2 AND m1.meta_key = 'activation_key' ORDER BY u.user_registered ASC" ) );
to this …
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(u.ID) FROM $wpdb->usermeta m1, $wpdb->users u WHERE u.ID = m1.user_id AND u.user_status = %d AND m1.meta_key = %s ORDER BY u.user_registered ASC", 2, 'activation_key' ) );
GREAT!
Thanks for this. I kept just activating and deactivating it all the time whene ever I needed it. But @baldg0at fix works great!
I still get this error in the adminsection of the plugin though:
Warning: Missing argument 2 for wpdb::prepare(), called in /home/xxx/public_html/wp-content/plugins/buddypress-pending-activations/admin/bp-pending-activations-admin.php on line 6 and defined in /home/xxx/public_html/wp-includes/wp-db.php on line 990
Any ideas on a fix for that?
I attempted to add this code, yet it broke our site. I reverted back to the original code and everything works fine. I am with you that the original author of this code is no longer involved and updated the plugin. the original plugin code works fine for our site.
Thanks for your input. It would be great is someone were to take over this plugin or create a new one. For now, this plugin works for our site.
Best,
Wayne
Thread Starter
Sal
(@salvig67)
@baldg0at
That Fix is Right on the Money!! I updated the code on Cyborgmusic.com and it is perfect thanks you are the Awesome!!! Big Time.
You are my new best friend. Going to friend you and send you a contact info so we can keep in contact.
You are a code guru bro!
Thanks Sal
Thread Starter
Sal
(@salvig67)
@wrowlands
You did something wrong Mr. wrowlands!!
I updated my site and it is perfect!!
Right on the money baldg0at!!
Thanks Big Time!
Thread Starter
Sal
(@salvig67)
@baldg0at
I build themes and sites.
Not as much of a guru as you bro!
But I know my way around code and would like to add you as a friend.
look me up at https://salsclub.com Thanks and reference this bro thanks
You’re right, @bennygill.
Looks like this is the fix —
on line 6 of /admin/bp-pending-activations-admin.php change this…
return $wpdb->get_results( $wpdb->prepare( "SELECT u.*, m1.meta_value as activation_key FROM $wpdb->usermeta m1, $wpdb->users u WHERE u.ID = m1.user_id AND u.user_status = 2 AND m1.meta_key = 'activation_key' ORDER BY u.user_registered ASC" ) );
to this…
return $wpdb->get_results( $wpdb->prepare( "SELECT u.*, m1.meta_value as activation_key FROM $wpdb->usermeta m1, $wpdb->users u WHERE u.ID = m1.user_id AND u.user_status = %d AND m1.meta_key = %s ORDER BY u.user_registered ASC", 2, 'activation_key' ) );
hmmm…
Now I get this error when I select a bunch of people and click resend activation key.
Warning: Missing argument 2 for wpdb::prepare(), called in /home/thecashl/public_html/wp-content/plugins/buddypress-pending-activations/admin/bp-pending-activations-admin.php on line 63 and defined in /home/thecashl/public_html/wp-includes/wp-db.php on line 990
Eesh… I’ll take a look.
I may contact the developer and see if he’ll let me take over ownership of the plugin.
For those who want to understand why the “Missing Argument” error appears, see this post from a core developer.
In a nutshell, any plugin/theme developers who write code using $wpdb->prepare() but only pass one argument are “doing it wrong”, as core developers like to say.
The developer let me take over development.
I believe I have all the errors fixed.