The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
in a custom page...
i hav to use this: Code:
$query = "SELECT * FROM " . TABLE_PREFIX . "vbtable WHERE cID = ??? ORDER BY dateline DESC"; Like only admin group can view content of category 4 (cID=4; cPermission=6) now i want that query, check if the current user is belong to usergroup-6 (admin)....if so it will get row from mysql table whos cID is 4....otherwise it will skip those row. |
#2
|
|||
|
|||
![]()
I'm not sure if I understand what you're asking, but maybe something like (untested):
Code:
$where = ($vbulletin->userinfo['usergroupid'] != 6) ? " WHERE cID <> 4 " : ""; $query = "SELECT * FROM " . TABLE_PREFIX . "vbtable " . $where . " ORDER BY dateline DESC"; |
#3
|
|||
|
|||
![]()
ok. here is my mysql's table structure
![]() i want to select rows from vbArticles as im the admin my usergroup is 6 look at the table vbCat cID-2 & 4 doesn't hav permission for usergroups-6 now look at table: vbArticles row id-2,3,4,6 is under cID 2 & 4 (but see, i dont hav permission for them) so they will be not selected the query will select only others (id-1,5) thats what i want |
#4
|
|||
|
|||
![]()
That's pretty clear about what you need. What's the type of the cPermission field, is that a string with comma separated numbers?
|
#5
|
|||
|
|||
![]() Quote:
why? shud i change it? |
#6
|
|||
|
|||
![]()
No. I don't know. Just thinking about how to do the query. Try this:
Code:
$query = "SELECT * FROM " . TABLE_PREFIX . "vbarticles as vbarticles LEFT JOIN " . TABLE_PREFIX . "vbcat as vbcat ON vbarticles.cid = vbcat.cid WHERE FIND_IN_SET(" . $vbulletin->userinfo['usergroupid'] . ", vbcat.cpermission) <> 0"; |
#7
|
|||
|
|||
![]()
thank you very much
![]() its working nice |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|