FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Private Forums Hack
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Private Forums Hack [message #1028] Wed, 20 March 2002 03:58 Go to previous message
Luterin is currently offline  Luterin   Sweden
Messages: 17
Registered: March 2002
Location: Malmö/Sweden
Karma:
Junior Member

This is just something I did real quick today, and it's getting real late, but I'll post the changes I made here, and if it's unclear what I've done to many, just ask and I'll clarify.

In MySQL do:
alter table fud_forum add private enum('Y','N') NOT NULL DEFAULT 'N';
alter table fud_users add private_access enum('Y','N') NOT NULL DEFAULT 'N';

Now for codechanges...

* thread.php:
* Add this line after the line "cache_buster();"

if ($frm->private=='Y' && !($usr->private_access=='Y')) error_dialog('This is a Private Forum', 'This is a Private Forum, only invited users may view these forums.' , '');

* admuser.php:
* Add this code before "case 'block':"
case 'private':
if ( $usr->private_access == 'Y' )
$usr->clear_private_access();
else
$usr->set_private_access();
header("Location: admuser.php?".$_RSID."&usr_login=".urlencode($usr->lo gin));
exit();
break;
* Add this line after "<tr bgcolor="#f1f1f1"><td>Blocked: ..... " at the end of the form
<tr bgcolor="#f1f1f1"><td>Private Access:</td></td><?php echo $usr->private_access; ?> &lt;<a href="admuser.php?act=private&
usr_id=<?php echo $usr->id.'&'.$_RSID; ?>">Toggle</a>&gt;</td></tr>

* users_adm.inc:
* Add this code before "function block_user()"
function set_private_access()
{
Q("UPDATE fud_users SET private_access='Y' where id=".$this->id);
}

function clear_private_access()
{
Q("UPDATE fud_users SET private_access='N' where id=".$this->id);
}

* admforum.php:
* Add this code before the submit button at the end of the form
<tr bgcolor="#bff8ff">
<td>Private</td>
<td><?php draw_select('frm_private', "No\nYes", "N\nY", empty($frm_private)?'':$frm_private); ?></td>
</tr>

* forum_adm.inc:
* Add this line at the end of the SQL statement in function add()
'".$this->private."'
* Add this line at the end of the SQL statement in function sync()
private='".YN($this->private)."'

* users.inc:
* Add this among the other var definitions in the beginning
var $private_access=NULL;

* forum.inc
* Add this among the other var definitions in the beginning
var $private=NULL;


After doing this, if you understood what I tried to explain, you will have a private flag available on all forums and users.

Set it on a forum to make it usable only by users with the private_access flag set.

This is not a feature supported by Advanced Internet Designs Inc., it's just something I cooked up in a few hours since I lacked that feature and wanted it for my own use, but since others also have asked for it I wanted to share what I had done.

Feel free to ask if you have any questions.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: scalable fonts -- header_1.inc hack
Next Topic: Extra FUDCode tags
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 16:24:53 GMT 2024

Total time taken to generate the page: 0.04453 seconds