PDA

View Full Version : Custom postbit based on UserGroup


Jagang
04-22-2003, 09:32 PM
I'm not sure if something like this has ever been released but I was unable to find it in a search. If it exist just point me in the right direction. What I am looking for is the ability to assign certain postbit templates to certain member groups. My use for this mainly has to do with the RPG Intergration hack. Since it has a custom postbit showing RPG stats I would like to make a member group "RPG Members" and only have them seeing this postbit. The regular members I would like to only see the regular default postbit without the RPG Info. I'm sure this could have other uses beyond just this one hack though like for mods and admins. So does anyone have any ideas on how this could be done?

Dean C
04-23-2003, 10:12 AM
This would require hacking :)

- miSt

Jagang
04-24-2003, 02:43 AM
I figured it might, could one of the mods please move this to Hack Request.

Dean C
04-24-2003, 09:22 AM
*Moved upon request* :)

- miSt

Jagang
04-25-2003, 05:13 AM
Anyone have any suggestions? Anyone at all? ;)

Brad
04-25-2003, 05:30 AM
Open /admin/functions.php

## Find:

// do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
return $retval;

## Replace with:

// do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} elseif ($post[usergourpid]==4) { // change 4 to the usergourpid of the rpg gourp
eval("\$retval = \"".gettemplate("postbit_rpg")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
return $retval;

Change the number 4 as told in code comments

Add a new template named postbit_rpg, this is the postbit that will display for your rpg gourp. :)

Jagang
04-25-2003, 11:09 AM
Thanx loo, btw I also need my mod and admin groups to have the rpg postbit as well, what line would I add for more groups. Extra elseif lines?

EDIT:
Nevermind, it worked like I thought. I was able to add extra groups like this:



// do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} elseif ($post[usergroupid]==6) {
eval("\$retval = \"".gettemplate("postbit_rpg")."\";");
} elseif ($post[usergroupid]==12) {
eval("\$retval = \"".gettemplate("postbit_rpg")."\";");
} elseif ($post[usergroupid]==7) {
eval("\$retval = \"".gettemplate("postbit_rpg")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
return $retval;

Now it is showing just like I wanted it to. Once again thanx alot loo