gradual demotion, custom capability or hidden field
Posted: August 26th, 2011, 10:20 am
Hi all...
For this organization site, new members must register and then they are manually approved after passing a background check. That approval needs to be attached to their profile and it should only be possible to change it manually.
The easiest and most obvious would be an "Approved" checkbox but it should always be invisible to the member which is not possible with the current version.
A close alternative is calling the check box something less obvious and have it visible during registration but invisible and not editable by the user after registration. The trick here is, after the register button is pressed, I need to be sure it is unchecked. I tried this (after_configure AND during_configure) in my s2-hacks.php but no luck so I am sure I don't have the code right:
Another idea is to use a custom capability which works great but even if a custom capability was added to a user at level 0, s2 clears the custom capability when the EOT passes and the user is demoted from a higher level back to subscriber.
I should add that while I understand why this happens, I find it odd as a custom capability added at subscriber level should logically stay in effect when demoted back to subscriber level.
And yet another way which I would be happy with is to add the word approved to the s2 administrative notes field where s2 notes the demotion data. Text in that field seems to be fairly non-volatile but how do I check that field for text?
The most basic idea is to use level 1 for approved users so when a level2 or level3 user (levels that can only be achieved if level 1 was manually given) gets demoted they demote to level1 and not subscriber.
Help?
DP
For this organization site, new members must register and then they are manually approved after passing a background check. That approval needs to be attached to their profile and it should only be possible to change it manually.
The easiest and most obvious would be an "Approved" checkbox but it should always be invisible to the member which is not possible with the current version.
A close alternative is calling the check box something less obvious and have it visible during registration but invisible and not editable by the user after registration. The trick here is, after the register button is pressed, I need to be sure it is unchecked. I tried this (after_configure AND during_configure) in my s2-hacks.php but no luck so I am sure I don't have the code right:
- Code: Select all
<?php
add_action ('ws_plugin__s2member_after_configure_user_registration', 's2_set_approved_by_org');
function s2_set_approved_by_org($vars = array()) {
if (!is_admin() && $vars['processed'] === 'yes') {
$s2_custom_fields['approved_by_org'] = false;
update_user_option($user_id, 's2member_custom_fields', $s2_custom_fields);
}
}
?>
Another idea is to use a custom capability which works great but even if a custom capability was added to a user at level 0, s2 clears the custom capability when the EOT passes and the user is demoted from a higher level back to subscriber.
I should add that while I understand why this happens, I find it odd as a custom capability added at subscriber level should logically stay in effect when demoted back to subscriber level.
And yet another way which I would be happy with is to add the word approved to the s2 administrative notes field where s2 notes the demotion data. Text in that field seems to be fairly non-volatile but how do I check that field for text?
The most basic idea is to use level 1 for approved users so when a level2 or level3 user (levels that can only be achieved if level 1 was manually given) gets demoted they demote to level1 and not subscriber.
Help?
DP