Closed (fixed)
Project:
Forum Access
Version:
5.x-1.7
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2008 at 22:21 UTC
Updated:
6 Mar 2008 at 20:15 UTC
I have installed forum_access and it works exactly as advertised. Nice work!
My question is... I would like to show links to all of the forums on the site to all users, even if the forum is private. This would work as sort of a teaser, so when the user clicks to a private forum, they are sent to a page that asks them to login or register. I don't want them to be able to actually view any of the forum content, but I would like to list the forum name and stats on the /forum page.
I'm sure this is probably a really stupid newbie question, but I cannot seem to find the answer on my own.
Thanks for your help!
Comments
Comment #1
salvisThanks, the praise is due to merlinofchaos.
No, not a stupid question at all. FA doesn't support what you'd like to do. The Drupal way is to hide what's not accessible.
You could hack FA to not pass the query that retrieves the forum list through db_rewrite_sql(). This would give you all forums, but it would give the user an access denied message when s/he tries to access a private forum. To redirect to a different page, you'd have to compare the lists you get with and without db_rewrite_sql and change the links accordingly.
Comment #2
jorbot commentedExcellent!
All I did was comment out all the lines inside forum_access_db_rewrite_sql() and now all the forum links show up in the list for all users. Yes, I get an access denied page when trying to click them (if the user doesn't have access), but I'll write a friendly message that describes why.
Thanks for the tip!
Comment #3
darumaki commentedCan you tell me how you did this ? Im trying to do the same, is this inside forum_access_module ?
Update I think I found it but how do you comment these out ?
function forum_access_db_rewrite_sql($query, $primary_table, $primary_field, $args)Comment #4
jorbot commentedPut two forward slashes at the beginning of each line inside the forum_access_db_rewrite_sql() function.
Like this...
Note: I split the $sql['join'] string into 3 lines so it would fit in this box without wrapping oddly.
Essentially it just creates an empty function. You wouldn't want to comment out the function name because that would cause an error when the function is called by the forum_access module.