Created
April 2, 2010 01:04
-
-
Save bangpound/352602 to your computer and use it in GitHub Desktop.
openidonly_link_alter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implementation of hook_link_alter(). | |
* | |
* When comment links are displayed, the user/register link is displayed when | |
* registrations are permitted. Here the $conf global is brought into context, | |
* the setting is captured in a local variable and the loaded value in $conf | |
* is changed to 0. This tricks theme('comment_post_forbidden') into displaying | |
* only a login link. The original value is returned to the global $conf array. | |
* The value in the database is never changed. | |
*/ | |
function openidonly_link_alter(&$links, $node) { | |
if (!empty($links['comment_forbidden'])) { | |
global $conf; | |
$user_register = variable_get('user_register', 1); | |
$conf['user_register'] = 0; | |
$links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node); | |
$conf['user_register'] = $user_register; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment