Hi, I am creating an open blog with Wix, meaning I want the creators to be automatically authorised to create new posts. I will moderate them post-factum.
When a new person joins, they can’t add posts (they are not collaborators, just members). I want people to automatically become new collaborators rather than manually use the invite feature and assign roles (like Blog writer).
Can I do it somehow? With Velo?
I have tried to use some coding but realised that these role IDs point to the member roles (e.g. to view a given page) rather than the collaborator’s roles (like Blog writer).
import { authorization } from ‘wix-members-backend’ ;
export function myAssignRoleFunction ( pMemberId ) {
const roleId = “be6b8474-f84a-40e5-adfe-d77814168636” ;
const memberId = pMemberId ;
const options = {
suppressAuth : false
};
return authorization . assignRole ( roleId , memberId , options )
. then (() => {
console . log ( “Role assigned to member” );
})
. catch (( error ) => {
console . error ( error );
});
}
Is there any other API I can use to create a new collaborator (directly based on the member auto-registration) and assign the role (Blog writer)?
Is it possible at all in the current version of Wix?
I appreciate any help you can provide.