[Solved] double enrollment

  • lecebri
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
15 years 6 months ago - 15 years 6 months ago #1 by lecebri
[Solved] double enrollment was created by lecebri
please how can i denied or prevent a user who is already enroll in a course to buy it. any ideas please...
Last edit: 15 years 6 months ago by Antonio Durán.
The topic has been locked.
More
15 years 6 months ago #2 by shekar
The topic has been locked.
  • lecebri
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
15 years 6 months ago #3 by lecebri
Replied by lecebri on topic Re: double enrollment
yes it's exactly what i want. how can i get it please?
The topic has been locked.
More
15 years 6 months ago #4 by Antonio Durán
Replied by Antonio Durán on topic Re: double enrollment
You will have to wait for next release, where this feature will be addded.
The topic has been locked.
More
15 years 6 months ago #5 by shekar
Replied by shekar on topic Re: double enrollment
I am also waiting for this, as Antonio said its added for next release.

It would be great if he can help us to fix in present release.



Thanks
Shekar
The topic has been locked.
More
15 years 6 months ago - 15 years 6 months ago #6 by Antonio Durán
Replied by Antonio Durán on topic Re: double enrollment
To add it you would need to replace default.php in detail view with attached one.

Also, add this function to content.php helper:
Code:
function is_enroled ($username, $course_id) { if ($username) $user = & JFactory::getUser($username); else $user = & JFactory::getUser(); if (!$user) return array (); $username = $user->get('username'); $cursos = JoomdleHelperContent::call_method ('my_courses', $username); foreach ($cursos as $curso) { if ($curso['id'] == $course_id) return 1; } return 0; }




File Attachment:

File Name: default.php.txt
File Size:7.91 KB
Last edit: 15 years 6 months ago by Chris.
The topic has been locked.
More
15 years 6 months ago - 15 years 6 months ago #7 by shekar
Replied by shekar on topic Re: double enrollment
After replacing the default.php file I got this error.

Fatal error: Call to undefined method JoomdleHelperContent::get_course_url() in /components/com_joomdle/views/detail/tmpl/default.php on line 194


Is there any extra function? called "get_course_url()"
Last edit: 15 years 6 months ago by shekar.
The topic has been locked.
More
15 years 6 months ago - 15 years 6 months ago #8 by Antonio Durán
Replied by Antonio Durán on topic Re: double enrollment
you are right, I forgot about it. Paste it in content.php:
Code:
function get_course_url ($course_id) { $mainframe = & JFactory::getApplication( 'site' ); $user = JFactory::getUser (); $username = $user->username; $session =& JFactory::getSession(); $token = md5 ($session->getId()); $itemid = JRequest::getVar( 'Itemid' ); $params = &$mainframe->getParams(); if ($params->get( 'linkstarget' ) == 'wrapper') $open_in_wrapper = 1; else $open_in_wrapper = 0; $moodle_auth_land_url = $params->get( 'MOODLE_URL' ).'/auth/joomdle/land.php'; $url = $moodle_auth_land_url."?username=$username&token=$token&mtype=course&id=$course_id&use_wrapper=$open_in_wrapper&Itemid=$itemid"; return $url; }
Last edit: 15 years 6 months ago by Chris.
The topic has been locked.
More
15 years 6 months ago #9 by shekar
Replied by shekar on topic Re: double enrollment
Thank you, its working...
The topic has been locked.
  • lecebri
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
15 years 6 months ago #10 by lecebri
Replied by lecebri on topic Re: double enrollment
ok i'm trying and i will give you the result
The topic has been locked.