Changeset 1109

Show
Ignore:
Timestamp:
05/21/08 19:09:39 (6 months ago)
Author:
so1o
Message:

added failsafe in case the anon user is not created.

show the login message only if on forum page and user cannot post topics

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-anonymous-posting/trunk/bb-anonymous-posting.php

    r1102 r1109  
    55Description: Allows anonymous users to add posts and topics 
    66Author: Aditya Naik 
    7 Version: 2.1 
     7Version: 2.2 
    88Author URI: http://www.adityanaik.com/ 
    99*/ 
     
    3333                'read' => true 
    3434        ); 
    35          
    3635        if (bb_get_option('bb_anon_write_topics') == 'Y') 
    3736                $perm_array['write_topics'] = true; 
     
    5352        if (!$bb_current_user) { 
    5453                $anon_id = bb_get_option('bb_anon_user_id'); 
     54                if (!$anon_id) { 
     55                        bb_anon_activate_plugin(); 
     56                        $anon_id = bb_get_option('bb_anon_user_id'); 
     57                } 
    5558                $bb_current_user = new BB_User($anon_id); 
    5659        } 
     
    6467        } 
    6568         
    66         if (!bb_current_user_can('write_topics')) { 
     69        if (is_forum() && bb_get_option('bb_anon_write_topics') != "Y") { 
    6770                echo '<p>'; 
    6871                printf(__('You must <a href="%s">log in</a> to post.'), attribute_escape( bb_get_option('uri') . 'bb-login.php' ));