How to handle dates, trying to calculate time since a post

You don’t need to know the user’s timezone, because time since the post was published is independent of timezone. WordPress sets your timezone to UTC so that internally, all dates are dealt with the same and consistent timezone. You should avoid using php functions, and instead use the WordPress provided functions. Incidently, human_time_diff() does exactly … Read more

Echo text if field under user_meta is empty with get_users()

When you have that much code to output concatenating it into one string like that makes it very difficult to read for others and yourself, also, to debug when things go wrong. Try this method for concatenating your output, $blogusers = get_users(‘role=contributor&orderby=display_name’); foreach ($blogusers as $user) { $name = $user->display_name; $url = get_author_posts_url($user->ID, $author_nicename); $class … Read more

Using and saving custom dropdown boxes on user profiles

You appear to be checking for variables that aren’t set. You set $selected $selected = get_the_author_meta( ‘user_top’, $user->ID ); But then you check for something called $topselected <select name=”user_top” id=”user_top”> <option value=”gotguns” <?php echo ($topselected == “gotguns”)? ‘selected=”selected”‘ : ” ?>>I got guns</option> The same thing happns with $middleselected and $bottomselected I think your problem … Read more

Convert usernames listed by the Groups plugin shortcode to displayed names?

Bellow is the adapted function (by 24 rows shorter than the original), as was suggested by the commenters (many thanks!). It will work only if the Groups plugin was installed and activated. add_shortcode( ‘groups_group_info’, ‘groups_group_info’ ); function groups_group_info( $atts, $content = null ) { global $wpdb; $output = “”; $options = shortcode_atts( array( ‘group’ => … Read more

WordPress multi user registration sites

References I found several plugins and solutions for this. The most promising seemed to be MultiUser Management Plugin. Here’s a short and untested rip off from this plugin, as there’re easier ways to get the available/registered blogs and normally you won’t need their public API functions. Also I think that some stuff they use is … Read more

get USER ID in functions.php using user_register action

You are giving $wpdb->get_results a string for its second parameter. It should be a constant– ARRAY_N— meaning you need to remove the quotes $getunion = $wpdb->get_results( “SELECT value from wp_bp_xprofile_data where user_id = $getid AND field_id = 4”, ARRAY_N ); Since you claim it works in the second instance, I am assuming $wpdb compensates, but … Read more

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