Thread Starter
gld
(@gld)
HP specifically -> ie PHP
Thread Starter
gld
(@gld)
Not a lot of support for the plug-in!
Anyway, if anyone else needs help, I’ve add the following function to my functions.php file in order to change the group the individual belongs too based upon a variable ‘record-status’ that is posted.
function UserUAgroupAccess() {
$record_status = $_POST[‘record_status’];
// grab the values we need
$email = $_POST[’email’];
// Now obtain the User’s User ID
$the_user = get_user_by(’email’, $email);
$wp_uid = $the_user->ID;
$userGroupId=2; // Group ID to be updated
// Now set the user’s permissions to have access to the pages
global $oUserAccessManager;
if (isset($oUserAccessManager)) {
$oUamAccessHandler = $oUserAccessManager->getAccessHandler();
$uamUserGroup = $oUamAccessHandler->getUserGroups($userGroupId);
if ($record_status == “Archived” OR $record_status == “Pending” OR $record_status == “Rejected”) {
$uamUserGroup->removeObject(‘user’, $wp_uid);
} else {
$uamUserGroup->addObject(‘user’, $wp_uid);
}
$uamUserGroup->save();
}
// make sure we return the posted values to ensure the plugin that we have hooked in front of will continue to function properly
return ($_POST);
}
I actually had the same problem, but needed it for all sorts of types:
user, role, post, term
So I implemented a plugin for the wp-cli: http://wp-cli.org/
by extending the current plugin. Since I am not not clear about how to contribute directly to the project, I made a “fork” based on the current svn trunk at https://github.com/nwoetzel/user-access-manager/
and created a branch that adds wp-cli functionality:
https://github.com/nwoetzel/user-access-manager/tree/wp-cli
I hope this helps more then just me.
When wp-cli is installed, and the plugin from the branch, you should have ‘wp uam’ as a new command
in case you have just the svn version installed, you can apply a patch:
https://github.com/nwoetzel/user-access-manager/compare/master…wp-cli.patch