• Hi all,
    I have installed 1.2 and I am evaluating it for the moment. There is one thing that is bugging me, although it might also be something that I have simply missed:
    I don’t want non-registered users to be allowed to post comments. Is there any way of getting that done? I don’t want to have to administer every comment written but I would like users to register and log in before they can enter their comments.
    As I said, I am very new to WordPress and it might just be that I have missed this feature, if it exists…
    Thanks,
    /Dave

Viewing 6 replies - 1 through 6 (of 6 total)
  • You can restrict comments to registered users by editing index.php. Find the line:
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    and replace it with the following:
    <?php if ($user_level > 0)
    comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'));
    else
    echo ("Please register in order to comment!"); ?>

    Change the contents of the last echo (or withhold it altogether) to change what non-registered users see.

    Thread Starter purrkur

    (@purrkur)

    Thanks Skippy. That was what I was looking for. I am very surprised that this isn’t a part of the standard package…

    Thread Starter purrkur

    (@purrkur)

    Hmmm. I implemented the change from above written by Skippy but it is not really working as I would like it to.
    Here is what it does: A user has to register, log in and have their user level set above zero in order to post. That is exactly what I would like!
    The problem: Users with level set above zero are also able to post articles, even though I have set “Any registered member can publish articles ” to “unset”. What I would like is to have visitors post comments but not post articles. Is that possible? It seems that level 1 immediately allows users to post own articles which is a shame….

    wp-admin\menu.php controls what user levels are allowed to do what activities on your blog. Edit it to change the minimum user level required to post:
    <ul id="adminmenu">
    <?php
    // This array constructs the admin menu bar.
    //
    // Menu item name
    // The minimum level the user needs to access the item: between 0 and 10
    // The URL of the item's file
    $menu = array(
    array(__('Write'), 1, 'post.php'),
    array(__('Edit'), 1, 'edit.php'),
    array(__('Categories'), 3, 'categories.php'),
    array(__('Links'), 5, 'link-manager.php'),
    array(__('Users'), 3, 'users.php'),
    array(__('Options'), 6, 'options-general.php'),
    array(__('Plugins'), 8, 'plugins.php'),
    array(__('Templates'), 4, 'templates.php'),
    array(__('Upload'), get_settings('fileupload_minlevel'), 'upload.php'),
    array(__('Profile'), 0, 'profile.php')
    );

    Note that depending on how many levels of users you want to have, you may need to change several items in wp-admin\menu.php.

    Thread Starter purrkur

    (@purrkur)

    Thanks for your help!

    To skippy:
    Try this on WP 1.2 :
    ?? open menu.php and state ‘write’ level at 3.
    ?? create a ficticious user with (whatever) username and password; the new user will be placed at level 0 by the system. Logoff.
    ?? Login using the Admin user and password, and change the (whatever) new user level to 1. Logoff.
    ?? Login again with the (whatever) new user you’ve just created. The user level is standing at 1 now. You will see two menu links at the top of the screen: ‘Profile’ and ‘View Site’. Everything ok until now. Click on ‘View site’ and you’ll see the site on the same top screen. Look up for the ‘Login’ link on the weblog and click on it. You’ll be transported again to the ‘Login site’ BUT, this time, the ‘Write’ menu will appear at the screen, for a level one user, inspite of the fact that the ‘menu.php’ Write level was stated at 3.
    Am I wrong or there’s a security bug here?
    Anyone help? Thks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Users and comments’ is closed to new replies.