UBB.Dev
Posted By: coloradok5 Need a few hacks for 6.2 - 02/25/2003 7:13 PM
Not sure if this is the right place, but here goes: In order to try and get a handle on bandwidth as well as convert users to Members I need a few hacks like this:

1. Currently I would like to see a hack that would allow the image tag to be used by group, not the current, on or off for everyone. This would allow only my Member group to show pics in their posts not everyone.

2. I would also like to see a hack that would only allow a certain group to display avitars, not the current, on or off for everyone. This would allow only my Member group to have an avitar in their posts not everyone.

Basicly, anywhere I can limit pics/bandwidth by group I'm all for, can anyone create hacks like this, I'm sure others could use these?
Posted By: coloradok5 Re: Need a few hacks for 6.2 - 02/26/2003 6:53 PM
Anyone?
Posted By: Gardener Re: Need a few hacks for 6.2 - 02/26/2003 7:38 PM
1. This is an easy fix. Find the following lines in ubbt.inc.php:
Code
<br />    // ----------------------------<br />    // Convert email markup -> html<br />       $Body = preg_replace("/\[{$ubbt_lang['TEXT_EMAIL']}\]([^\[]*)\[\/{$ubbt_lang['TEXT_EMAIL']}\]/i","<a href=\"mailto:\\1\">\\1</a>",$Body);<br /><br />    // ---------------------<br />    // Convert image markup <br />       if ($config['allowimages']) {<br />

And replace them with this:
Code
<br />    // ----------------------------<br />    // Convert email markup -> html<br />       $Body = preg_replace("/\[{$ubbt_lang['TEXT_EMAIL']}\]([^\[]*)\[\/{$ubbt_lang['TEXT_EMAIL']}\]/i","<a href=\"mailto:\\1\">\\1</a>",$Body);<br /><br />    // ---------------------<br />    // Convert image markup <br />       Global $user;<br />       if ($config['allowimages'] && stristr($user['U_Groups'], "-{$config['imagegroup']}-")) {<br />


Then add this line to your config file (and change 5 to the number of the group you want to allow images for):
$config['imagegroup'] = "5";

2. This is almost as easy. Open up your editbasic.php file and do the following:

Find these lines:
Code
<br />// -----------------<br />// Get the user info<br />   $userob = new user;<br />   $user = $userob -> authenticate();                         <br />


Replace them with this:
Code
<br />// -----------------<br />// Get the user info<br />   $userob = new user;<br />   $user = $userob -> authenticate("U_Groups");                         <br />


Now find these lines:
Code
<br />   if ($theme['PictureView']) {<br />      if ( ($config['avatars']) && (ini_get('file_uploads')) ){<br />


And replace them with this:
Code
<br />   if ($theme['PictureView'] && stristr($user['U_Groups'], "-{$config['avatargroup']}-")) {<br />      if ( ($config['avatars']) && (ini_get('file_uploads')) ){<br />


That's it. Now you need to add a new configuration option to your config file, so open that up and insert this at the end:
$config['avatargroup'] = "5";

Posted By: coloradok5 Re: Need a few hacks for 6.2 - 02/26/2003 11:21 PM

I will get this going this weekend and let you know how it went, you da man.
Posted By: Deejay_dup1 Re: Need a few hacks for 6.2 - 06/23/2003 2:23 AM
Wondering how you can do this for many groups? How would you add in multiple groups, so that more than the one group can add an avatar?

Deej
Posted By: Deejay_dup1 Re: Need a few hacks for 6.2 - 06/23/2003 2:29 AM
This can be done easily it looks like, by adding the groups to this variable?

$config['avatargroup'] = "5";

How would I add groups 6,7,8 etc?

Deejay
Posted By: Gardener Re: Need a few hacks for 6.2 - 06/23/2003 3:02 AM
Wouldn't it be easier to just create a special avatar group for this purpose and add all relevant users to it?

But I'll see what I can whip up.
Posted By: Gardener Using avatars for several groups - 06/23/2003 3:12 AM
Here are complete instructions for letting several groups use avatars. All steps are the same as before except the last one. I've also changed the name of the config option to make it plural.

Open up your editbasic.php file and do the following:

Find these lines:
Code
<br />// -----------------<br />// Get the user info<br />   $userob = new user;<br />   $user = $userob -> authenticate();                         <br />


Replace them with this:
Code
<br />// -----------------<br />// Get the user info<br />   $userob = new user;<br />   $user = $userob -> authenticate("U_Groups");                         <br />


Now find these lines:
Code
<br />   if ($theme['PictureView']) {<br />      if ( ($config['avatars']) && (ini_get('file_uploads')) ){<br />


And replace them with this:
Code
<br />   $grpfound = false;<br />   $avgroups = split(",", $config['avatargroups']); <br />   foreach ( $avgroups as $grp ) {<br />      if ( stristr($user['U_Groups'], "-{$grp}-") ) {<br />         $grpfound = true;<br />      }<br />   }<br />   if ($theme['PictureView'] && $grpfound ) {<br />      if ( ($config['avatars']) && (ini_get('file_uploads')) ){<br />


That's it. Now you need to add a new configuration option to your config file, so open that up and insert this at the end:
$config['avatargroups'] = "5,6,7";

This has been tested to work on 6.2.3.
Posted By: Deejay_dup1 Re: Using avatars for several groups - 06/23/2003 4:28 AM
Thanks Since i already had the hack installed before all i had to change was the last snip of code and then the avatargroups 5,6,7 etc...

Awesome! thanks!

(I cant say enough about the awesome help here.. thanks guys!)

Deej
Posted By: Gardener Re: Using avatars for several groups - 06/23/2003 6:04 AM
You're welcome. I'm stuck with a problem of my own at the moment and needed some distractions so I might be able to look at the problem with a fresh mind...
Posted By: smilesforu Re: Using avatars for several groups - 12/27/2003 11:30 PM
Anybody update this for 6.4?
Posted By: omegatron Re: Using avatars for several groups - 12/28/2003 9:12 PM
Nearest I can tell from comparing the instructions to the code involved in 6.4 it is the same. You should be able to apply the changes from Gardener's text.
Posted By: ericgtr Re: Using avatars for several groups - 12/28/2003 9:45 PM
Okay, I have this working in 6.4 but the problem is with this line, by default in 6.4 it reads
Code
    <br />$userob = new user;<br />$user = $userob -> authenticate("U_CoppaUser"); 


The only way I can get it to work is to replace "U_CoppaUser" with "U_Groups" I tried this
Code
    <br />$userob = new user;<br />$user = $userob -> authenticate("U_CoppaUser","U_Groups"); 


and it didn't work.
Posted By: omegatron Re: Using avatars for several groups - 12/28/2003 11:12 PM
That is because it is suppose to be this

$userob = new user;
$user = $userob -> authenticate("U_CoppaUser, U_Groups");

not this you have

$userob = new user;
$user = $userob -> authenticate("U_CoppaUser","U_Groups");
Posted By: ericgtr Re: Using avatars for several groups - 12/28/2003 11:18 PM
Ahh.. thanks
Posted By: omegatron Re: Using avatars for several groups - 12/28/2003 11:28 PM
Don't meantion it
Posted By: Ian_W Re: Using avatars for several groups - 12/28/2003 11:40 PM
I don't think you need to add U_Groups for 6.4 as it is authenticated within ubbt.inc.php
Posted By: omegatron Re: Using avatars for several groups - 12/28/2003 11:42 PM
U_Groups was authenticated in ubbt-inc.php I beleive in 6.2 as well Ian. no worries though using it here.
Posted By: isak Re: Using avatars for several groups - 03/24/2005 9:41 PM
Has anybody got this to work for 6.5?
© UBB.Developers