Extend Coursepress pro plugin & some related questions

0

Hi,

What is the best way to extend/make changes to the coursepress plugin. I am guessing diving right into the code and editing functions isn’t the correct way of going about it?

Is it possible for you to help me out with snippets/ideas on how to achieve the following:

1. I want to have a functionality where except for the site admin, all other instructors while creating a course get automatically assigned to their course, but dont have the option to assign others. Whats happening right now is, if I take away the capability of an instructor to add instructors, it doesnt let me create new courses nor does it add that particular instructor to their own course. I am guessing this isn’t too tough to achieve but can’t get my head around it.

2. Instead of the tinymce editors used on the coursepress, could I use a simple text editor without all the text formatting options?

3. Is it possible to replace the “add media” buttons in the course creation pages with a simple upload button, which takes the user directly to browse in his explorer, instead of the gallery?

4. During the course creation/edit process, how can I hide certain fields (eg. course language or course structure) from every instructor except the site admin (all instructors are authors on my site) and set default values for those hidden fields (eg course language will always be english, etc)

Any quick help on these please? Thanks

  • Adam Czajczyk
    • Support Gorilla

    Hello Kunal,

    I hope you’re well today and thank you for your question!

    What is the best way to extend/make changes to the coursepress plugin. I am guessing diving right into the code and editing functions isn’t the correct way of going about it?

    You’re absolutely right about it, we do not recommend changing plugin’s code as this may lead to unexpected issues and for sure changes would be lost upon plugin update.

    As for your other questions. I think in most part this would require a lot of custom coding which actually is beyond the scope of this forum. I agree these could be great additions to the plugin so I’m moving this thread to our “Features and Feedback” forum and hopefully more members of the community will show their support, therefore our developers will put those ideas on development map.

    That said, let me please invite @Jose to this conversation as he may be able to give you some useful tips and advice that would help you in case you’d like to go on with custom coding yourself.

    Please note though that his response time may be a bit longer than mine as he’s dealing with a lot of complex issues at once on daily basis.

    Best regards,

    Adam

  • Jose
    • Bruno Diaz

    Hello there Kunal,

    As my colleague Adam says, you would want to avoid hacking the plugin files.

    Unfortunately, there are no hooks available to achieve what you want here. For most of it, you will need to modify the core of the plugin.

    This is quite a big customization and it is beyond our scope here. If you need these features in the short term, I’d suggest you to hire a developer. You can start by looking at our Jobs Board.

    In case you feel comfortable with coding and you want to make the modifications by your own, here are a few tips for each of your questions:

    1- You need to check the class CoursePress_Capabilities defined in the file wp-content/plugins/coursepress/includes/classes/class.coursepress-capabilities.php.

    You will be interested specifically in the following capabilities:

    ‘coursepress_create_course_cap’

    ‘coursepress_assign_and_assign_instructor_course_cap’

    ‘coursepress_assign_and_assign_instructor_my_course_cap’

    2- Look for the specific <textarea> element in the code and remove the class “coursepress-editor”. This is the selector used in JS side to convert the input in a tinyMCE editor.

    3- This button is part of wp tinyMCE editor so it will be gone if you deactivate it. Then, you need to create your custom implementation and add it to the template defined in the file wp-content/plugins/coursepress/includes/admin-pages/courses-details-overview.php.

    4- If you want to add fields, you can use the action ‘course_step_1_fields’. But there is no hook to remove fields. So you could either use this action to add some custom CSS to hide the fields, or directly edit the file wp-content/plugins/coursepress/includes/admin-pages/courses-details-overview.php.

    Hope this helps.

    Please let us know if you have any specific question about our code.

    Cheers,

    José

  • Kunal
    • Flash Drive

    Thanks for the help Jose. I was able to somewhat achieve what I was looking for using your pointers 2 – 4. But, I am still stuck at point 1. Is it possible for you to maybe explain how exactly can I automatically assign an instructor while they create a course, without giving them the capability to assign others?

  • Predrag Dubajic
    • Support

    Hi Kunal,

    Sorry for the delay on this thread, but our developers, including @Jose, deal with both plugin updates and more complicated requests like this one, so their response times are affected by that.

    If you are in a hurry to customize this then you can post a job in our job board where you can hire a developer to assist further:

    https://wpmudev.com/wpmu-jobs/

    Please note that, no WPMU official staff members are allowed to work in the job board.

    Best regards,

    Predrag