Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nick2395

    (@nick2395)

    Hi Peter,

    Thank you for your reply. That makes a lot of sense. That was my initial solution in fact, but my coach wanted me to make 1 page out of the 2 pages, using the ‘if_user_can’ wp function. That is how i managed to make 1 page out of 2. First, i created a new capability for the student role and named it: ‘is_student’. Than i created a template wordpress page with html and php. I pasted the ‘if_user_can’ function in the template page and added the ‘do_shortcode’ function. I added the shortcode for the non-student in the else statement, and the student shortcode in the if ((if_user_can) ‘is_student’) statement. When wordpress now loads the page, it will either show the student or non-student crud, depending on the capability ‘is_student’ of the user that is currently logged in. (example below).

    <?php if( current_user_can('edit_project')) :
                         echo do_shortcode('[wpdadiehard project_id="1" page_id="1"]');
                    elseif( current_user_can('is_student')) :
                        echo do_shortcode('[wpdadiehard project_id="1" page_id="8"]');
                    else :
                        wp_die("<h2>Je moet ingelogd zijn om deze pagina te mogen bekijken!</h2>");
                    endif;
                    ?>

    I hope this solution will help others in the future. Thanks again for your kindness and your help. Always a pleasure!

    Kind regards, Nick

    • This reply was modified 4 years, 9 months ago by nick2395. Reason: pasted code inside post
    Thread Starter nick2395

    (@nick2395)

    Hi Peter,

    Thanks for your answers. Let me explain my school project a bit further, because i think we don’t speak of the same ‘projects’. I have to make a project management system for. So i created a db table with the following table rows: Project id, project number, project name, customer name, coach, student 1, student 2, student 3, initiation leader. In my db, it looks like this:

    https://webnv.nl/testwebsite/project-overzicht-2/

    I have created a page of this table on the front end of my website, using your plugin. Edit is enebled, but i don’t want students to be able to edit or add another row to this table. Is that possible? So only users with the coach role can edit or add a row in this table. I hope you understand my question a bit better now.

    Thanks in advance

    • This reply was modified 4 years, 9 months ago by nick2395. Reason: Edited table
    • This reply was modified 4 years, 9 months ago by nick2395.
    • This reply was modified 4 years, 9 months ago by nick2395.
    Thread Starter nick2395

    (@nick2395)

    Thank you Peter!

    Thread Starter nick2395

    (@nick2395)

    Peter,

    Thanks for your quick answer, but i already looked at the pages you sent me. Maybe i should explain my ‘project’ a bit more.

    As you already know, i am currently working on a school project. That project implies building a project management system: it’s basically a crud table with a project name, project number, status, priority, customer name, dropdown with all users that have the role ‘student’ and a dropdown with users only with the role as ‘coach’. You can have a look at it on my website here: https://www.webnv.nl/testwebsite/project-overzicht/.

    I have created a database for this crud, the project status and the project priority. So the status and the priority for a project are coming from their respectable databases. But i want to do the same thing for the selection of students and coaches. so that’s why i want to create a seperate database with only students and seperate database with only coaches. I downloaded the roles and capabilities plug-in and i created two new roles. When someone registers on my site, they can choose between student and coach role. Do you see where i’m going with this?

    I hope my explanation helps, and i really hope you can help me with my project. Your plug-in is very usefull and i’m millimeters away from finishing my project. And maybe we can contact each other via another platform so that i can explain it to you in the best possible way? Anyway, thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)