Redirect after User Activation [closed]

Paste this code in your bp-custom.php file or, if you prefer, your active theme’s functions.php file: add_action( ‘bp_core_activated_user’, ‘wpse_70289_activated_user_redirect’ ); function wpse_70289_activated_user_redirect( $user_id ) { $registered_from = get_user_meta( $user_id, ‘registered_from’, true ); wp_redirect( $registered_from ); } I haven’t tested this code myself yet, but it should work just fine. References: http://codex.wordpress.org/Function_Reference/get_user_meta http://codex.wordpress.org/Function_Reference/wp_redirect

Can I hook into the invite user process to verify their email address is from a certain domain?

It is possible to hook into wpmu_validate_user_signup, which returns the $result of the sign-up process. Add another check for the email domain whitelist and add an error if not allowed. add_filter( ‘wpmu_validate_user_signup’, ‘whitelist_registration_wpse_82859’ ); function whitelist_registration_wpse_82859( $result ) { // Test array $whitelist = array( ‘gmail.com’, ‘mydomain.com’ ); // http://php.net/manual/en/function.explode.php $user_name_domain = explode( ‘@’, $result[‘user_email’] … Read more

Where to Store Custom User Fields

I know this question is very old, but I wanted to share my experience with working with large databases and storing custom user data. Basically wp_usermeta is the default and easiest option to store user meta and it works really well for smaller databases, where you might want to store a few extra fields for … Read more

Return ID of authors who have at least one post

Instead of a JOIN, you can use a IN with a subquery, to prevent duplicate results because of the join: SELECT ID, display_name FROM wp_users WHERE ID IN (SELECT post_author FROM wp_posts) This will not look at capabilities. If you also want that you can add them like a join, but move the meta_key clause … Read more

Assigning tags to user?

I think this is what you are looking for: http://codex.wordpress.org/Function_Reference/update_user_meta Here is a example of how this can be achieved: http://inchoo.net/wordpress/programatically-add-metadata-to-user-accounts-in-wordpress/

User File Upload Repository?

There are plugins that will let you do this. http://wordpress.org/extend/plugins/user-files/ http://wordpress.org/extend/plugins/wp-filebase/ Whatever you decide though keep in mind security when doing things like this. You don’t want people going crazy and uploading huge files either, so check the plugins have built in restrictions on what can be uploaded and that they are in active development.

Count user posts by type and date

The elegant way to get posts out of the database is to use wp_query. It has all the filters you need: function wpse70323_count_user_posts_by_type( $userid, $post_type, $year, $month, $day ) { $query = new WP_Query( array( ‘author’ => $userid, ‘post_type’ => $post_type, ‘date_query’ => array( array( ‘year’ => $year, ‘month’ => $month, ‘day’ => $day, ), … Read more

Search multiple meta keys at once

You’ll want to use the ‘meta_query’ argument of WP_Query ( http://codex.wordpress.org/Class_Reference/WP_Query ) Here’s a snippet that uses two separate meta key comparisons: $query_args = array( ‘post_type’ => ‘event’, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘_start_date’, ‘meta_query’ => array ( array( ‘key’ => ‘_start_date’, ‘value’ => $_start_of_month, ‘compare’ => ‘>’, ), array( ‘key’ => … Read more