MilenKo Posted August 8, 2017 Share Posted August 8, 2017 Hmm, that is weird as it does not work on two different computers, but will try it on another PC to move the profile and see. I am checking if there are any caches right now but by default I keep them disabled so that should not be the issue. P.S. I ran the bd($input->post->cite) in TracyDebugger and got an error: 500: Internal Server Error See the browser dev console for the actual error It seems like a strange server issue, however if I try to call $user->name somewhere else within the same template, I get the proper value (in my case test). Tried switching up the user and it is always the correct one. Thinking to redo the whole comment form using your earlier example and see if that would help. Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2017 Share Posted August 8, 2017 I just added: bd($input->post->cite); to the: if ($input->post->submit) { block and it output the name correctly. Where are you putting it? Did you check the browser dev console for info on the 500 error? Link to comment Share on other sites More sharing options...
MilenKo Posted August 8, 2017 Share Posted August 8, 2017 Well I put it to the console which I guess was not the smartest thing to do. That is why I get the 500 error... I will need to read more about the Tracy... Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2017 Share Posted August 8, 2017 Just now, MilenKo said: Well I put it to the console which I guess was not the smartest thing to do. That is why I get the 500 error... I will need to read more about the Tracy... The console is awesome, but it won't have access to $input->post->cite because you haven't submitted the form to the console. That said, I also don't know why you are getting a 500 error. If I run that bd call in the console it just returns null as you would expect because it isn't set. Anymore details on that 500 error? Do other bd calls in the console work ok, eg: bd('test'); Link to comment Share on other sites More sharing options...
MilenKo Posted August 8, 2017 Share Posted August 8, 2017 Well it appears like any bd i test shows similar error. I will try to remove Tracy and have it reinstalled to see what could be causing the issue (if I am even going to the right direction, however as far as it works with you, but not with me, that has to do something either with the server or pc setup) but not with the code. Link to comment Share on other sites More sharing options...
fbg13 Posted August 8, 2017 Share Posted August 8, 2017 Did you add a semicolon after the statement? 1 Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2017 Share Posted August 8, 2017 Well in that case, the error is because you didn't put a semi-colon at the end of your bd call Link to comment Share on other sites More sharing options...
MilenKo Posted August 8, 2017 Share Posted August 8, 2017 Oops I did it again... So yes, it was the semicolon which I forgot to put thinking the PC would know my intentions. So back to the point, after adding the semicolon, bd($input->post->cite); returns empty result in 2ms. Unfortunately that does not point me to the reason why it is not populating only in the form but everywhere else in the template it works fine (to call $user->name). Calling bd($user->name) returned empty result as well which should be good but... Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2017 Share Posted August 8, 2017 @MilenKo - if you want and it's online somewhere, I can take a look if you PM me login details. 1 Link to comment Share on other sites More sharing options...
MilenKo Posted August 8, 2017 Share Posted August 8, 2017 @adrian I will move it to my online host in a few hours and will share the login details. Thanks in advance to you and @fbg13 again for spotting my silly error. 1 Link to comment Share on other sites More sharing options...
MilenKo Posted August 15, 2017 Share Posted August 15, 2017 @adrian After a short break and becoming a father for 4th time, I had a few minutes to redo the comments form and it seems to work fine now. The only thing I could think of messing around would be to have some browser cache for the logged on user form. Today I echoed $user->name above the contact form and noticed that I had to refresh a few times before the name of the logged on user shows correctly. As far as I did not yet activate the cache, I would expect it not to happen but will see what can be done. So for now the comments form is working as expected and I can close that chapter as well. I am thinking on adding some email verification if allowing non-registered users to post comments, but that is beyond this topic. So again, thank you very much for the help and sharing. 2 Link to comment Share on other sites More sharing options...
MilenKo Posted August 17, 2017 Share Posted August 17, 2017 I can confirm that using Incognito mode in Chrome or private in any other browser did the trick and as soon as I am logged-in, the browser shows the value of $user->name correctly. Same thing applies for the comments posted from any account or just as a guest if I unhide the name, email, web etc. It would be interesting to see how to style my form using the default rendering method for the comments as I can apply the styles if I am building a site from scratch however using a premade theme is a bit different story and I should digg deeper into the CSS to make the necessary adjustments to the styles of the comment field to match the design. Anyway it is a learning process and every week I am eager to read about the new stuff and thinking how can I use that. I am doing in paralel a few projects so once I establish the proper way to achieve this and that, the rest would be just to make it work for the specific frontend. Thank you all for the achievements, as i won't make it this far without the shared ideas, advices, best practices and so forth. You are the ones that make PW growing in popularity! Link to comment Share on other sites More sharing options...
JheymanMejia Posted October 6, 2019 Share Posted October 6, 2019 Hello everyone. I apologize if this is not the way to use the site. I need some guidance to do what MilenKo user has with the comments. I would like to get in touch to clarify certain doubts. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now