Question not related to register user. Only "0" appear as username.

Hi There,
here is my issue. Actually 2 problems. I have Q&A plugin on one website in MU network. When user come to /questions/ask/ - all looks good and he type in question and pick category. Than user is sent to registration page. Now user go through registration process (I used your plugin to remove email verification and give password instantly) and he is sent page where he can login or go to home (default page after registering account). Unfortunately after login, user is sent to homepage and he totally don't have a clue is his question posted. That is problem 1. After user register for account, I think he MUST be sent to page of the category where his question is submitted, so he can see that question is there and it's all fine. How I do this?
Problem 2. Question is submitted. But instead of linking it to user account, it just have "0" as user name and it's not linked to new account created by user. What could be the issue?
I have to note I added new role "BMember" and when user join website is he assign to this role. I also add to this role capabilities to view, edit, delete, add questions in your Q&A plugin. Maybe this new role cause issues? But I really prefer that when any user sign for the website he get BMember role and not QA Visitor or some other role.

Please let me know solution on above. I am bit of novice, so if I need to edit any file, please let me know file name and line of code. Just finding my way into WP and MU.

Thanks a lot.
Regards
Dean

  • Timothy Bowers

    Hey there.

    Q1. As noted this isn't the current behaviour. You could use the Login Redirect plugin here though to redirect to the /questions/ permalink thus he will see the last posted questions then.

    https://premium.wpmudev.org/project/login-redirect/

    Q2. I just tested this and the question was assigned to the new account correctly at first. Perhaps the submission happened and then the signup was straight afterwards? Maybe navigated elsewhere first?

    Just wondering if the session timed out and the Q was then not given an owner.

    This was in Membership registration (one of our plugins)

    But I seem to have issues with it assigning when that plugin was deactivated and just using WP or BuddyPress.

    I'll mention this to our developer to see if he can recreate the issue too.

    Thanks.

  • deanl

    Thanks for reply, Timothy.

    For 1 - yes, that plugin sounds right. i'll try it.

    2 - yes, signup is straight after submission. do you think this could be the cause? How could i setup "Maybe navigated elsewhere first" ? Process could be perfect with - user post question - i send him to page explaining that he'll now need to register - then send him to registration process. But I don't know how to add this extra step. Sorry, I am bit novice, so if I need to change code let me know which file and line number, etc. Still bit noob with customizing WP. Thanks

    Cheers
    Dean

  • deanl

    Hi Timothy,

    Thanks for your help. I tried and still didn't resolve this issue. It would be great to get feedback from developers, as per now this is my only outstanding/unresolved issue. If we figure out how to fix this and have user connected to his first question - that would be excellent.

    Just to report - this happen only when user ask question, than register. When previously register user ask question, there is no any issue. Question is linked to his profile. Thanks & Cheers
    Dean

  • Hakan

    Hi,

    A claimed question or answer (one having no assigned author) is *only* assigned to the author if and after he logs in. Please see this question assigned to me after I logged in:
    http://bnbcommunity.com/answers/questions/test-question-2/

    During the time period question is submitted and user logs in, author is unknown and it stays as undefined (or 0).

    If a visitor submits a question and he is required to register and log in, he is expected to log in. Is it wrong?

    So this is the normal and intended behavior.

    If you want to prevent displaying such questions publicly, set "immediately publish questions" capability as:
    - Unchecked for QA visitor
    - Checked for your BMember role

    Also you may want to add a note somewhere something like: "Please log in to publish and claim the question you have submitted".

    You can use a special BMember role. There is no problem about this.

    I have to note another rule here: Only the last submitted question or answer can be claimed. Thus, if visitor submits one thousand questions but refuses to log in or cannot log in (e.g. if it is a bot), none of them will have an author. If he decides to log in at last, only his last submitted question will be assigned to him. You can think this as another prevention against spammers, because with the above settings, only one question will be published out of thousand.

    Cheers,
    Hakan

  • deanl

    Hi Hakan.

    Thank you for response and all details. Everything sounds perfectly logic and easy. But I already hit the wall. Not sure what I am doing wrong?

    At the start you said, that I should be able to type in question, than login to website, than question will be assigned to me. (What sounds perfectly logic). I just tried the same and didn't work for me. Not logged into the website. Typed in question, join as "Hektor", log in and - here is the screenshot of "Hektor" being logged in and looking at his own question marked with "0" or unknown author. Do I missing something? Maybe I missed some step?

    Regards,
    Dean

  • Hakan

    That is probably because several other plugins are hooking in "wp_login" filter. Q&A is staying back in the priority.

    Please open this file: wp-content/plugins/qa/core/edit.php and find this around line 18:

    add_action( 'wp_login', array( &$this, 'wp_login' ) );

    Change it as:

    add_action( 'wp_login', array( &$this, 'wp_login' ), 1 );

    Let's see if it will give the result you ask.

    Cheers,
    Hakan

  • deanl

    Yes, Hakan, that works. When I logout and then login question was assigned to Peter.
    This small "0" under his name is actually his reputation score? Is that correct?

    Still I can't request from users to logout and login. But I hope you now know what could be issue and how can be resolved?

    After login, I was not redirected to my question. After login I was directed to default WP profile page. But when I clicked link to all questions, I could see that my last question was assigned to me (Peter in this case).

  • Hakan

    Q&A sends user to the default registration/login page if you set it so. Membership overrides default registrations.

    So if you had used Q&A without Membership, all of these processes would be working seamlessly. I mean user submits a question, he registers, he is then redirected to the question he submitted and question is assigned to him.

    But with Membership, this process does not work like this, because we don't have a "Membership - Q&A integration". By the way, it will not work with any other membership plugin that modifies registration process.

    We never needed something like that, because it was never asked, and for a membership website letting anonymous or unclaimed questions to be asked does not seem quite normal to me.

    As you see this is not a bug of Q&A or Membership, but how this process is synchronized when the plugins are used with these settings.

    So I suggest:
    - Require users to register to your website *before* asking a question. Registration should already be required for them for their questions to be published and assigned to them. So what would be the problem if they register first and ask the question later?

    OR

    - I will note this as a feature request for "Membership-Q&A Integration", but this may take some time, or not realized at all as we evaluate requests depending on how many members request them.

    I am sorry, but this is the most I can do.

    Cheers,
    Hakan

  • deanl

    Hi Hakan,

    Thank you for reply, I appreciate your time to look into this issue.

    Unfortunately, looks like there is no simple and elegant way to sort this issue right now, so i appreciate if this is added to feature request.

    - By the way I am not using Membership, but rather WPMUDev plugin called "Remove Email Verification". That is the plugin that changing registration process and looks like clashing with Q&A.

    - Re "membership website letting anonymous or unclaimed questions to be asked does not seem quite normal to me." Anonymous users won't ask question. That was never a goal. The goal is to allow anonymous user to place question and then - before he can publish it - he is asked to join. And he must join in order to publish his question. So anonymous will never be able to publish his question. But they have chance to start typing question, what makes them much more engaging into website. which can bring more registrations and more users. Exactly as stated on Q&A page "Anonymous visitors can also post question and answers, which will be published after they have successfully logged in. This lowers the barrier to entry, helping your community to grow faster." (https://premium.wpmudev.org/project/qa-wordpress-questions-and-answers-plugin/)

    I am bit disappointed, on the level that this WPMUDev plugins do NOT work together properly, when actually one of the selling points of WPMUDev was that all plugins work together and are tested by WPMUDev team. That is the reason I actually sign for WPMUDev - after reading this statement, I sad, great I can sue all this plugins and they will perfectly work together. What come up not to be the case. But that is something I will discuss with James, as I think it's up to him to follow up on this WPMUDev promise :slight_smile: For sure not something that you can make sure Hakan. I am very thankful for all your help regards this issue, I think you really tried the best.

    For now I'll have to switch "Remove Email Verification" or ask users to register first. Not desired or best solution, but I guess it's only I have :slight_frown:

    Regards

    Dean

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.