choose_primary_blog [ WordPress Function ]
choose_primary_blog ( No parameters )
| Defined at: |
|
Benzer Fonksiyonlar: create_empty_blog, insert_blog, is_main_blog, the_author_login, restore_current_blog
No description yet.
Source
<?php
function choose_primary_blog() {
?>
<table class="form-table">
<tr>
<?php /* translators: My sites label */ ?>
<th scope="row"><?php _e( 'Primary Site' ); ?></th>
<td>
<?php
$all_blogs = get_blogs_of_user( get_current_user_id() );
$primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
if ( count( $all_blogs ) > 1 ) {
$found = false;
?>
<select name="primary_blog">
<?php foreach( (array) $all_blogs as $blog ) {
if ( $primary_blog == $blog->userblog_id )
$found = true;
?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
} ?>
</select>
<?php
if ( !$found ) {
$blog = array_shift( $all_blogs );
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
}
} elseif ( count( $all_blogs ) == 1 ) {
$blog = array_shift( $all_blogs );
echo $blog->domain;
if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
} else {
echo "N/A";
}
?>
</td>
</tr>
<?php if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) : ?>
<tr>
<th scope="row" colspan="2" class="th-full">
<a href="<?php echo apply_filters( 'wp_signup_location', network_home_url( 'wp-signup.php' ) ); ?>"><?php _e( 'Create a New Site' ); ?></a>
</th>
</tr>
<?php endif; ?>
</table>
<?php
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/choose primary blog « WordPress Codex
Function Reference/choose primary blog. Source File. choose_primary_blog() is located in wp-admin/includes/ms.php . See also index of Function Reference ...
codex.wordpress.org - choose_primary_blog | A HitchHackers guide through WordPress
Feb 11, 2011 ... function choose_primary_blog() { ?> <table class="form-table"> <tr> <?php /* translators: My sites label */ ?> <th scope="row"><?php _e( ...
hitchhackerguide.com - Wordpress MU < 2.7 'HOST' HTTP Header XSS Vulnerability
Mar 10, 2009 ... DESCRIPTION ------------------------- WordPress MU prior to version 2.7 fails to sanitize the Host header correctly in choose_primary_blog ...
www.exploit-db.com - [ISecAuditors Security Advisories] WordPress MU - SecurityFocus
Mar 10, 2009 ... correctly in choose_primary_blog function and is therefore prune to. XSS attacks. Web Sites running in a name based virtual hosting setup are ...
www.securityfocus.com