ridgedale Posted August 17, 2018 Share Posted August 17, 2018 Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. I have some further questions having read the following thread: and the demo registration page referred to. I'm looking to setup a login page with no registration capability for club users to add/upload/manage their athlete entries. The entries administrator will manage the club logins and have access to a different set of pages (including some of the same pages). The club users are to be automatically directed initially to their profile page to update any required further information such as contact details. All users are to be required to login by user name not email address - one user name per club. Forgotten passwords will need to be requested from the entries administrator. The entries administrator is to be directed initially to an entries status page where the accepted and unaccepted athlete entries are listed for each club. The entries administrator should not be required to complete any further profile information. Any failed logins are to be redirected back to the login page. Initially I have replaced code in home.php with the following: <?php namespace ProcessWire; // this homepage template demonstrates making the headline, body and sidebar fields // editable on the front-end, using the <edit> tags ?> <div class='uk-margin-top' id='content-body'> <?php echo $modules->get("LoginRegister")->execute(); ?> </div> The only page accessible to guests needs to be the login page. How can I prevent guests bypassing the login page to guess and access the other pages of the website? Unpublishing the pages denies access to all users. Is the only way to create separate templates and deny access to pages created with them for guests? In addition, the Register for an account link needs to be removed. At this point I've created a list of tables and fields that I think will be required for the entries system: Quote User: User ID [Primary Key - unique, auto-incrementing] User Name * [not to be editable by User] User Password * [not to be editable by User] User Club Name * [not to be editable by User] User Club Code * [not to be editable by User] User Email * [generic club contact email address to be set by User] All User accounts to be manually setup by entries admin. Club: Club ID [Primary Key - unique, auto-incrementing] User ID [Foreign Key]User Club Code [Auto populated via User ID Foreign Key relationship to User] Team Manager Last Name * Team Manager First Name * Team Manager Mobile/Phone * Team Manager Email * Deputy Team Manager Last Name Deputy Team Manager First Name Deputy Team Manager Mobile/Phone Deputy Team Manager Email Chairperson Last Name Chairperson First Name Chairperson Mobile/Phone Chairperson Email Club Secretary Last Name Club Secretary First Name Club Secretary Mobile/Phone Club Secretary Email Club Treasurer Last Name Club Treasurer First Name Club Treasurer Mobile/Phone Club Treasurer Email Ability to upload entries via .csv file or to ender individually required. Category: Category ID [Primary Key - unique, auto-incrementing] Category Title * Category Gender * Category Race No * All Category details to be manually entered by entries admin. Season: Season ID [Primary Key - unique, auto-incrementing] Season Calculated Title [auto-calculated from Season Start and End Year i.e. 2018-2019] Season Start Date * Season End Date * All Season details to be manually entered by entries admin. Fixture: Fixture ID [Primary Key - unique, auto-incrementing] Season ID [Foreign Key] Season Calculated Title [Auto populated via Season ID Foreign Key relationship to Season] Fixture Venue * Fixture Host(s) Fixture Date * Fixture Round No * Fixture Primary Entry Deadline * Fixture Secondary Entry Deadline * Race: Race ID [Primary Key - unique, auto-incrementing] Race No * Race Gender * Race Title * All Race details to be manually entered by entries admin. Athlete: Athlete ID [Primary Key - unique, auto-incrementing] User ID [Foreign Key]User Club Code [Auto populated via User ID Foreign Key relationship to User] Fixture ID [Foreign Key] Athlete Last Name * Athlete First Name * Athlete URN * Athlete DoB * Athlete Gender * Athlete Age Category Athlete Race No Athlete Second Claim Club Athlete Calculated Age Category § Athlete Calculated Race No §§ Ability to run (both en block and individually) athlete licence checks using UKA Licence Check API required. Awaiting API access and documentation) Initial Check: Athlete Last Name Athlete First Name Athlete DoB Secondary Check: Athlete URN Tertiary Check: (based on any corrections made due to the returned results of both of the above) Athlete Last Name Athlete First Name Athlete DoB * = Required Data § = Age Category mismatches result in check failure. §§ = Race No mismatches to be flagged to Team Managers. The available menus are to be different for the club users and entries administrator(s): Quote Club Users: Club Profile (only their own club's) Club Athlete Entries (only their own club's athlete entries) Inidividual Athlete Entries Bulk Athlete Entries (.csv upload) List Athlete Entries Accepted for Submission (for final licence check approval) List Athlete Entries Failed (based on calculated pre-checks - club user to resolve) Entries Administrator(s): Club Profiles (all clubs') Season List Fixture List Category List Race List List Athlete Entries per Club Accepted for Submission (for all current and past season's fixtures) List Athlete Entries Failed (based on calculated pre-checks - club user to resolve) Licence Checks (may not be possible to implement this immediately) View Licence Checks Passed and Failed Export/Download Cleared Athlete Entry Submissions (.csv file) If I've understood correctly, I need to create a template for each of the following Quote Club Season Fixture Category Race Club Athletes (parent of Athletes that assigns athletes to clubs) Add then create individual pages for each club, season, fixture, category, race and club athletes. When the club user accesses the Athletes page s/he needs to be able to either add entries individually or import them via .csv upload effectively creating individual pages for each of the athletes (children of Athletes page) directly linked and only visible to the club. As is probably clear I have never created anything like this before. I'd appreciate any advice/assistance to help me get started. Link to comment Share on other sites More sharing options...
dragan Posted August 17, 2018 Share Posted August 17, 2018 3 hours ago, ridgedale said: In addition, the Register for an account link needs to be removed. You can do that in the settings: Link to comment Share on other sites More sharing options...
dragan Posted August 17, 2018 Share Posted August 17, 2018 3 hours ago, ridgedale said: At this point I've created a list of tables and fields that I think will be required for the entries system: Quote You mean actual mySQL tables? While you're free to do it this way, it's not really "the recommended PW-way" of doing such things. The user template is a system template, and it can be altered, i.e. you are free to add as many fields as you wish. Go to Setup > Templates and then open the collapsed item at the top, and select Yes under "Show system templates?": As with all the other "tables": I would create PW-pages and store everything there. Exporting data as .csv and filtering: The commercial ListerPro module is a good candidate for such things. 3 hours ago, ridgedale said: When the club user accesses the Athletes page s/he needs to be able to either add entries individually or import them via .csv upload effectively creating individual pages for each of the athletes (children of Athletes page) For this functionality, try the Batch Child Editor. Link to comment Share on other sites More sharing options...
ridgedale Posted August 17, 2018 Author Share Posted August 17, 2018 (edited) Hi @dragan , Thanks for your feedback once again. 2 hours ago, dragan said: You can do that in the settings: Apologies, I should have spotted that. ? I can simplify home.php and _main.php as follows: home.php: <?php namespace ProcessWire; // this homepage template demonstrates making the headline, body and sidebar fields // editable on the front-end, using the <edit> tags ?> <div class='uk-margin-top' id='content-body'> <?php echo $modules->get("LoginRegister")->execute(); ?> </div> _main.php: <?php namespace ProcessWire; // _main.php template file, called after a page’s template file $home = pages()->get('/'); // homepage $siteTitle = 'Regular'; $siteTagline = $home->summary; ?><!DOCTYPE html> <html lang="en"> <head id='html-head'> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title id='html-title'><?=page()->title?></title> <meta name="description" content="<?=page()->summary?>"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.30/css/uikit.min.css" /> <link rel="stylesheet" href="<?=urls()->templates?>styles/main.css"> <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.30/js/uikit.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.30/js/uikit-icons.min.js"></script> <?php if(page()->comments): ?> <script src='<?=urls()->FieldtypeComments?>comments.min.js'></script> <link rel="stylesheet" href="<?=urls()->FieldtypeComments?>comments.css"> <?php endif; ?> </head> <body id='html-body'> <!-- MASTHEAD --> <header class='uk-background-muted'> <div id='masthead' class="uk-container"> <h2 id='masthead-logo' class='uk-text-center uk-margin-medium-top uk-margin-small-bottom'> <a href='<?=urls()->root?>'> <img src='<?=urls()->templates?>styles/images/coffee4.svg' alt='coffee'><br /> </a> <?=$siteTitle?> </h2> </div> </header> <!-- MAIN CONTENT --> <main id='main' class='uk-container uk-margin uk-margin-large-bottom'> <?php if(page()->parent->id > $home->id) echo ukBreadcrumb(page(), [ 'class' => 'uk-visible@m' ]); ?> <div class='uk-grid-large' uk-grid> <div id='content' class='uk-width-expand'> <h1 id='content-head' class='uk-margin-small-top'> <?=page()->get('headline|title')?> </h1> <div id='content-body'> <?=page()->body?> </div> </div> <aside id='sidebar' class='uk-width-1-3@m'> <?=page()->sidebar?> </aside> </div> </main> <?php if(config()->debug && user()->isSuperuser()): // display region debugging info ?> <section id='debug' class='uk-section uk-section-muted'> <div class='uk-container'> <!--PW-REGION-DEBUG--> </div> </section> <?php endif; ?> <!-- FOOTER --> <footer class='uk-section uk-section-secondary'> <div id='footer' class='uk-container'> <div uk-grid> <div class='uk-width-1-3@m uk-flex-last@m uk-text-center'> <form class='uk-search uk-search-default' action='<?=pages()->get('template=search')->url?>' method='get'> <button type='submit' class='uk-search-toggle uk-search-icon-flip' uk-search-icon></button> <input type='search' id='search-query' name='q' class='uk-search-input' placeholder='Search…'> </form> </div> <div class='uk-width-2-3@m uk-flex-first@m uk-text-center uk-text-left@m'> <h3 class='uk-margin-remove'> <?=$siteTitle?> <small class='uk-text-small uk-text-muted'><?=$siteTagline?></small> </h3> <p class='uk-margin-remove'> <small class='uk-text-small uk-text-muted'>© <?=date('Y')?> •</small> <a href='https://processwire.com'>Powered by ProcessWire CMS</a> </p> </div> </div> </div> </footer> </body> </html> 2 hours ago, dragan said: The user template is a system template, and it can be altered, i.e. you are free to add as many fields as you wish. Yes, I do understand as you pointed out in the answer to my previous topic, but my concern now is that adding fields and permissions to the user template may have a negative impact for the entry administrators. I would definitely prefer to use PW3 mode rather than creating MySQL tables. I am trying to get my head round how to build the entries system and drafting out table lists seemed a good place to start. One big initial concern I have is protecting the pages and data behind the login, and, secondly, I'm wondering whether or not the only way the two different user interfaces (club users/entries administrator(s) - menus providing page/data access) is to have two separate PW3 installations driven from the same database. Some data needs to be editable and read only to the club users and vice versa for the entries administrator(s). Is it possible to hide pages from some users and not others to present different navigation interfaces? As examples: A User Profile page will need to be editable by both the club users and the entries administrator(s). I'm thinking it might be better to setup a separate User Profile template that incorporates the fields used by the User template and add any additional fields to the User Profile template. Am I over-thinking/over-complicating things? The data for the Athlete pages should only be editable by the club user, not the entries administrator(s) who only need(s) read only/data export access, In addition, the relevant athlete data should only be accessible to the particular club to whom the athlete belongs. I don't know if this is correct or even possible, but it seems to me that I need a login.php page sitting in from of two home.php pages (one for the club users and one for the entries administrator(s). Have you or any other member of the PW community had to setup something similar before? If so, would it be possible to outline how it was achieved? Edited August 17, 2018 by ridgedale Added edited code for home.php and _main.php Link to comment Share on other sites More sharing options...
dragan Posted August 17, 2018 Share Posted August 17, 2018 You certainly don't need two separate PW installations. Did you discover Dynamic Roles yet? And also take a look at this: https://modules.processwire.com/modules/custom-page-roles/ And then perhaps also this: http://modules.processwire.com/modules/page-edit-per-user/ Sorry, I don't have more time atm - but these three links should probably get you going (or at least steer you in the right direction). Link to comment Share on other sites More sharing options...
ridgedale Posted August 17, 2018 Author Share Posted August 17, 2018 Thanks again for your assistamce, @dragan . Apologies. I realise that I have neglected to say that club users and entries administrators will have frontend access only. They only be submitting, checking and/or collecting data. Thank you for pointing out those modules. I'll look into them and see if they can help me get started. Link to comment Share on other sites More sharing options...
adrian Posted August 18, 2018 Share Posted August 18, 2018 If you go with the dynamic roles module, please read this critical issue: https://github.com/ryancramerdesign/DynamicRoles/issues/14 You can apply the fix I have there, or perhaps use @matjazp's fork. Link to comment Share on other sites More sharing options...
ridgedale Posted August 18, 2018 Author Share Posted August 18, 2018 @dragan / @adrian , I'm very wary about the compatibility and stability of both of the CustomPageRoles and PageEditPerUser modules both being proof of concept modules and appear to lack PW3 compatibility. Having read through the thread for the DynamicRoles module via the link @dragan provided I think I will look at @matjazp's fork as @adrian suggested. Albeit I do have reservations given @Robin S 's comments regarding the DynamicRoles module in the following thread: Although I'm not sure if those comments apply to one, the other or both of @ryan 's module and @matjazp's fork. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now