本文整理汇总了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;
}
示例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.