Displaying a message upon user registration

http://codex.wordpress.org/Plugin_API/Action_Reference/user_register This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. add_action(‘user_register’, ‘registration_redirect’); function registration_redirect($user_id) { $url=”PAGE_WHERE_YOUR_CODE_IS_DISPLAYED”; wp_redirect( $url ); exit; } placing that in your functions.php should work. This attempts to redirect the user … Read more

How to associate more than one user to a post?

Unless all these employees will need to login to WordPress, it may make much more sense to implement employees as a custom post type (a.k.a. CPT). Once they are defined as a CPT, you then associate wach employee with a company. As @swisspedy mentioned in his comment, one way to do this is with the … Read more

Forcing WordPress to work differently

Yeah, the multiple user under one account is not stock with WordPress. You would essentially have to reprogram a lot of stuff to get everything you are wanting, and hacking the core is a no-no, as all updates would just over-write it. So you wouldn’t be able to update it, or have a lot of … Read more

Personal page for every user (not just authors)

I guess what you’re looking for is an author template. You can create an author.php in your template folder and arrange the information in there like you want to. It will be a general template for every user then. You can access the author page if you visit example.com/author/author-slug/ To give an example: http://bookish.brokenstars.de/author/fyn/ I’m … Read more

Is a user_meta research case-sensitive or not

Solution found : to make a case-sensitive search for a meta_key / meta_value pair : a hardcoded mysql query on the usermeta table with the BINARY keyword, with get_results() method of $wpdb object: global $wpdb; $sql = $wpdb->prepare( “SELECT user_id FROM {$wpdb->prefix}usermeta WHERE meta_key = ‘unique_id’ AND BINARY meta_value=”unique_id_value””); $wordpress_user_query = $wpdb->get_results( $sql);

Auto delete WordPress users according to time

You can include this code by creating a new custom plugin which help you to stop this when you deactivate the plugin. wp_schedule_event(time(), ‘daily’, ‘my_dailyClearOut’); function my_clearOldUsers() { global $wpdb; $query = $wpdb->prepare(“SELECT ID FROM $wpdb->users WHERE datediff(now(), user_registered) > 7”); if ($oldUsers = $wpdb->get_results($query, ARRAY_N)) { foreach ($oldUsers as $user_id) { wp_delete_user($user_id[0]); } } … Read more

Getting user roles in plugin files

Figured my comment would actually make a better answer, so here we go. You can hook other methods within the plugin class onto admin_init (for the admin side) within the constructor, like so: class Plugin_Class { public function __construct() { add_action( ‘admin_init’, array( $this, ‘some_other_method’ ) ); } public function some_other_method() { // do something … Read more