当前位置: 首页>>代码示例>>PHP>>正文


PHP is_user_member_of_blog函数代码示例

本文整理汇总了PHP中is_user_member_of_blog函数的典型用法代码示例。如果您正苦于以下问题:PHP is_user_member_of_blog函数的具体用法?PHP is_user_member_of_blog怎么用?PHP is_user_member_of_blog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_user_member_of_blog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct(site_url('pnfw/unregister/'), 'POST');
     global $wpdb;
     $push_tokens = $wpdb->get_blog_prefix() . 'push_tokens';
     $user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM {$push_tokens} WHERE token = %s AND os = %s", $this->token, $this->os));
     $res = $wpdb->delete($push_tokens, array("token" => $this->token, "os" => $this->os));
     if ($res === false) {
         $this->json_error('500', __('Unable to delete token', 'pnfw'));
     }
     $user = new WP_User($user_id);
     if (in_array(PNFW_Push_Notifications_for_WordPress_Lite::USER_ROLE, $user->roles) && empty($user->user_email)) {
         pnfw_log(PNFW_SYSTEM_LOG, sprintf(__("Automatically deleted the anonymous user %s (%s) since left without tokens.", 'pnfw'), $user->user_login, $user_id));
         require_once ABSPATH . 'wp-admin/includes/user.php';
         if (is_multisite()) {
             require_once ABSPATH . 'wp-admin/includes/ms.php';
             if (is_user_member_of_blog($user_id)) {
                 wpmu_delete_user($user_id);
             }
         } else {
             wp_delete_user($user_id);
         }
     }
     exit;
 }
开发者ID:benediktharter,项目名称:push-notifications-for-wp,代码行数:25,代码来源:class-pnfw-api-unregister.php

示例2: wp_user_edit_map_meta_caps

/**
 * Override multisite mapped meta-capabilities
 *
 * @since 0.1.0
 */
function wp_user_edit_map_meta_caps($caps = array(), $cap = '', $user_id = 0, $args = array())
{
    // What cap are we checking
    switch ($cap) {
        // Ability to edit users of sites
        case 'edit_user':
        case 'edit_users':
        case 'manage_network_users':
            // Allow user to edit themselves
            if ('edit_user' === $cap && isset($args[0]) && $user_id === $args[0]) {
                break;
            }
            // Already not allowed?
            $index = array_search('do_not_allow', $caps);
            // If previously not allowed, undo it; we'll check our own way
            if (false !== $index) {
                unset($caps[$index]);
            }
            // If multisite, user must be a member of the site
            if (is_multisite() && isset($args[0]) && !is_user_member_of_blog($args[0])) {
                $caps[] = 'do_not_allow';
                // Admins cannot modify super admins
            } elseif (isset($args[0]) && is_super_admin($args[0])) {
                $caps[] = 'do_not_allow';
                // Fallback on `edit_users`
            } else {
                $caps[] = 'edit_users';
            }
            break;
    }
    // Always return capabilities
    return $caps;
}
开发者ID:stuttter,项目名称:wp-user-edit,代码行数:38,代码来源:wp-user-edit.php

示例3: callback

 function callback($path = '', $blog_id = 0, $user_id = 0)
 {
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     if (!current_user_can_for_blog($blog_id, 'list_users')) {
         return new WP_Error('unauthorized', 'User cannot view users for specified site', 403);
     }
     // Get the user by ID or login
     $get_by = false !== strpos($path, '/users/login:') ? 'login' : 'id';
     $user = get_user_by($get_by, $user_id);
     if (!$user) {
         return new WP_Error('unknown_user', 'Unknown user', 404);
     }
     if (!is_user_member_of_blog($user->ID, $blog_id)) {
         return new WP_Error('unknown_user_for_site', 'Unknown user for site', 404);
     }
     if ('GET' === $this->api->method) {
         return $this->get_user($user->ID);
     } else {
         if ('POST' === $this->api->method) {
             if (!current_user_can_for_blog($blog_id, 'promote_users')) {
                 return new WP_Error('unauthorized', 'User cannot promote users for specified site', 403);
             }
             if (get_current_user_id() == $user_id) {
                 return new WP_Error('unauthorized', 'You cannot change your own role', 403);
             }
             return $this->update_user($user_id);
         } else {
             return new WP_Error('bad_request', 'An unsupported request method was used.');
         }
     }
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:34,代码来源:class.wpcom-json-api-site-user-endpoint.php

示例4: load_strings

 /**
 Load all our strings
 */
 function load_strings()
 {
     $this->please_log_in = "<p class=\"s2_message\">" . sprintf(__('To manage your subscription options please <a href="%1$s">login.</a>', 'subscribe2'), get_option('siteurl') . '/wp-login.php') . "</p>";
     $this->profile = "<p class=\"s2_message\">" . sprintf(__('You may manage your subscription options from your <a href="%1$s">profile</a>', 'subscribe2'), get_option('siteurl') . "/wp-admin/admin.php?page=s2") . "</p>";
     if ($this->s2_mu === true) {
         global $blog_id;
         $user_ID = get_current_user_id();
         if (!is_user_member_of_blog($user_ID, $blog_id)) {
             // if we are on multisite and the user is not a member of this blog change the link
             $this->profile = "<p class=\"s2_message\">" . sprintf(__('<a href="%1$s">Subscribe</a> to email notifications when this blog posts new content.', 'subscribe2'), get_option('siteurl') . "/wp-admin/?s2mu_subscribe=" . $blog_id) . "</p>";
         }
     }
     $this->confirmation_sent = "<p class=\"s2_message\">" . __('A confirmation message is on its way!', 'subscribe2') . "</p>";
     $this->already_subscribed = "<p class=\"s2_error\">" . __('That email address is already subscribed.', 'subscribe2') . "</p>";
     $this->not_subscribed = "<p class=\"s2_error\">" . __('That email address is not subscribed.', 'subscribe2') . "</p>";
     $this->not_an_email = "<p class=\"s2_error\">" . __('Sorry, but that does not look like an email address to me.', 'subscribe2') . "</p>";
     $this->barred_domain = "<p class=\"s2_error\">" . __('Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2') . "</p>";
     $this->error = "<p class=\"s2_error\">" . __('Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2') . "</p>";
     // confirmation messages
     $this->no_such_email = "<p class=\"s2_error\">" . __('No such email address is registered.', 'subscribe2') . "</p>";
     $this->added = "<p class=\"s2_message\">" . __('You have successfully subscribed!', 'subscribe2') . "</p>";
     $this->deleted = "<p class=\"s2_message\">" . __('You have successfully unsubscribed.', 'subscribe2') . "</p>";
     /**/
     $this->subscribe = __('subscribe', 'subscribe2');
     //ACTION replacement in subscribing confirmation email
     /**/
     $this->unsubscribe = __('unsubscribe', 'subscribe2');
     //ACTION replacement in unsubscribing in confirmation email
 }
开发者ID:pakistanigeek,项目名称:subscribe2,代码行数:32,代码来源:class-s2-frontend.php

示例5: callback

 function callback($path = '', $blog_id = 0, $user_id = 0)
 {
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     if (!current_user_can_for_blog($blog_id, 'list_users')) {
         return new WP_Error('unauthorized', 'User cannot view users for specified site', 403);
     }
     if (!is_user_member_of_blog($user_id, $blog_id)) {
         return new WP_Error('unauthorized', 'User cannot view users for specified site', 403);
     }
     if ('GET' === $this->api->method) {
         return $this->get_user($user_id);
     } else {
         if ('POST' === $this->api->method) {
             if (!current_user_can_for_blog($blog_id, 'promote_users')) {
                 return new WP_Error('unauthorized', 'User cannot promote users for specified site', 403);
             }
             if (get_current_user_id() == $user_id) {
                 return new WP_Error('unauthorized', 'You cannot change your own role', 403);
             }
             return $this->update_user($user_id);
         } else {
             return new WP_Error('bad_request', 'An unsupported request method was used.');
         }
     }
 }
开发者ID:popthestack,项目名称:jetpack,代码行数:28,代码来源:class.wpcom-json-api-site-user-endpoint.php

示例6: get_item_permissions_check

 /**
  * Check whether a given request has proper authorization to view feedback item.
  *
  * @param  WP_REST_Request $request Full details about the request.
  * @return WP_Error|boolean
  */
 public function get_item_permissions_check($request)
 {
     if (!is_user_member_of_blog(get_current_user_id(), get_current_blog_id())) {
         return new WP_Error('rest_cannot_view', esc_html__('Sorry, you cannot view this resource.', 'jetpack'), array('status' => 401));
     }
     return true;
 }
开发者ID:automattic,项目名称:jetpack,代码行数:13,代码来源:class-grunion-contact-form-endpoint.php

示例7: get_jetpack_modules

 function get_jetpack_modules()
 {
     if (is_user_member_of_blog()) {
         return array_values(Jetpack_Options::get_option('active_modules', array()));
     }
     return null;
 }
开发者ID:jrodd32,项目名称:mwux16,代码行数:7,代码来源:class.json-api-site-jetpack-base.php

示例8: jmm_shortcode_thissite_func

function jmm_shortcode_thissite_func($atts, $content = null)
{
    $jmm_options = get_option('helfjmm_options');
    if (isset($_POST['jmm-join-site']) || isset($_POST['join-site'])) {
        // This is the magic sauce.
        do_action('jmm_joinsite', array('JMM', 'join_site'));
    }
    if (!is_user_logged_in()) {
        if (get_option('users_can_register') == 1) {
            // If user isn't logged in but we allow for registration....
            // IF we have a custom URL, use it, else send to /wp-signup.php
            if (!is_null($jmm_options['perpage']) && $jmm_options['perpage'] != "XXXXXX") {
                $goto = get_permalink($jmm_options['perpage']);
            } else {
                $goto = '/wp-signup.php';
            }
            // Here is our form
            return '<form action="' . $goto . '" method="post" id="notmember">
			<input type="hidden" name="action" value="jmm-join-site">
			<input type="submit" value="' . __('Register For An Account', 'join-my-multisite') . '" name="join-site" id="join-site" class="button">
			</form>';
        }
        // If we don't allow registration, we show nothing. On to the next one!
    } elseif (!is_user_member_of_blog()) {
        // If user IS logged in, then let's invite them to play.
        return '<form action="?jmm-join-site" method="post" id="notmember">
        <input type="hidden" name="action" value="jmm-join-site">
        <input type="submit" value="' . __('Join This Site', 'join-my-multisite') . '" name="join-site" id="join-site" class="button">
        </form>';
    } else {
        // Otherwise we're already a member, hello, mum!
        return '<p>' . __('Howdy, Member!', 'join-my-multisite') . '</p>';
    }
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:34,代码来源:shortcode.php

示例9: display_admin

 /**
  * Displays the to-do list administration
  * @param $atts shortcode attributes
  * @return string To-Do List
  */
 public function display_admin($atts)
 {
     $this->atts = $atts;
     $atts = shortcode_atts(array('title' => '', 'completed' => 0), $this->atts, 'todoadmin');
     $this->list = '';
     CTDL_Loader::frontend_admin_enqueue_scripts();
     $this->list = '<div id="ctdl-frontend-admin">';
     if ($atts['title'] != '') {
         $this->list .= '<h3 class="todo-title">' . esc_html($atts['title']) . $this->show_heading() . '</h3>';
     }
     if (is_user_logged_in() && is_user_member_of_blog()) {
         list($this->url, $action) = CTDL_Lib::set_variables();
         // get the existing to-do data and show the edit form if editing a to-do item
         if ($action == 'edit-todo') {
             $this->edit_todo_item($this->url);
         } else {
             $this->list .= '<div class="ctdl-tables">';
             $this->display();
             if (1 == $atts['completed']) {
                 $this->display(1);
             }
             $this->list .= '</div>';
             $this->list .= $this->create_new_todo_form();
         }
     } else {
         $this->list .= esc_html__('You must be logged in to view', 'cleverness-to-do-list');
     }
     $this->list .= '</div>';
     return $this->list;
 }
开发者ID:abenamer,项目名称:thereveal,代码行数:35,代码来源:cleverness-to-do-list-frontend.class.php

示例10: load_strings

 /**
 Load all our strings
 */
 function load_strings()
 {
     // adjust the output of Subscribe2 here
     $this->please_log_in = "<p class=\"s2_message\">" . __('To manage your subscription options please', 'subscribe2') . " <a href=\"" . get_option('siteurl') . "/wp-login.php\">" . __('login', 'subscribe2') . "</a>.</p>";
     $this->profile = "<p class=\"s2_message\">" . __('You may manage your subscription options from your', 'subscribe2') . " <a href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=s2\">" . __('profile', 'subscribe2') . "</a>.</p>";
     if ($this->s2_mu === true) {
         global $blog_id;
         $user_ID = get_current_user_id();
         if (!is_user_member_of_blog($user_ID, $blog_id)) {
             // if we are on multisite and the user is not a member of this blog change the link
             $this->profile = "<p class=\"s2_message\"><a href=\"" . get_option('siteurl') . "/wp-admin/?s2mu_subscribe=" . $blog_id . "\">" . __('Subscribe', 'subscribe2') . "</a> " . __('to email notifications when this blog posts new content', 'subscribe2') . ".</p>";
         }
     }
     $this->confirmation_sent = "<p class=\"s2_message\">" . __('A confirmation message is on its way!', 'subscribe2') . "</p>";
     $this->already_subscribed = "<p class=\"s2_error\">" . __('That email address is already subscribed.', 'subscribe2') . "</p>";
     $this->not_subscribed = "<p class=\"s2_error\">" . __('That email address is not subscribed.', 'subscribe2') . "</p>";
     $this->not_an_email = "<p class=\"s2_error\">" . __('Sorry, but that does not look like an email address to me.', 'subscribe2') . "</p>";
     $this->barred_domain = "<p class=\"s2_error\">" . __('Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2') . "</p>";
     $this->error = "<p class=\"s2_error\">" . __('Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2') . "</p>";
     $this->no_page = __('You must to create a WordPress page for this plugin to work correctly.', 'subscribe2');
     $this->mail_sent = "<p class=\"s2_message\">" . __('Message sent!', 'subscribe2') . "</p>";
     $this->mail_failed = "<p class=\"s2_error\">" . __('Message failed! Check your settings and check with your hosting provider', 'subscribe2') . "</p>";
     // confirmation messages
     $this->no_such_email = "<p class=\"s2_error\">" . __('No such email address is registered.', 'subscribe2') . "</p>";
     $this->added = "<p class=\"s2_message\">" . __('You have successfully subscribed!', 'subscribe2') . "</p>";
     $this->deleted = "<p class=\"s2_message\">" . __('You have successfully unsubscribed.', 'subscribe2') . "</p>";
     $this->subscribe = __('subscribe', 'subscribe2');
     //ACTION replacement in subscribing confirmation email
     $this->unsubscribe = __('unsubscribe', 'subscribe2');
     //ACTION replacement in unsubscribing in confirmation email
     // menu strings
     $this->options_saved = __('Options saved!', 'subscribe2');
     $this->options_reset = __('Options reset!', 'subscribe2');
 }
开发者ID:par-orillonsoft,项目名称:elearning-wordpress,代码行数:37,代码来源:class-s2-core.php

示例11: widget

 function widget($args, $instance)
 {
     extract($args);
     /* User-selected settings. */
     //$title =  isset( $instance['title'] ) ? apply_filters('widget_title', $instance['title'] ) : "" ;
     $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : "";
     $notregistered = isset($instance['notreg']) ? $instance['notreg'] : "";
     $notmember = isset($instance['notmember']) ? $instance['notmember'] : "";
     $member = isset($instance['member']) ? $instance['member'] : "";
     $welcome = isset($instance['welcome']) ? $instance['welcome'] : "";
     $show_form = isset($instance['show_form']) ? $instance['show_form'] : "";
     $jmm_options = get_option('helfjmm_options');
     global $current_user, $blog_id, $user_login;
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     if (isset($_POST['jmm-join-site']) || isset($_POST['join-site'])) {
         // This is the magic sauce.
         do_action('jmm_joinsite', array('JMM', 'join_site'));
         echo '<p>' . $welcome . '</p>';
     } else {
         if (!is_user_logged_in()) {
             if (get_option('users_can_register') == 1) {
                 // If user isn't logged in but we allow for registration....
                 // IF we have a custom URL, use it, else send to /wp-signup.php for this site (becuase join my SITE, not network)
                 if (!is_null($jmm_options['perpage']) && $jmm_options['perpage'] != "XXXXXX") {
                     $goto = get_permalink($jmm_options['perpage']);
                 } else {
                     $goto = '/wp-signup.php';
                 }
                 // Here is our form
                 echo '<form action="' . $goto . '" method="post" id="notmember">';
                 echo '<input type="hidden" name="action" value="jmm-join-site">';
                 echo '<input type="submit" value="' . $notregistered . '" name="join-site" id="join-site" class="button">';
                 echo '</form>';
                 // Do we show the inline login form?
                 if ($show_form == 'on') {
                     echo '<br /><h3 class="widget-title">' . __("Log in") . '</h3>';
                     wp_login_form(array('value_remember' => 1));
                 }
             }
             // If we don't allow registration, we show nothing. On to the next one!
         } elseif (!is_user_member_of_blog()) {
             // If user IS logged in, then let's invite them to play.
             echo '<form action="?jmm-join-site" method="post" id="notmember">';
             echo '<input type="hidden" name="action" value="jmm-join-site">';
             echo '<input type="submit" value="' . $notmember . '" name="join-site" id="join-site" class="button">';
             echo '</form>';
         } else {
             // Otherwise we're already a member, hello, mum!
             echo '<p>' . $member . '</p>';
         }
     }
     /* After widget (defined by themes). */
     echo $after_widget;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:59,代码来源:widget.php

示例12: remove_user

 /**
  * Removes a user from the current site.
  * @param  int $user_id
  * @return array|WP_Error
  */
 function remove_user($user_id)
 {
     if (!current_user_can('remove_users')) {
         return new WP_Error('unauthorized', 'User cannot remove users for specified site.', 403);
     }
     if (!is_user_member_of_blog($user_id, get_current_blog_id())) {
         return new WP_Error('invalid_input', 'User is not a member of the specified site.', 400);
     }
     return array('success' => remove_user_from_blog($user_id, get_current_blog_id()));
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:15,代码来源:class.wpcom-json-api-update-user-endpoint.php

示例13: pnfw_delete_plugin

function pnfw_delete_plugin()
{
    global $wpdb;
    $table_name = $wpdb->get_blog_prefix() . 'push_tokens';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_viewed';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_sent';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_excluded_categories';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_logs';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'postmeta';
    $wpdb->query("DELETE FROM {$table_name} WHERE meta_key = 'pnfw_do_not_send_push_notifications_for_this_post' OR meta_key = 'pnfw_user_cat';");
    $user_query = new WP_User_Query(array('role' => 'app_subscriber'));
    foreach ($user_query->results as $user) {
        if (empty($user->user_email)) {
            if (is_multisite()) {
                require_once ABSPATH . 'wp-admin/includes/ms.php';
                if (is_user_member_of_blog($user->ID)) {
                    wpmu_delete_user($user->ID);
                }
            } else {
                wp_delete_user($user->ID);
            }
        }
    }
    delete_option('pnfw_db_version');
    delete_option('pnfw_posts_per_page');
    delete_option('pnfw_last_save_timestamp');
    delete_option('pnfw_enable_push_notifications');
    delete_option('pnfw_ios_push_notifications');
    delete_option('pnfw_android_push_notifications');
    delete_option('pnfw_kindle_push_notifications');
    delete_option('pnfw_url_scheme');
    delete_option('pnfw_ios_use_sandbox');
    delete_option('pnfw_sandbox_ssl_certificate_media_id');
    delete_option('pnfw_sandbox_ssl_certificate_password');
    delete_option('pnfw_production_ssl_certificate_media_id');
    delete_option('pnfw_production_ssl_certificate_password');
    delete_option('pnfw_ios_payload_sound');
    delete_option('pnfw_google_api_key');
    delete_option('pnfw_adm_client_id');
    delete_option('pnfw_adm_client_secret');
    delete_option('pnfw_api_consumer_key');
    delete_option('pnfw_api_consumer_secret');
    delete_option('pnfw_enabled_post_types');
    delete_option('pnfw_enabled_object_taxonomies');
    delete_option('pnfw_use_wpautop');
    delete_option('pnfw_disable_email_verification');
    delete_option('pnfw_add_message_field_in_payload');
    delete_option('pnfw_uninstall_data');
    flush_rewrite_rules();
}
开发者ID:benediktharter,项目名称:push-notifications-for-wp,代码行数:55,代码来源:uninstall.php

示例14: join_site

 static function join_site()
 {
     global $current_user, $blog_id;
     $jmm_options = get_option('helfjmm_options');
     if (!is_user_logged_in()) {
         return false;
     }
     if (!is_user_member_of_blog()) {
         add_user_to_blog($blog_id, $current_user->ID, $jmm_options['role']);
     }
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:11,代码来源:joinmymultisite.php

示例15: column_title

 /**
  * @param array $item A singular item (one full row's worth of data)
  *
  * @return string Text to be placed inside the column <td>
  */
 function column_title($item)
 {
     list($user_id, $blog_id) = explode(':', $item['ID']);
     // Build row actions
     $actions = array('visit' => sprintf('<a href="%s">%s</a>', get_site_url($blog_id), __('Visit Book')));
     // Only include admin link if user has admin rights to the book in question
     if (is_super_admin($user_id) || is_user_member_of_blog($user_id, $blog_id)) {
         $actions['dashboard'] = sprintf('<a href="%s">%s</a>', get_admin_url($blog_id), __('Visit Admin', 'pressbooks'));
     }
     // Return the title contents
     return sprintf('<span class="title">%1$s</span> %2$s', $item['title'], $this->row_actions($actions));
 }
开发者ID:samsruti,项目名称:pressbooks,代码行数:17,代码来源:class-pb-catalog-list-table.php


注:本文中的is_user_member_of_blog函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。