PDA

View Full Version : Selective Forum Filter


akanevsky
04-12-2005, 10:00 PM
/*================================================= =====================*\
|| Selective Forum Filter for vBulletin 3.0.3 - 3.0.7
|| Author : Psionic Vision
\*================================================ ======================*/

What's That For:
It enables your forum users to selectively hide various forums from the forum list and from search by using the new "Edit Forum Visibility Mode" on the index page of your forums.
When hidden, users can access those forums using direct url, or using the edit mode.
The user will still be able to access his hidden forums by using direct url, and he will be able to search from within them.

1.07
[+] Bugfix release..

1.06
[+] Now you can also enter visibility edit mode in subforums. That is useful when there are many forum levels and thus not all of them are accessible from forumhome.
[+] Edit mode is now saved into cookie, so until you either exit from that mode or close your browser, your state will be saved between pages :)

1.05
Two more template changes that were forgotten about in 1.04.

1.04
Major Update! The confusing type-in-digits text field in the user profile is no more. Now, to edit forum visibility, user must simply click on a new link, and that link will take him to the edit interface. See screenshots.

Note: Of course, guests will not be able to access that mode.

1.03
Once again the manual has been corrected... :(

1.02
[BugFix] The subforums now get hidden as well (subforums are the list of forums that are outside your forum depth view).

1.01
My apologies - The manual has been incomplete. A query and a step were missing.
This time everything is fixed :)

1.00
First Public Release

P.S. I do not think there is a screenshot needed here, because the only visual thing the hack does is a new field in user options panel.

I WILL ONLY PROVIDE SUPPORT IF YOU CLICK INSTALL

j_86
04-13-2005, 07:01 PM
I'll stick with https://vborg.vbsupport.ru/showthread.php?t=77687 - but good to see some variations :)

Marco van Herwaarden
04-13-2005, 07:06 PM
Just 1 remark. If i understand it correct a user can give a list of comma seperated forumid's.

The following however would turn the user input into an integer (so no list of comma seperated values anymore). Didn't install this, but just did a quick look at the code:
globalize($_POST, array('excludeforumids' => INT));

akanevsky
04-13-2005, 07:14 PM
Jimpsed,
Alright, I don't mind. :squareeyed: Besides, when I was making this hack I did not know something like this exists already :)

Fixed, thanks.

Ghostsuit
04-13-2005, 07:41 PM
I'll stick with https://vborg.vbsupport.ru/showthread.php?t=77687 - but good to see some variations :) emm not to be a bit confused but where did you get the file since there is no hack there only the idea of one? :S

I'm probably missing something.

Allan
04-13-2005, 09:05 PM
not badly, beautiful job, that can be very useful in certain situation, thank you has you :)

ps: you should add a "screen" directly in this thread ;)

Lionel
04-13-2005, 09:19 PM
Letting user type is a bad idea. Can it be like the image in second post?

akanevsky
04-13-2005, 09:24 PM
No worries.
He can only type what he should type :) And there is no way around typing only digits separated by commas :)

P.S >> If you are talking about the image in the OTHER thread, yes it can be done. However, it would require enabled JavaScript to work, and it just wouldn't if JS was off... So no, sorry, but I won't do it the graphic way.

Lionel
04-13-2005, 09:27 PM
I learn that which seems easy for us is not for others. I can already see myself bombarded with emails: "How do I know the forum id?". It's also easier to select when you have a visual.

akanevsky
04-13-2005, 09:29 PM
As I said, many people have javascript off. Therefore, you could then get bombarded with email "why won't that thing work". Besides, you could put the explanation about the ID into the phrase that is used to describe that field...

kall
04-13-2005, 11:24 PM
It would appear that this hack wants a field that doesn't exist in my database.

Might be an idea to include this information in the readme. :)

kall
04-13-2005, 11:30 PM
And even when having a field in the user table called excludeforumids .. it doesn't do anything.

I was wondering how it could, when forumdisplay.php nor forumhome.php are changed.

akanevsky
04-13-2005, 11:33 PM
Uh, damn, yea I forgot about that. Hold on, I shall fix the readme.

akanevsky
04-13-2005, 11:46 PM
Manual has been updated :)

kall
04-14-2005, 02:20 AM
Manual has been updated :)
Ah yes, it works for forumdisplay now...not for sub-forums on ForumHome though.

kall
04-14-2005, 02:27 AM
Ahh.
Also in functions_forumlist.php find:

else
{ // get on/off status
$lastpostinfo = $forumcache["$lastpostarray[$forumid]"];

above, add the code you added in the other bit. :)

And it works 100% PERFECTION! I don't need to delete any Forums now. :)

GamerzWorld
04-14-2005, 11:39 AM
Ahh.
Also in functions_forumlist.php find:

else
{ // get on/off status
$lastpostinfo = $forumcache["$lastpostarray[$forumid]"];

above, add the code you added in the other bit. :)

And it works 100% PERFECTION! I don't need to delete any Forums now. :)

Can you explain that change abit more

kall
04-14-2005, 11:48 AM
The first change only hides the forums on Forumdisplay...the one I mention hides them on ForumHome (if they are subforums, they would show if you don't apply my bit).

The code to insert is the same as you inserted as per the hack instructions, you just have to insert it again where I said to.

akanevsky
04-14-2005, 06:18 PM
For some strange reason, on my board it does hide the forum from forumhome, only with my chunk of code. And I don't really understand why wouldn't it work on yours... What version of vB do you have?

kall
04-14-2005, 11:05 PM
For some strange reason, on my board it does hide the forum from forumhome, only with my chunk of code. And I don't really understand why wouldn't it work on yours... What version of vB do you have?
3.0.7..

It doesn't hide subforums without the bit I added.

What depth of subforums are you displaying?

akanevsky
04-14-2005, 11:42 PM
Umm... What exactly do you mean by "sub"forums?
The way I did it, it hides every forum starting from the one your specified.

On my board, there is only one depth level.

akanevsky
04-14-2005, 11:48 PM
Oh! Now I understand what you are talking about! And what the code is for, too. Thanks. I'll add that.

akanevsky
04-14-2005, 11:58 PM
Manual has been updated once more :) Thanks, kall.

kall
04-15-2005, 12:04 AM
Manual has been updated once more :) Thanks, kall.
Did you catch the search.php error that causes each forum to show up twice if not in the excluded array? ;)

In the install file, -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ADD AFTER
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if (!in_array($forumid, explode(',', $bbuserinfo['excludeforumids'])))
{
eval('$searchforumbits .= "' . fetch_template('option') . '";');
}
Should be:

FIND

eval('$searchforumbits .= "' . fetch_template('option') . '";');

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
REPLACE WITH
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if (!in_array($forumid, explode(',', $bbuserinfo['excludeforumids'])))
{
eval('$searchforumbits .= "' . fetch_template('option') . '";');
}

As far as I can see, logically, the way you had it, it said: "If the forum is not in the excluded list, and the member has permission to see it, show it in the list of available forums to search. Then, If the member has permission to see it, show it in the list of available forums to search."

The way I have it, it is saying ONLY "If the forum is not in the excluded list, and the member has permission to see it, show it in the list of available forums to search."

akanevsky
04-15-2005, 12:43 AM
lol. yeah you are right :)))) Idk, I was probably rushing through the code.

akanevsky
04-15-2005, 12:46 AM
Actually... I only see one instance of that eval in my search.php
Are you sure you did everything right?

akanevsky
04-15-2005, 12:50 AM
Nevermind. The thing is, I have modded my file, but forgot the fact that the line was originally there :)

kall
04-15-2005, 07:04 AM
Nevermind. The thing is, I have modded my file, but forgot the fact that the line was originally there :)
All good man, I am happy I was able to help squash these little bug. :)

Cyricx
04-15-2005, 11:45 AM
Very very nice, I'll have to test this one out. I do something with the $hidden_forums array right now, but this is much cleaner.

I wonder how one could go about making a small link to disable a forums display...

Then people could just click the link for the forums they want to hide while viewing forumhome.

Aurous
04-15-2005, 10:47 PM
Any chance of having a multiple check-box with all forums listed? So users can conveniently select the forums they want to hide? That will really complete this hack.

Anyways, good work.

akanevsky
04-15-2005, 11:21 PM
I have a better idea. How about.. hmm...
Cyrixc - good idea. How about making a link which would hide the forum, and then... Make a link which would show aLL the forums, but the hidden ones would have UNHIDE link on them :) Hehe. How about that?

weaver
04-16-2005, 10:48 PM
Any chance of having a multiple check-box with all forums listed? So users can conveniently select the forums they want to hide? That will really complete this hack.

Anyways, good work.

I have a better idea. How about.. hmm...
Cyrixc - good idea. How about making a link which would hide the forum, and then... Make a link which would show aLL the forums, but the hidden ones would have UNHIDE link on them :) Hehe. How about that?

Excellent ideas. I'd definitely install if either of these ideas is included. But for now I'm going to wait. I know my members too well and the current method would be too confusing for them. Great hack though. :)

akanevsky
04-17-2005, 02:39 PM
UPDATED, YAY!
NOW THERE ARE SCREENSHOTS, YAY! ^^

To upgrade:
- Void any template changes you made in previous version
- Void any phrases you created in previous version
- Void changes made in profile.php
- Void changes made in functions_forumslist.php

- Make new template changes
- Add new phrases
- Make changes in index.php
- Make new changes in functions_forumslist.php

Lionel
04-17-2005, 04:11 PM
Look at screenshot to see what is happening to my subforums. All the names disappeared on forumhome.

akanevsky
04-17-2005, 04:51 PM
Make sure you did the forumhome_subforumbit_post template right.
If you think you did, post its contents here.

akanevsky
04-17-2005, 04:57 PM
It seems like you have some hack installed there. Probably the "forum names in columns"... Anyways, post the template here. Because it might be in conflict w/ that other hack.

Lionel
04-17-2005, 05:01 PM
here are the contents

<if condition="$_REQUEST['e'] == 1 AND $bbuserinfo[userid]">
<input type="checkbox" name="showhideforums[]" value="$forum[forumid]" ${showhideforums_checked[$forum[forumid]]} />
<else />
<img class="inlineimg" src="$stylevar[imgdir_statusicon]/subforum<if condition="$forum['postanon']!='0'">anon</if>_$forum[statusicon].gif" alt="" /> <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><span class="smallfont">$forum[title]</span></a></if>

Lionel
04-17-2005, 05:02 PM
Looks like I closed the conditional too far.

That was it....

Beautiful Hack!!!!!

akanevsky
04-17-2005, 05:05 PM
Yes. Fix it like this :):

<if condition="$_REQUEST['e'] == 1 AND $bbuserinfo[userid]">
<input type="checkbox" name="showhideforums[]" value="$forum[forumid]" ${showhideforums_checked[$forum[forumid]]} />
<else />
<img class="inlineimg" src="$stylevar[imgdir_statusicon]/subforum<if condition="$forum['postanon']!='0'">anon</if>_$forum[statusicon].gif" alt="" /></if> <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><span class="smallfont">$forum[title]</span></a>

And thanks :)

Lionel
04-17-2005, 05:09 PM
I also had to add it to 'forumhome_forumbit_level1_post'

akanevsky
04-17-2005, 05:11 PM
Why would you add it to forumhome_forumbit_level1_post?

akanevsky
04-17-2005, 05:16 PM
Uhm. Yeah. Now I see why. Is there anywhere I can read about which one of those four templates affect the forum in each case?

Lionel
04-17-2005, 05:18 PM
What would you like?

Lionel
04-17-2005, 05:25 PM
This is really cool. It removes entire subcategories if you select the parent above. When you first came out with the hack, it did not make sense to me to ask users to jot down forums numbers on a piece of paper so they could input them in control panel. Now it is 100% perfect. Thank you for improving it.

akanevsky
04-17-2005, 05:29 PM
Nevermind. Also do that change for forumhome_forumbit_level2_nopost.
Thanks for pointing that out, I'll update the archive.

akanevsky
04-17-2005, 05:31 PM
Lionel. As it states in the description, it does hide the entire category, however it will still be present in search facility. You need to check EVERY forum you want to hide from search facility manually :)

akanevsky
04-17-2005, 05:39 PM
Update: v1.05

To update, simply apply changes to the following templates:
forumhome_forumbit_level1_post
forumhome_forumbit_level2_nopost
(of course, use the manual to find out what changes to make :))

Cyricx
04-18-2005, 04:28 PM
That'd be awesome Visor. :)

I use some simliar code on my site, but nothing near this precise or clean :)

It hides then by groups rather then individually with a link to turn them all on again.

It would certainly make this hack more "dummy proof" for the users that aren't too computer minded :)

Niceboy
04-18-2005, 04:39 PM
That'd be awesome Visor. :)

I use some simliar code on my site, but nothing near this precise or clean :)

It hides then by groups rather then individually with a link to turn them all on again.

It would certainly make this hack more "dummy proof" for the users that aren't too computer minded :)
Well i was before searching for this hack but later i f ind this do not need any hack u can done this in the Custom Profile by add a new Profile and new code that is going to be add in the profile member can go to the profile and Disbled The forum is going to be Edit .. i use this for the Adult forum so really no need hack or anything it is olny Template Modify

Thankyou :)

akanevsky
04-18-2005, 05:52 PM
Stop flooding please.

Phalynx
04-19-2005, 03:04 PM
Really nice Hack. It works, but I had to change 2 things:

Forum is named forum.php not index.php:
<if condition="$_REQUEST['e'] == 1 AND $bbuserinfo[userid]">
&nbsp; &nbsp;
<a href="forum.php?$session[sessionurl]e=0">$vbphrase[showhideforums_turnoff]</a></if>
<if condition="$_REQUEST['e'] != 1 AND $bbuserinfo[userid]">
&nbsp; &nbsp;
<a href="forum.php?$session[sessionurl]e=1">$vbphrase[showhideforums_turnon]</a>
</if>

After updating, go back to forumhome, instead of editmode again:
In forum.php (index.php) I added
header("Location: forum.php");

after

$DB_site->query("UPDATE user SET excludeforumids = '" . $bbuserinfo['excludeforumids'] . "' WHERE userid = '" . $bbuserinfo['userid'] . "' LIMIT 1");

akanevsky
04-19-2005, 05:53 PM
Really nice Hack.
Thank you :)

Forum is named forum.php not index.php

I assume that any hack should be made to work on default configuration. If one is advanced enough to change things like that (like you), he will be able to fix it :)

After updating, go back to forumhome, instead of editmode again:
In forum.php (index.php) I added
To tell you the truth, I made it go to the edit mode again on purpose. If you wish to fix it, there is no need for additional PHP code. What you have to do is change

<form method="post">
<input type="hidden" name="do" value="showhideforums_update" />

to


<form method="post" action="index.php">
<input type="hidden" name="do" value="showhideforums_update" />

In the hack code :) That's it. I do not see the reason, however, to make the user exit the mode just like that... Maybe he wants to make sure he marked everything right?

Niceboy
04-19-2005, 08:19 PM
Edit : [Removed]

akanevsky
04-19-2005, 09:09 PM
Phalynx, Niceboy
What does the content of your posts have to do with my hack?

scottct1
04-22-2005, 01:18 PM
I installed this and my users love it, howevr I have noticed what appears to be a bug, my users are reporting they can only hide 27 forums, any more then that and it does not work correctly. Is there any ways we can bump the number up to 50?

(I have a LOT of forums) :)

Scott

akanevsky
04-22-2005, 05:51 PM
Try increasing length of the DB field.

scottct1
04-23-2005, 05:44 PM
And how would I go about doing that? I am not a programmer which is why I am using your hack. :) And a great hack it is!

akanevsky
04-24-2005, 11:36 AM
Use phpmyadmin which is in your cpanel. :)

artonex
04-24-2005, 04:02 PM
This is very nice i will install it soon :)

scottct1
04-24-2005, 04:59 PM
I know that. :)

But what do I change ALTER TABLE `user` ADD `excludeforumids` VARCHAR( 100 ) NOT NULL ; to?

And is there any way to modify the table without dropping it and readding it which would force the users to select their forums again.

Thanks!

Lionel
04-24-2005, 05:05 PM
That is the only field that you added in the hack. This is where you place the forums numbers, so that field is quickly filled up (1 2 300 etc...) with characters, so making that field 250 will give you more space.

akanevsky
04-24-2005, 05:35 PM
ALTER TABLE `user` CHANGE `excludeforumids` `excludeforumids` VARCHAR( 255 ) NOT NULL

vakvak
04-30-2005, 09:07 PM
Dark Visor thank:)

scottct1
06-14-2005, 02:12 PM
Anyone know if this worked on 3.5?

My users LOVE this hack and it is a must have for my site. :)

I will not upgrade to 3.5 without it. :D

akanevsky
06-20-2005, 05:47 PM
It will probably NOT work on 3.5.
However, if 3.5 will be successful and many users will upgrade, I might write a remake of this hack...

maharajah
07-19-2005, 04:37 AM
When i click on the button to save, nothing happens.
Am i missing something ?

.

akanevsky
07-19-2005, 02:48 PM
What do you mean - nothing happens? Can you be more specific?

It should just refresh the page, while updating your profile. If you then go back to homepage, you will not see the forums you hid..

sross
07-25-2005, 10:16 AM
Hi this hack is a real life saver! I have installed it but one main problem. Have a look:

http://www.apug.org/forums/

As you can see i have 3 languages, and each language forum contains all of the forums for that language -so basically most of my forums are subforums. How hard would it be to modify this hack so that I can use it with subforums? I am willing to pay for your services and need it as soon as possible, can you PM me? THANKS!

akanevsky
07-25-2005, 11:07 AM
I'll look into it..

akanevsky
07-25-2005, 12:37 PM
VERSION 1.06!!!

[+] Now you can also enter visibility edit mode in subforums. That is useful when there are many forum levels and thus not all of them are accessible from forumhome.
[+] Edit mode is now saved into cookie, so until you either exit from that mode or close your browser, your state will be saved between pages :)

HOW TO UPDATE:
1. Download 1.06 package.
2. Redo changes for index.php
3. Do new changes involving forumdisplay.php (the file was not used in prev. version)
4. Redo all template changes using the new manual
5. Done.

sross
07-25-2005, 09:12 PM
This is great! I am going to install it today and send you some paypal :) :) :)

Thanks!

sross
07-26-2005, 01:02 AM
ok I installed it as per instructions. Before the upgrade it was working, now after upgrading I do not have any forum errors and i have the check box visible on the subforums, but the "Save Hidden Forum State" button doesn't seem to do anything at all, it's just unresponsive. Any idea what I've done wrong? thanks!

akanevsky
07-26-2005, 01:09 AM
Can I please take a look at it on your site? (Gimme URL please)...

akanevsky
07-26-2005, 12:22 PM
1.07 :: BUGFIX RELEASE

To upgrade, simply redo steps that have to do with index.php and forumdisplay.php.
1 minute upgrade =)

sross
07-26-2005, 08:55 PM
works perfectly now! :)

akanevsky
07-26-2005, 09:15 PM
Good :)

sross
07-27-2005, 10:34 AM
I am curious, is there a way to see how many people are using it, or is this all specific to their accounts. I just thought it would be cool to know if 50 people are ignoring a particular forum or not.. Maybe I can see this info in phpmyadmin? thanks :)

akanevsky
07-27-2005, 11:09 AM
The data for this hack is stored in "excludeforumids" column of the "user" table.
It wouldn't be easy to read it for a human, though, because it is stored as a simple list of IDs. Therefore there is no way to find out how many people are ignoring a particular forum.

scottct1
09-29-2005, 05:10 PM
Please port this to Vb3.5 ASAP. :)

And also post your Paypal information.

This should be STANDARD in Vbulletin! :D

Thanks for the great hack!

jilly
11-07-2005, 03:34 AM
I have installed this, and when I go into edit mode, I can see the checkbox by the category names, but not the individual forums.

Also, when I go into subforums, it will show the checkbox by the subforums, but not the list of regular forums beloe a category

jilly
11-07-2005, 03:40 AM
Also I am getting this error message
Parse error: parse error, unexpected T_LOGICAL_AND in /home2/jilly/public_html/forums/search.php on line 2180

I know why it happened - at this part:

---------------------------
AND AFTER
--------------------------------------------------------------------------------------------------------------------------

AND visible = 1

--------------------------------------------------------------------------------------------------------------------------
ADD
--------------------------------------------------------------------------------------------------------------------------

AND thread.forumid NOT IN (".$bbuserinfo['excludeforumids'].")

I didn't know where to put the "ADD" ones - so I just put them right behind the previous sections

akanevsky
11-07-2005, 06:12 PM
Time to upgrade to 3.5.x, people. Sorry, but this hack is not supported anymore (unlike its 3.5.x port).

all I can say is:
This hack works perfectly on vBulletin 3.0.7-3.0.9. If anything doesn't work as expected, it is due YOUR error. Check over the steps and make sure you did everything correctly.