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


PHP CBlogUser::AddToUserGroup方法代码示例

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


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

示例1: Add

 public static function Add($arFields)
 {
     global $DB;
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CBlogCandidate::CheckFields("ADD", $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_blog_user2blog", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($arInsert[0]) > 0) {
             $arInsert[0] .= ", ";
         }
         $arInsert[0] .= $key;
         if (strlen($arInsert[1]) > 0) {
             $arInsert[1] .= ", ";
         }
         $arInsert[1] .= $value;
     }
     $ID = False;
     if (strlen($arInsert[0]) > 0) {
         $strSql = "INSERT INTO b_blog_user2blog(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $ID = IntVal($DB->LastID());
     }
     if ($ID) {
         $arCandidat = CBlogCandidate::GetByID($ID);
         if ($arCandidat) {
             $arBlog = CBlog::GetByID($arCandidat["BLOG_ID"]);
             if (strlen($arBlog["AUTO_GROUPS"]) > 0) {
                 $arAutoGroups = unserialize($arBlog["AUTO_GROUPS"]);
                 if (is_array($arAutoGroups) && count($arAutoGroups) > 0) {
                     $arBlogUser = CBlogUser::GetByID($arCandidat["USER_ID"], BLOG_BY_USER_ID);
                     if (!$arBlogUser) {
                         CBlogUser::Add(array("USER_ID" => $arCandidat["USER_ID"], "=LAST_VISIT" => $GLOBALS["DB"]->GetNowFunction(), "=DATE_REG" => $GLOBALS["DB"]->GetNowFunction(), "ALLOW_POST" => "Y"));
                     }
                     CBlogUser::AddToUserGroup($arCandidat["USER_ID"], $arCandidat["BLOG_ID"], $arAutoGroups, "", BLOG_BY_USER_ID, BLOG_CHANGE);
                     CBlogCandidate::Delete($ID);
                 }
             }
         }
     }
     return $ID;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:49,代码来源:blog_candid.php

示例2: GetMessage

     $APPLICATION->SetTitle(GetMessage("B_B_US_TITLE"));
 }
 if ($arBlog = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"])) {
     if ($arBlog["ACTIVE"] == "Y") {
         $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
         if ($arGroup["SITE_ID"] == SITE_ID) {
             $arResult["Blog"] = $arBlog;
             if (CBlog::CanUserManageBlog($arBlog["ID"], IntVal($USER->GetID()))) {
                 if ($arParams["SET_TITLE"] == "Y") {
                     $APPLICATION->SetTitle(str_replace("#NAME#", $arBlog["NAME"], GetMessage("B_B_US_TITLE_BLOG")));
                 }
                 $errorMessage = "";
                 $okMessage = "";
                 if (IntVal($GLOBALS["del_id"]) > 0) {
                     if (check_bitrix_sessid()) {
                         CBlogUser::AddToUserGroup($GLOBALS["del_id"], $arBlog["ID"], array(), "", BLOG_BY_USER_ID, BLOG_CHANGE);
                         $dbCandidate = CBlogCandidate::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "USER_ID" => IntVal($GLOBALS["del_id"])));
                         if ($arCandidate = $dbCandidate->Fetch()) {
                             CBlogCandidate::Delete($arCandidate["ID"]);
                             $okMessage = GetMessage("B_B_US_DELETE_OK") . ".<br />";
                         }
                     } else {
                         $errorMessage .= GetMessage("BLOG_BLOG_SESSID_WRONG") . "<br />";
                     }
                 }
                 if (isset($_REQUEST["add_friend"]) && is_array($_REQUEST["add_friend"])) {
                     if (check_bitrix_sessid()) {
                         foreach ($_REQUEST["add_friend"] as $key => $friend) {
                             $arFriendUsers = array();
                             if (StrLen($friend) > 0) {
                                 $arUserID = array();
开发者ID:,项目名称:,代码行数:31,代码来源:

示例3: GetMessage

 if ($arParams["SET_TITLE"] == "Y") {
     $APPLICATION->SetTitle(str_replace("#NAME#", $arBlog["NAME"], GetMessage("B_B_USE_TITLE_BLOG")));
 }
 $errorMessage = "";
 $okMessage = "";
 $arBlogUser = CBlogUser::GetByID($arUser["ID"], BLOG_BY_USER_ID);
 $arBlogUser = CBlogTools::htmlspecialcharsExArray($arBlogUser);
 $arResult["BlogUser"] = $arBlogUser;
 if ($GLOBALS["user_action"] == "Y" && check_bitrix_sessid()) {
     if (strlen($GLOBALS["cancel"]) > 0) {
         LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arBlog["URL"])));
     }
     if (empty($arBlogUser)) {
         CBlogUser::Add(array("USER_ID" => $arUser["ID"], "=LAST_VISIT" => $DB->GetNowFunction(), "=DATE_REG" => $DB->GetNowFunction(), "ALLOW_POST" => "Y"));
     }
     CBlogUser::AddToUserGroup($arUser["ID"], $arBlog["ID"], $GLOBALS["add2groups"], "", BLOG_BY_USER_ID, BLOG_CHANGE);
     $dbCandidate = CBlogCandidate::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arUser["ID"]));
     if ($arCandidate = $dbCandidate->Fetch()) {
         CBlogCandidate::Delete($arCandidate["ID"]);
     }
     LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arBlog["URL"])));
 }
 $arResult["ERROR_MESSAGE"] = $errorMessage;
 $arResult["OK_MESSAGE"] = $okMessage;
 $arResult["userName"] = CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
 $arResult["urlToUser"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
 $arResult["arUserGroups"] = CBlogUser::GetUserGroups($arUser["ID"], $arBlog["ID"], "Y", BLOG_BY_USER_ID);
 $dbBlogGroups = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]), false, false, array("ID", "NAME"));
 while ($arBlogGroups = $dbBlogGroups->GetNext()) {
     $arResult["Groups"][] = $arBlogGroups;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


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