HTML Logo by World Wide Web Consortium ( Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS. ocPortal 9 is superseded by Composr 10.

Head over to for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Login / Search

 [ Join | More ]
 Add topic 
#107476 (In Topic #20943)

Fan in training

Hi there! I have made a log-in page in front of my site using the block_side_personal_stats, but when I try to enter a wrong password, it redirects to a different log-in page instead. How can I edit the block_side_personal_stats, so that when someone enters a wrong password, they are redirected to the same page, and the block says "Sorry, you entered a wrong password" instead? Sorry if this seems like a shallow question, I'm not too good at coding. Thanks! :$
Back to the top
Item has a rating of 5 (Liked by Chris Graham)  

Community saint

I had to think about this one for a while. It's not something (at least not something that I am aware of) ocPortal can do out-of-the-box so there are no settings or simple tricks to make login failures behave in the way you want. It will take some custom programming with edits to the login script which may not be advisable to override, and it will take edits to a template file that may already be an overridden template (for Facebook login addon). Overriding the login script or other files that are already overridden can cause issues when applying ocPortal updates and upgrades that may cause logins to become broken until you re-apply your modifications to the new versions of the files. If you are interested in trying to tackle this, here is an outline of what it would take to make this work:

sources\blocks\side_personal_stats.php - Alter the block PHP file to look for a login_failure HTTP POST or GET variable. If the block finds that login_failure variable, then it can pass that on to the block template display a failure message.

themes\default\templates\BLOCK_SIDE_PERSONAL_STATS_NO.tpl - Add the error message to the block template (if the template exists in the templates_custom directory, you must also edit that one). Use some tempcode to check if a login failure has happened and display the proper error message as needed.

pages\modules\login.php - We will need to generate a login_failure variable and redirect back to the page that initiated the login. I believe that may all be accomplished in the login.php file. And more specific, probably the else portion of the main if/else clause of the login_after function. Replacing that entire else portion of code and changing it to execute the LOGIN_REDIRECT_SCREEN template with the necessary URL or POST variable should work.

I know it's a very general and undetailed outline and probably won't help you much if aren't familiar with PHP programming and the ocPortal framework. I'll add this to my todo list and may come back to it in the future. I'm a bit hesitant to do it, just because it won't be a set-it-and-forget-it type of modification. Any ocPortal or addon update or upgrade would need to be examined beforehand to be sure the changes outlined above won't break the logins. Perhaps this could be added to the ocPortal/Composr issue tracker so it can be added as a new feature that won't require 2nd or 3rd party maintenance to account for any major changes to the original version of the modified files.
Back to the top
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: