PDA

View Full Version : $oldprivate?? i'm confused...


TECK
05-01-2002, 05:58 AM
i have a problem understanding this code segment in admin/forum.php: $perms=getpermissions($forumid,0,2);
if ($perms[canview]==1) {
$oldprivate=0;
} else {
$oldprivate=1;
}thanks for explaining to me what how the variable is manipulated. i did a search in all the VB files and there is no reference to it.

Admin
05-01-2002, 09:49 AM
It check the Registered's forum permission for $forumid, and if they have access to that forum $oldprivate is 0. If they don't, it's 1. Then if $oldprivate isn't equal to $private (the next line), it means the forum's "privateness" (is that a word?!) was changed (i.e it was either 0 and it's now 1, or it's now 0 but was 1).

TECK
05-01-2002, 03:15 PM
ahaaa.. thanks firefly. i asked about this because i want to add a new option in a news hack (vbHome, you guessed). so basically i try to do this:
in /admin/forum.php, add:makeyesnocode("News forum<br>(Invisible to all except journalists, super moderators and admins; user access masks must be on!)","privatenews",0);and with all the changes that refers to $private (or private), you know what they are, i also add above or below privatenews... if i add this: if ($perms[canview]==1) {
$oldprivate=0;
$oldprivatenews=0;
} else {
$oldprivate=1;
$oldprivatenews=1;
}
if ($oldprivate!=$private and $oldprivatenews!=$privatenews) {(you get the idea, i don't post here the hole changes), if i check the YES button, it will mark it as NO all the time. could i use only $oldprivate variable and referr to it like that?if ($oldprivate!=$private or $oldprivate!=$privatenews)let me know what you think. is gotta be a new table field that i have to add, let me know. thanks.