custom user meta query

Actually i figured it out now using join SELECT a.ID FROM wp_users a INNER JOIN wp_usermeta b ON b.user_id = a.ID AND ( ( b.meta_key = ‘firstname-groom’ AND b.meta_value LIKE ‘Darren’ ) OR ( b.meta_key = ‘firstname-bride’ AND b.meta_value LIKE ‘Someone’ ) OR ( b.meta_key = ‘lastname-bride’ AND b.meta_value LIKE ‘Cool’ ) ) INNER JOIN … Read more

WP_User_Query not searching

WP_User_Query searches the $wpdb->users table. It will not join on your custom table. How would it know what to JOIN? The possible tables names and structures are practically infinite. I believe you might be able to use a filter on pre_user_query to insert your own values in the WHERE clause but there is no JOIN … Read more

Get users with different roles and call function on each of them (user_meta)

First, always var_dump() something if you aren’t sure what exactly you got. If you ain’t got XDebug installed and configured, just use printf( ‘<pre>%s</pre>’, htmlspecialchars( var_export( $dumpMe, true ) ) ); which will bring up an equally informative response. About the WP_User_Query) IIRC it returns objects which are instances of WP_User. You can test that … Read more

Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?

In WordPress is pretty simple create custom roles and also assign specific capabilities to specific user roles (no matter if from core or custom). In my plugins I often create an user role that has all the capabilities required by my plugin, and then I attach some of thos capabilities to existing roles. I’ll give … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)