-2

I am running a wordpress page and looking for a way to implement a forum (bbPress) on one of my pages. I only want registered users (they are added by the admin manually) to post to the forum. I am able to set up the forum but I am not able to create a topic or post anything since You must be logged in to create new topics.

The questions that I now have are:

  1. How can I implement the functionality for the page to ask the user to log in if no user is currently logged in? And
  2. how does a user stays logged in? If I log myself in via wp-login.php

    • Going to myurl.com/wp-login.php
    • Entering my username and password and pressing Log In (the site then redirects me to my index page)

    the site apparently does not recognize me as a user. I tested that by putting this

    <?php
    if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    }
    ?>
    

    on my index page (index.php) and it always echoed Welcome, visitor!

The Theme that I am using is called Peekaboo and the Plugins I am using are

  • bbPress,
  • Contact Form 7 and
  • Maintenance.

Thanks in advance for any help/suggestion/link etc.

  • You need to provide more information about which forum have you implemented, what do you mean with "If I log myself in via wp-login.php the site apparently does not recognize me as a user" and so on. Your question, as it is, is very difficult to answer and very board. – cybmeta Nov 13 '14 at 21:09
  • @cybmeta I elaborated my question a little. I am sorry that not the most relevant information is in the question but I am new to wordpress^^ – Woltan Nov 14 '14 at 6:13
  • The forum settings in bbPress allow to set private forums only logged in registered users. See getting started with bbPress. You should ask in the bbPress support forums. It is more appropiate for your question. – cybmeta Nov 14 '14 at 8:47
  • @cybmeta I don't think it is a bbPress issue since the only reason I cannot use the forum is due to the fact that my site doesn't recognize me as being logged in. – Woltan Nov 14 '14 at 8:55
  • So, you can not log in your site? – cybmeta Nov 14 '14 at 9:00
0

The error you received seems to be associated with the zipped plugin. May be when you downloaded the "sidebar login" plugin, it got corrupted. Not sure what caused the problem but it is working absolutely fantastic on my site. Would suggest you to download it from WordPress Plugins directory and then try uploading to your server again.Get more details at https://wordpress.org/support/topic/front-end-user-registration-login-profile-posting

  • I disabled all the plugins and installed them again. It appears, that it is not a plugin malfunction. Maybe the theme? I have absolutely no clue anymore... – Woltan Nov 18 '14 at 19:01
  • To check if it's your theme, just switch to a WP theme like 2012 – shanebp Nov 19 '14 at 19:27
0
+50

Wordpress is a PHP program. This means that it starts up when it receives a HTTP request from the internet, it processes the request, sends the reply, and then shuts down. The system doesn't keep track of who is "logged in". The individual user keeps their credentials [username/password] in a cookie on their local browser. The cookie gets sent to the server, Wordpress decides if it likes the credentials, and then replies with content suitable to a "logged in" user, or for a user who is not logged in. Your code, which you just inserted into the index.php, isn't being properly "hooked" ['hook' is a term you need to look up] into Wordpress. It's outside the normal process of how Wordpress works. You should put code like this somewhere in a theme or a plugin, and then properly hook into an action that comes after users are logged in. Here is the reference: http://codex.wordpress.org/Plugin_API/Action_Reference.

Next time, try to focus your question to be one, specific, narrow question. You should ask multiple, smaller questions instead of one large one. Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.