Change Spaces to Dashes?

You could simply use str_replace: str_replace( ‘ ‘, ‘-‘, $name ) In your code, this would translate to: return ‘<img src=”https://wordpress.stackexchange.com/images/flags/” . str_replace( ‘ ‘, ‘-‘, $name ) . ‘.gif” alt=”‘ . $name .'” title=”‘ . $name . ‘” class=”flag tooltip” />’;

The user can only see their own profile

Inside your template you can implement a condition checking if the user is a super admin or if the user has certain capabilities (if you want to target administrators and not only super admins) First case if (is_super_admin() ) { //your super admin logic here }else{ //subscriber logic } Second case if ( current_user_can( ‘manage_options’ … Read more

wpdb getting avatars and author url

You just need to return the user ID in the main select and use that as the author ID. Also I probably confused the issue previously by using echo with commas (separate arguments) rather than dots (one concatenated argument). $weekly = $wpdb->get_results ( ” SELECT u.ID, ( SELECT CONCAT_WS(‘.’, SUM(CASE WHEN p.post_date > ‘$date2’ THEN … Read more

Adding data to custom wordpress database table

WordPress doesn’t work this way. If you want to work with a framework like WordPress, you should obey its rules! Of course you can add a database record like this, but it is a really bad approach. Try some plugins for creating and saving forms in WordPress like Ninja Forms or Quform. You can even … Read more