Sergelie Posted December 9, 2009 Share Posted December 9, 2009 Hello and thanks for your help I need to adapt a piece of code for a CMS (Showing pending files for the Editors) BackGround : In the table « User » Journalists and Editors share the same data in the field « Inst ». I want to adapt the script below so the editors see only the Articles of the Journalists who have the same data as them in the field « inst ». Notes 1) (the OnlyShowOwnArticles) do not concern Editors. 2) Here userId (is the editor who want’s to see the pending articles) Code: $statusWhere = " (a.status=0 or a.status=3) and "; if ($this->_OnlyShowOwnArticles()) { $statusWhere .= sprintf(" (a.authorid='%s') and ", (int)$_COOKIE["userId"]); } $ArticleResult = $GLOBALS["AL_DB"]->Query(sprintf("select * from %s a where %s 1=1", AL_ARTICLES_TABLE, $statusWhere)); $NumArticles = $GLOBALS["AL_DB"]->CountResult($ArticleResult); $NumPages = ceil($NumArticles / AL_ARTICLES_PER_PAGE); $ArticleResult = $GLOBALS["AL_DB"]->Query(sprintf("select *, concat(u.FirstName, ' ', u.LastName) as Author, a.Status as Status from %s a inner join %s u on a.AuthorID = u.UserID where %s 1=1 order by %s %s limit %d, %d", AL_ARTICLES_TABLE, AL_USERS_TABLE, $statusWhere, $sortField, $sortOrder, $Start, AL_ARTICLES_PER_PAGE)); } -- Thanks a lot Link to comment https://forums.phpfreaks.com/topic/184486-cms-permission-adaptation/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.