Plugin Directory

Changeset 1847158


Ignore:
Timestamp:
03/26/2018 05:15:04 PM (8 years ago)
Author:
asergeev34
Message:

v 1.0.1

Location:
mif-wp-customizer/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mif-wp-customizer/trunk/inc/admin-settings-page.php

    r1808031 r1847158  
    131131    function update_mif_wpc_options()
    132132    {
    133         if ( ! $_POST['update-mif-wpc-settings'] ) return;
     133        if ( empty( $_POST['update-mif-wpc-settings'] ) ) return;
    134134        if ( ! wp_verify_nonce( $_POST['_wpnonce'], "mif-wpc-admin-settings-page-nonce" ) ) return '<div class="err">' . __( 'Authorization error', 'mif-wpc' ) . '</div>';
    135135
  • mif-wp-customizer/trunk/inc/join-to-multisite.php

    r1808031 r1847158  
    156156    if ( $args['join-to-multisite-mode'] == 'none' ) return;
    157157
    158     $role = $args['join-to-multisite-default-role'];
    159 
    160     if ( $_POST['action'] == 'join' ) add_user_to_blog( $blog_id, $current_user->ID, $role );
    161     if ( $_POST['action'] == 'unjoin' ) remove_user_from_blog( $current_user->ID, $blog_id );
     158    $meta_key = '_members_role_' . $blog_id;
     159   
     160    if ( $_POST['action'] == 'join' ) {
     161       
     162        $role = $args['join-to-multisite-default-role'];
     163
     164        $old_role = get_user_meta( $current_user->ID, $meta_key, true );
     165
     166        if ( $old_role ) {
     167
     168            $role = $old_role;
     169            delete_user_meta( $current_user->ID, $meta_key );
     170
     171        }
     172
     173        add_user_to_blog( $blog_id, $current_user->ID, $role );
     174
     175    }
     176
     177    if ( $_POST['action'] == 'unjoin' ) {
     178
     179        $user = get_userdata( $current_user->ID );
     180        $roles = array_intersect( array_values( $user->roles ), array_keys( wp_roles()->roles ) );
     181        $role  = reset( $roles );
     182       
     183        if ( ! empty( $role ) ) update_user_meta( $current_user->ID, $meta_key, $role );
     184
     185        remove_user_from_blog( $current_user->ID, $blog_id );
     186
     187    }
    162188   
    163189}
     
    178204    global $current_user, $blog_id;
    179205    if ( ! $current_user ) return;
     206    if ( is_user_member_of_blog() ) return;
    180207
    181208    $args = get_mif_wpc_options();
    182209
    183210    if ( $args['join-to-multisite-mode'] != 'automatic' ) return;
     211
     212    $userdata = get_userdata( $current_user->ID );
    184213
    185214    $role = $args['join-to-multisite-default-role'];
  • mif-wp-customizer/trunk/readme-ru.txt

    r1808031 r1847158  
    22Tags: multisite, member, login, adminbar, redirect, social network, buddypress
    33Requires at least: 4.8
    4 Tested up to: 4.9.1
    5 Stable tag: 1.0.0
     4Tested up to: 4.9.4
     5Stable tag: 1.0.1
    66License: GPLv2 or later
    77License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    4848== Changelog ==
    4949
     50= 1.0.1 =
     51
     52* "Стать участником сайта" - запоминает роль если покинуть сайт, а потом снова стать его участником
     53* исправлена ошибка в join to multisite (automatic)
     54* исправлена ошибка на странице настройки плагина
     55
    5056= 1.0.0 =
    5157
    5258* первая публичная версия плагина
    5359
     60
  • mif-wp-customizer/trunk/readme.txt

    r1819078 r1847158  
    22Tags: multisite, member, login, adminbar, redirect, social network, buddypress
    33Requires at least: 4.8
    4 Tested up to: 4.9.1
    5 Stable tag: 1.0.0
     4Tested up to: 4.9.4
     5Stable tag: 1.0.1
    66License: GPLv2 or later
    77License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1515Allows to implement:
    1616
    17 1) placing of user login and logout tools in menu areas and widgets' areas of stand-alone sites of social network;
     171) placing of user login and logout tools in menu areas and widgets' areas of
     18    stand-alone sites of social network;
    1819
    19 2) functioning of subscription tools for updates of stand-alone sites by members of social network;
     202) functioning of subscription tools for updates of stand-alone sites by
     21    members of social network;
    2022
    21 3) improving of management and site navigation tools (toolbar management, page scrolling, page redirection).
     233) improving of management and site navigation tools (toolbar management,
     24   page scrolling, page redirection).
    2225
    23 It is oriented on work in Wordpress Multisite mode with social networking plugin BuddyPress. It can be used in regular WordPress installations for solving individual tasks.
     26It is oriented on work in Wordpress Multisite mode with social networking plugin
     27BuddyPress. It can be used in regular WordPress installations for solving individual
     28tasks.
    2429
    2530== Installation ==
     
    4348== Changelog ==
    4449
     50= 1.0.1 =
     51
     52* "Become a member of the site" - remembers the role if you leave the site, and then again become a member
     53* fix join to multisite (automatic)
     54* settings page fix
     55
    4556= 1.0.0 =
    4657
    4758* first public plugin version
    48 
Note: See TracChangeset for help on using the changeset viewer.