Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




maybe_add_existing_user_to_blog [ WordPress Function ]

maybe_add_existing_user_to_blog ( No parameters )
Uses:
Defined at:



Add a new user to a blog by visiting /newbloguser/username/.

This will only work when the user's details are saved as an option keyed as 'new_user_x', where 'x' is the username of the user to be added, as when a user is invited through the regular WP Add User interface.

Source


<?php
function maybe_add_existing_user_to_blog() {
    if ( 
false === strpos$_SERVER'REQUEST_URI' ], '/newbloguser/' ) )
        return 
false;

    
$parts explode'/'$_SERVER'REQUEST_URI' ] );
    
$key array_pop$parts );

    if ( 
$key == '' )
        
$key array_pop$parts );

    
$details get_option'new_user_' $key );
    if ( !empty( 
$details ) )
        
delete_option'new_user_' $key );

    if ( empty( 
$details ) || is_wp_erroradd_existing_user_to_blog$details ) ) )
        
wp_diesprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );

    
wp_diesprintf(__('You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.'), home_url(), admin_url() ), __('Success') );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics