Is it possible & if so, how can I allow users to only create a certain number of pages. ie. When they sign up, only allow them to create one page?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Off the top of my head, the following approach ought to work:
userCanevent for the ‘edit’ action, check the page’s existence (i.e.$title->exists()) and if it doesn’t, consult some stored count (see below), and if the decision reached is to disallow creation, set$resulttofalseand returnfalseto stop further hooks overriding the decision.ArticleInsertCompleteevent and update some stored count to reflect that the user ($user) has created another page.The decision in #1 can be expanded via additional logic to support multiple policies in conjunction with, e.g. automatic rights assignment; for example, to allow users to create more than one page after they’ve reached so-called ‘auto-confirmed’ status, or to ignore the check for administrators or other users with specific rights.