Hey!
Chronoforms, great program and I am learning it bit by bit.
Now I was wondering if I could block a user after he presses the submit button.
The thing I want to do is as follows:
- The users has an userprofile in jos_users and in a second table and is logged in.
- When he wants to delete his entire profile he goes to a form and submit it.
- By pressing submit a value in the second table in column 'unregister' is set from 0 to 1.
Second event shoud be that the value of 'block' in jos_users is set from 0 to 1.
- Afterwords a thank you message should be showed.
To set 'block' to 1 is could use this code:
During testing I see 'unregister' is set to 1 (that's ok)
The thank you message is showed.
But 'block' is not set to 1 and I get and blank screen.
What can I do about it to work properly?
Chronoforms, great program and I am learning it bit by bit.
Now I was wondering if I could block a user after he presses the submit button.
The thing I want to do is as follows:
- The users has an userprofile in jos_users and in a second table and is logged in.
- When he wants to delete his entire profile he goes to a form and submit it.
- By pressing submit a value in the second table in column 'unregister' is set from 0 to 1.
Second event shoud be that the value of 'block' in jos_users is set from 0 to 1.
- Afterwords a thank you message should be showed.
To set 'block' to 1 is could use this code:
<?php $user->set('block', 1) ?>
During testing I see 'unregister' is set to 1 (that's ok)
The thank you message is showed.
But 'block' is not set to 1 and I get and blank screen.
What can I do about it to work properly?
I'm not sure if you can set the block to 1 using the user object, maybe just try to do an UPDATE query ? a "DB Save" action with the correct user id loaded should help you set the block to 1 as well, just use a unique MODEL ID in the data array and pass under it the id value and the block value only, that should take care of it.
Regards,
Max
Regards,
Max
Thnx for your reply Max!
I am not familiar with using the Model ID and can't find clear documentation about it.
In the DB save action to jos_users I have set the values as follows:
Model ID: Profile_disable
Save Under Model ID: Yes
I have 2 hidden fields:
- id with value {id}
- block with default value 1
But how do I pass the id value and block value under the Model ID?
Or how does it work to save the block value to the jos_user table?
I am not familiar with using the Model ID and can't find clear documentation about it.
In the DB save action to jos_users I have set the values as follows:
Model ID: Profile_disable
Save Under Model ID: Yes
I have 2 hidden fields:
- id with value {id}
- block with default value 1
But how do I pass the id value and block value under the Model ID?
Or how does it work to save the block value to the jos_user table?
Great, you should rename your fields to be like this:
Profile_disable[id]
Profile_disable[block]
And make sure the Profile_disable[id] has the correct user id loaded, or it will insert a new record.
I suggest that you set its value after the form is submitted and before the routine arrives to the user save action in this way:
This will make sure that the user doesn't change the value if they try to.
Regards,
Max
Profile_disable[id]
Profile_disable[block]
And make sure the Profile_disable[id] has the correct user id loaded, or it will insert a new record.
I suggest that you set its value after the form is submitted and before the routine arrives to the user save action in this way:
<?php
$form->data['Profile_disable']['id'] = 66;
?>
This will make sure that the user doesn't change the value if they try to.
Regards,
Max
This topic is locked and no more replies can be posted.