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


PHP ACL::member方法代码示例

本文整理汇总了PHP中ACL::member方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::member方法的具体用法?PHP ACL::member怎么用?PHP ACL::member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACL的用法示例。


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

示例1: nm_edit_user_blog_post

/**
 * Creates an user blog post, auto redirects them to the post they have written
 * 
 * @param: An array containing the post info e.g array( 'postTitle' =>, 'postContent' => )
 *
 */
function nm_edit_user_blog_post($info)
{
    check_admin_referer('user-blog-post_edit');
    global $wpdb;
    $postContent = strip_tags($info['blogContent']);
    $postTags = $info['blogTags'];
    if (!is_user_logged_in()) {
        $feedback = "<p class='message error'>You have to be logged in to write a blog post</p>";
    } elseif (!$postTags) {
        $feedback = "<p class='message error'>Please enter some tags that describe your blog post.</p>";
    } elseif (!$postContent || preg_replace('/\\s+/', '', $postContent) == '') {
        $feedback = "<p class='message error'>You need to write the body of the blog post</p>";
    } else {
        $newPost = array('ID' => $info['ID'], 'post_content' => $postContent, 'post_parent' => $info['blogGroup']);
        $acc = new ACL($newPost);
        switch ($info['access']) {
            case 'hidden':
                $acc->hidden();
                break;
            case 'members':
            default:
                // Just in case something goes crazy
                $acc->member();
                break;
            case 'friends':
                $acc->friend();
                //public is a php keyword
                break;
            case 'public':
                $acc->everyone();
                //public is a php keyword
                break;
        }
        wp_set_post_tags($info['ID'], $postTags);
        $postId = wp_update_post($newPost);
        $feedback = '<p class="message success">Blog post updated successfully | <a href="' . nm_get_user_blog_permalink($postId) . '">View ' . get_the_title($postId) . '<a/></p>';
    }
    return $feedback;
}
开发者ID:popovdenis,项目名称:kmst,代码行数:45,代码来源:nm-user-blogs.php

示例2: ACL

 $wm_myobject = new wm_mypost();
 $wm_myobject->post_title = $photoName;
 $wm_myobject->post_content = $photoDesc;
 $wm_myobject->post_status = "publish";
 $wm_myobject->post_author = $author->ID;
 $wm_myobject->post_category = $post_category;
 $wm_myobject->post_parent = $info['photoGroup'];
 $acc = new ACL($wm_myobject);
 switch ($info['access']) {
     case 'hidden':
         $acc->hidden();
         break;
     case 'members':
     default:
         // Just in case something goes crazy
         $acc->member();
         break;
     case 'friends':
         $acc->friend();
         //public is a php keyword
         break;
     case 'public':
         $acc->everyone();
         //public is a php keyword
         break;
 }
 $photoId = wp_insert_post($wm_myobject);
 wp_set_post_tags($photoId, $photoTags);
 $attachments = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_parent = {$photoId}");
 if ($attachments) {
     // We delete any previously uploaded images so that we don't fill up the server.
开发者ID:popovdenis,项目名称:kmst,代码行数:31,代码来源:nm-photos.php


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