Have a Joomla user that is activated but not enabled. Therefore this user should not be able access restricted site pages. to login.
Actually this bit is working (user cannot see pages for registered users) but seems that the OnFail event is not triggering. Apppears that the OnSuccess is being triggered and it is limiting access - this is good but why is OnSuccess being triggered rather than OnFail.
I need to send user a messg explaining why he cannot see pages availabbe to registered users, but cannot send the messg. Also cannot set a debugger, and EventLoop does not trigger.
In Setup have tried various nesting combo's, eg see attached image
Thanks
HI hangbill,
As this is setup if the login fails the form will be re-loaded, if it succeeds then nothing happens. Is that what you intend?
Bob
PS I recommend not using the On Success boxes as they make understanding a little more complex, instead put the On Success actions after the 'check' action.
Check Security Question
+ On Success > empty
+ On Fail > Event Loop
Joomla! Login
+ On Success > empty
+ On Fail > Event Loop??
. . .
Will try your recommendations, thanks Greyhead.
Re my current setup, the user in Joomla backend is Activated = True and Enabled = False. The login does not fail because it redirects to the home page, no messg and no form reload.
Am trying to understand how CF interacts with Joomla's activated and enabled options in the User Manager. Apparently an activated status cannot be reversed, whereas enabled can be turned on and off. So it seems if activated = true then the login passes but gets turned off again if enabled = false. So this means no messg and no form reload, but redirect to home page works which leaves user in confused state because he thinks he has logged in and there is nothing to tell him otherwise
I will try you recommendation
Have setup as recommened, pic attached.
Now get the canned Joomla login denied messg, but no form reload and no CF messg. Also debugger not firing.
Must still be doing somethng wrong ...
Hi Hangbill,
The Event Loop action re-loads the form at that point so nothing after that will be run. That is why you don't see the message or the debugger output. You can add a system message before the Event Loop - that will be displayed on the next page load; and/or you can temporarily remove the Event Loop so that you can see the Debugger output.
Bob
Something wrong here ...
I understand there are 4 possible Joomla user statuses, set in User Manager (see pic)
Also see pic of current Login form setup.
Login as aa
Get a blank page, have to click Home to get appropriate menu. Only way to solve this is to put a redirect in OnSuccess but then this buggers ee and zz
Login as dd
Same as aa
Login as ee
With no redirect. Get green Joomla messg, Login Denied. No CF Messg and no debugger. If I put a redirect to Home page in OnSuccess then ee gets redirected to the Home page, ie OnFail does not fire. This is not right because ee is neither activated not enabled. OnFail should fire, no?
Login as zz
Same as ee
Seems the way I am doing it that CF does not process the different enabled / activated combos correctly ... .
Do you think my setup is wrong?
Need help on this please.
Does CF differentiate Joomla users that have been activated versus enabled ?
Hi Hangbill,
I'm not too clear what is happening here? As I understand it:
+ Activation is the optional process of checking that the user email is valid once they have clicked on a link sent to them.
+ Enabling is the setting that says the account can be used - or not. It has nothing directly to do with Activation though you can set the automatic account Enabling to require Activation. Equally you can over-ride that by manually enabling the account.
As you can see your aa and dd users are Enabled and the login works - though it looks as though you don't have any actions set in that case. Your ee and zz users are not activated and the login is correctly refused.
Bob
Let's focus on zz.
At one point zz was both activated and enabled. At that time zz was able to login and see a menu apropriate to his credentials.
Then admin made enabled = false.
Now when zz tries to login, he gets redirected to the home page that is visible only to the public and does not know why he cannot login.
I have a redirect to home page set for successful logins. Enabled logged-in users are redirected to the home page, and shown a menu apprpiate to their user status.
But I dont want zz redirected to the home because admin has turned his permission to enabled = false.
So this leads me to suspect that CF has some difficulty in managing activated versus enabled.
I need zz to be shown an admin messg, explaining why he cannot login. Having dsome trouble achieving this.
Thanks Greybeard.
Hi hangbill,
I'm sorry, i am clearly missing something but I don't understand what the problem is. If you want to show a message to 'disabled' users then you can add a system message to the On Fail box before the Event Loop. You could also set a variable in the User session and check that on form Load if you want to do something more sophisticated than a system message.
Bob
An admin system messg is fine but before On Fail is On Sucess and don't want to place it there ?
Not sure how to solve ... .
messg does not fire, see pic
Seems to be a CF problem.
Looking at zz only, ie activated = true and enabled = false
Enter a correct username and incorrect password and it fails to login -> good
Enter a correct username and a correct password and it does not fail login -> this is not correct, it should fail.
Hi hangbill,
That is not a System message it is a ChronoForms message and will not display as the next action redirects the user back to the form.
Bob
Hi hangbill,
The Joomla! Login action uses the Joomla! login() Application method if that returns true then the On Success event is triggered and if it returns false the On Fail event is triggered.
Bob
But this is a problem Greyhead.
zz has been blocked by the administrator by making enabled = false.
CF nevertheless places zz in the On Success group. I have tested this by redirecting, in On Success, to different pages and zz gets redirected. Therefore zz is being placed in the On Success group.
This is a problem.
Even though zz is placed in the On Success group, only the redirect bit is working. He does not get the restricted memu items, so this is good. But how do I get himn a messg that explains why he sees only the public menu items. He thinks he has logged in properly and he sees a home page with no explanatory messg
CF needs another function or whatever that fires On Fail when enabled = false
Or help on how to solve another way.
Because the Joomla admin wants to keep zz in the User table, but prevent him from logging in, ie enabled = false, I need a way to get the messg to zz
Sorry for persisting but need detailed help.
Thanks Greyhead
Hi hangbill,
As I said, the CF action uses the Joomla! method so it seems that in your case the Joomla! method is returning the incorrect value. I can only suggest that you use an Event Switcher with Custom Code to check exactly what you need.
Bob
Thanks Greybeard.
This is not working but are pics below on the right track?
For zz, in the Joomla Users table, block==true
So I need zz to see a messg if he tries to login, then get redirected to the public home page
This not working either ...
<div align='center'>
<?php
$user =& JFactory::getUser();
If $user->block==true {
return "success";
echo "Please contact the CIU Administrator";
}
?>
</div>
Hi hangbill,
Please try debugging your PHP.
Also the <div> may cause a problem - I'm not sure why you have that there.
And the echo line is after the return so probably won't do anything.
Bob
Thanks Greybeard
Have redone the php
<?php
$user =& JFactory::getUser();
If ($user->block==1){
echo "code has fired";
return "success";
}
?>
and placed the Event Switcher in the On Submit event, rather than the Joomla Login event.
Correct ?
There are no PHP errors, but also it is not firing.
And dont understand the meaning of the success / fail events in the Event Switcher. What does return success and return fail achieve? Does return success mean that the Event Switcher code has succeeded? And then must I put my messg on the On Success event of the Event Switcher? Have tried this but also no-go.
Sorry for all the questions but Google not helpful in this situation ...
Hi hangbill,
The event switcher has a number of 'sub' events that you can specify and name. What the return line says is "now run the actions in the 'sub' event with this name".
By default there are the two sub events 'success' and 'fail' but you don't have to use these names, and you can have one, two, three or more sub-events depending on what you want the switch to do.
Bob
OK I understand re sub events, thanks Greybeard.
But prob still not solved.
zz gets redirected to public home page, presume via the Joomla Login / On Success events but thankfully sees only the public menu, so grateful that's working (block==1).
I have tried the Event Switcher in both the Submit event as well as the Joomla Login event
Does set up in attached pics look correct?
Still trying, see pics.
Placed Event Switcher in Joomla Login, with following code
<?php
$user =& JFactory::getUser();
If ($user->block==0){
return "success";
} else {
return "fail";
}
?>
Then display messg in Joomla Login / On Fail, telling user that he needs to contact admin.
Seems it should work, must be close ...
Hi hangbill,
The images are incomplete so I can’t tell from this info what logic you are trying to follow now.
Bob
Hi Bob
OK, here is full setup pic, and Event Switcher code.
Thought now is do the switch inside the Joomla Login event. This seems correct because I know that zz (block==1) is being half logged in. When I set different redirects in the Joomla Login On Success event, zz is directed to those pages - so he is being logged in. I say half logged in because even though he is redirected, he can see only the public menu items. So this is good, he has been blocked after all. But he gets no messg, no clue why he is redirected to the home page and all he can see is the public menu items.
So, because he is making it to the Joomla Login On Success event, seems to make sense that the Event Switcher be placed in the Joomla Login On Success event. So then the switch code says if user->block==0, then login and redirect to home page, else fail. Then in the Event Switcher On Fail event display an appropriate messg, maybe also then redirect to home page.
Am I on the right track, because cant get it to work ...
Any help on this, please... need to get it working.