Skip to main content
deleted 1 characters in body
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83

To control access top level forum containers, forum topics and forum content, you should use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content).

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck_accesscheck(){
  global $user;
  return $user->uid;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

To control access top level forum containers, forum topics and forum content, you should use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content).

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck(){
  global $user;
  return $user->uid;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

To control access top level forum containers, forum topics and forum content, you should use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content).

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _accesscheck(){
  global $user;
  return $user->uid;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

deleted 51 characters in body
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83

To control access top level forum containers, forum topics and forum content, you should use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content).

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck(){
  global $user;
  ifreturn ($user->uid) {
    return true;
  }
  return false;>uid;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

To control access top level forum containers, forum topics and forum content, you should use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content).

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck(){
  global $user;
  if ($user->uid) {
    return true;
  }
  return false;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

To control access top level forum containers, forum topics and forum content, you should use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content).

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck(){
  global $user;
  return $user->uid;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

deleted 237 characters in body
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83

To control access top level forum containers, forum topics and forum content, you mayshould use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content). Since it relies on two helper modules (ACL and Chain Menu Access API) you still need to install three modules, but the user interface is clean and intuitive.

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck(){
  global $user;
  if ($user->uid) {
    return true;
  }
  return false;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

To control access top level forum containers, forum topics and forum content, you may use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content). Since it relies on two helper modules (ACL and Chain Menu Access API) you still need to install three modules, but the user interface is clean and intuitive.

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck(){
  global $user;
  if ($user->uid) {
    return true;
  }
  return false;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below modules, enable and refresh cache, and the landing page shall be gone for anonymous.

To control access top level forum containers, forum topics and forum content, you should use the forum_access module (you mention it for blocking containers, but it can also be used to block access to forum topics and content).

However, after installing this and denying the anonymous user role access to forums, this user still has access to the forum landing page (he or she will see a message that it is necessary to log in to access forums).

If you also need to block access to the core forum landing page, you need to add a small custom module that uses hook_menu_alter to set up a custom callback function to check the user id. Since the anonymous user is assigned uid 0, you can use this to only grant users with a uid that is not 0 access to this menu item.

Here is all that is needed, stick this in noforumforanon.module:

/**
 * Implements hook_menu_alter.
 * Check access for forum menu item.
 */
function noforumforanon_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';
}

/**
 * Callback to disallow access for anonymous users.
 */
function _acccesscheck(){
  global $user;
  if ($user->uid) {
    return true;
  }
  return false;
}

And this in noforumforanon.info:

name = No Forum for Anonymous
description = Blocks anonymous from accessing the forum landing page.
package = Access control
core = 7.x

Put both files in a directory named noforumforanon below site/all/modules, enable and refresh cache, and the landing page shall be gone for anonymous.

clarified forum_access scope
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83
Loading
added 1 characters in body
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83
Loading
added 9 characters in body
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83
Loading
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83
Loading