can you paste the full code, of whatever template that snippet belongs to, into a http://pastebin.com/ and post the link to it here?
per se, the posted code is too short and taken out of context.
in general, http://php.net/manual/en/control-structures.elseif.php
function in if…else clause is okey ! but in detail ?
Thanks for your response. Here is more context:
$user_id = $curauth->ID;
$title = $curauth->display_name;
$domain = network_home_url();
$path = $curauth->user_login;
$key = 'primary_blog';
$single = true;
$primary_blog = get_user_meta( $user_id, $key, $single);
if ($primary_blog == "") {
wpmu_create_blog($domain, $path, $title, $user_id);
} else if (user_can_for_blog($user_id, $primary_blog, edit_posts )) {
echo '<p>Member has site</p>';
}
I know the general if else structure, but examples always use echo or ‘some code to execute’. I can’t find any examples with functions with variables.
I have tried ‘return wpmu_create_blog(…’ and other variations. Nothing works. And maybe this is a WP specific thing?
Can anyone give a general answer to this?
I can’t get any function within if/else to work, even when I try something basic like this:
if(...) {
wp_redirect( home_url() );
exit;
} else {
...
}
I keep getting server/syntax errors – unexpected T_STRING etc. Shouldn’t this just work?