• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_can_create_post函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: user_can_set_post_date

function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None')
{
    $author_data = get_userdata($user_id);
    return $author_data->user_level > 4 && user_can_create_post($user_id, $blog_id, $category_id);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:5,代码来源:deprecated.php


示例2: user_can_set_post_date

/**
 * Whether user can set new posts' dates.
 *
 * @since 1.5
 * @deprecated 2.0
 * @deprecated Use current_user_can()
 * @see current_user_can()
 *
 * @param int $user_id
 * @param int $blog_id Not Used
 * @param int $category_id Not Used
 * @return bool
 */
function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None')
{
    _deprecated_function(__FUNCTION__, '2.0', 'current_user_can()');
    $author_data = get_userdata($user_id);
    return $author_data->user_level > 4 && user_can_create_post($user_id, $blog_id, $category_id);
}
开发者ID:rkglug,项目名称:WordPress,代码行数:19,代码来源:deprecated.php


示例3: printf

<p><label for="trackback"> <?php 
printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback');
?>
	<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>

<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php 
_e('Save as Draft');
?>
" /> 
  <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php 
_e('Save as Private');
?>
" />

	 <?php 
if (user_can_create_post($user_ID)) {
    ?>
  <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php 
    _e('Publish');
    ?>
" /> 
<?php 
}
?>

<?php 
if ('bookmarklet' != $mode) {
    echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing &raquo;') . '" />';
}
?>
  <input name="referredby" type="hidden" id="referredby" value="<?php 
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:edit-form.php


示例4: mw_newPost

	function mw_newPost($args) {

	  global $wpdb, $post_default_category;

		$this->escape($args);

	  $blog_ID     = $args[0]; // we will support this in the near future
	  $user_login  = $args[1];
	  $user_pass   = $args[2];
	  $content_struct = $args[3];
	  $publish     = $args[4];

	  if (!$this->login_pass_ok($user_login, $user_pass)) {
	    return $this->error;
	  }

	  $user_data = get_userdatabylogin($user_login);
	  if (!user_can_create_post($user_data->ID, $blog_ID)) {
	    return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');
	  }

	  $post_author = $user_data->ID;

	  $post_title = $content_struct['title'];
	  $post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
	  $post_status = $publish ? 'publish' : 'draft';

	  $post_excerpt = $content_struct['mt_excerpt'];
	  $post_more = $content_struct['mt_text_more'];

	  $comment_status = (empty($content_struct['mt_allow_comments'])) ?
	    get_settings('default_comment_status')
	    : $content_struct['mt_allow_comments'];

	  $ping_status = (empty($content_struct['mt_allow_pings'])) ?
	    get_settings('default_ping_status')
	    : $content_struct['mt_allow_pings'];

	  if ($post_more) {
	    $post_content = $post_content . "\n<!--more-->\n" . $post_more;
	  }

		$to_ping = $content_struct['mt_tb_ping_urls'];

	  // Do some timestamp voodoo
	  $dateCreatedd = $content_struct['dateCreated'];
	  if (!empty($dateCreatedd)) {
	    $dateCreated = $dateCreatedd->getIso();
	    $post_date     = get_date_from_gmt(iso8601_to_datetime($dateCreated));
	    $post_date_gmt = iso8601_to_datetime($dateCreated, GMT);
	  } else {
	    $post_date     = current_time('mysql');
	    $post_date_gmt = current_time('mysql', 1);
	  }

	  $catnames = $content_struct['categories'];
	  logIO('O', 'Post cats: ' . printr($catnames,true));
	  $post_category = array();

	  if (is_array($catnames)) {
	    foreach ($catnames as $cat) {
	      $post_category[] = get_cat_ID($cat);
	    }
	  } else if ( !empty($catnames) ) {
			$post_category = array(get_cat_ID($catnames));
		}
		
	  // We've got all the data -- post it:
	  $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping');

	  $post_ID = wp_insert_post($postdata);

	  if (!$post_ID) {
	    return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');
	  }

	  logIO('O', "Posted ! ID: $post_ID");

	  // FIXME: do we pingback always? pingback($content, $post_ID);
	  trackback_url_list($content_struct['mt_tb_ping_urls'],$post_ID);

	  return strval($post_ID);
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:83,代码来源:xmlrpc.php


示例5: preg_replace

 }
 //if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status');
 $post_password = $_POST['post_password'];
 $post_name = $_POST['post_name'];
 $post_parent = 0;
 if (isset($_POST['parent_id'])) {
     $post_parent = (int) $_POST['parent_id'];
 }
 $trackback = $_POST['trackback_url'];
 // Format trackbacks
 $trackback = preg_replace('|\\s+|', '\\n', $trackback);
 if (isset($_POST['publish'])) {
     $post_status = 'publish';
 }
 // Double-check
 if ('publish' == $post_status && !user_can_create_post($user_ID)) {
     $post_status = 'draft';
 }
 if (empty($post_name)) {
     if ('draft' != $post_status) {
         $post_name = sanitize_title($post_title, $post_ID);
     }
 } else {
     $post_name = sanitize_title($post_name, $post_ID);
 }
 if ('publish' == $post_status) {
     $post_name_check = $wpdb->get_var("SELECT post_name FROM {$wpdb->posts} WHERE post_name = '{$post_name}' AND post_status = 'publish' AND ID != '{$post_ID}' LIMIT 1");
     if ($post_name_check) {
         $suffix = 2;
         while ($post_name_check) {
             $alt_post_name = $post_name . "-{$suffix}";
开发者ID:BackupTheBerlios,项目名称:steampress-svn,代码行数:31,代码来源:post.php


示例6: get_option

<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
//-->
</script>

<input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" />

<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
	<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>

<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" /> 
  <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />

	 <?php if ( user_can_create_post($user_ID) ) : ?>
  <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" /> 
<?php endif; ?>

<?php if ('bookmarklet' != $mode) {
      echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' .  __('Advanced Editing &raquo;') . '" />';
  } ?>
  <input name="referredby" type="hidden" id="referredby" value="<?php if (isset($_SERVER['HTTP_REFERER'])) echo urlencode($_SERVER['HTTP_REFERER']); ?>" />
</p>

<?php do_action('simple_edit_form', ''); ?>

</div>
</form>

</div>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:edit-form.php


示例7: preg_replace

	if (empty($post_name)) {
		$post_name = $post_title;
	}

	$post_parent = 0;
	if (isset($_POST['parent_id'])) {
		$post_parent = $_POST['parent_id'];
	}

	$trackback = $_POST['trackback_url'];
	// Format trackbacks
	$trackback = preg_replace('|\s+|', '\n', $trackback);
	
	if (isset($_POST['publish'])) $post_status = 'publish';
	// Double-check
	if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) && 2 != get_option('new_users_can_blog') )
		$post_status = 'draft';

	if (empty($post_name)) {
		$post_name = sanitize_title($post_title, $post_ID);
	} else {
		$post_name = sanitize_title($post_name, $post_ID);
	}

	if ('publish' == $post_status) {
		$post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'publish' AND ID != '$post_ID' LIMIT 1");
		if ($post_name_check) {
			$suffix = 2;
			while ($post_name_check) {
				$alt_post_name = $post_name . "-$suffix";
				$post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'publish' AND ID != '$post_ID' LIMIT 1");
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:post.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_can_edit_post函数代码示例发布时间:2022-05-23
下一篇:
PHP user_can_assign函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap