Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Where is the_course_button defined?
- This topic has 12 replies, 2 voices, and was last updated 9 years, 2 months ago by Anshuman Sahu.
Viewing 13 posts - 1 through 13 (of 13 total)
-
AuthorPosts
-
October 5, 2015 at 1:08 pm #1571DrSchmengeSpectatorI see the_course_button in single-course.php but I can't find where the related function is. Which template file is it in?October 7, 2015 at 10:57 am #1840Anshuman SahuKeymasterIt is defined in the wp-content/pluigns/vibe-course-module/includes/ bp-course-functions.php file in vibe course module plugin.October 9, 2015 at 3:11 pm #2225DrSchmengeSpectatorThanks.
- I can override that by creating a copy of it in the child theme?
- Is the location the same in 1.9.9?
October 12, 2015 at 9:54 am #2468Anshuman SahuKeymasterNo you cannot the the_course_button function . The whole student access to the course logic is dependent on this button . Can you please explain in detail what exactly you want to do in the the_course_button function ?October 12, 2015 at 11:25 am #2497DrSchmengeSpectatorI'm trying to customize the link for PMPro found in this function:function wplms_check_pmpro_button($link){ $course_id = get_the_ID(); if ( in_array( 'paid-memberships-pro/paid-memberships-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) )) { $membership_ids=vibe_sanitize(get_post_meta($course_id,'vibe_pmpro_membership',false)); if(isset($membership_ids) && is_array($membership_ids) && count($membership_ids)){ $pmpro_levels_page_id = get_option('pmpro_levels_page_id'); $link = get_permalink($pmpro_levels_page_id); } } return $link; }
I see where <span style="line-height: 1.5;">$link = get_permalink($pmpro_levels_page_id); </span><span style="line-height: 1.5;">and I want to add the author </span><span style="line-height: 1.5;">name to it.</span> I know I have to override the filter but I haven't figured out how to do that with the child theme.October 12, 2015 at 12:55 pm #2517DrSchmengeSpectatorWhat I need to do is add the course authorname at the end of the pmpro levels link. Don't bother trying to stop me - it has to be done for my site. If you aren't able to help me, I'll be hiring someone else to hack it - unless you are willing to do it for a small bounty.October 12, 2015 at 1:04 pm #2518DrSchmengeSpectatorWhere exactly is the Take This Course PMPro link generated? I just deleted the whole 'PMPro Connect' code from the parent themes /includes/func.php and the Take This Course link is fine. No wonder nothing I'm doing is working.October 13, 2015 at 1:37 pm #2743Anshuman SahuKeymasterHere you go : Try adding this code in your wplms-customizer.php file in wplms-customizer plugin :add_filter('wplms_course_credits_array','customwplms_course_credits_array',10,2); function customwplms_course_credits_array($credits,$id){ $flag = 0; $new_credits = array(); $author_id = get_post_field('post_author',$id); $author = get_user_by('id',$author_id); if ( in_array( 'paid-memberships-pro/paid-memberships-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { $membership_ids = vibe_sanitize(get_post_meta($id,'vibe_pmpro_membership',false)); $match = array(); if(isset($membership_ids) && is_Array($membership_ids) && count($membership_ids) && function_exists('pmpro_getAllLevels')){ $link=get_option('pmpro_levels_page_id'); $link=get_permalink($link); foreach($membership_ids as $membership_id){ $match[]=$link.'#'.$membership_id; } foreach($credits as $key => $value){ if(in_array($key,$match)){ $flag=1; $new_credits[$key] = $value.' '.$author->display_name; }else{ $new_credits[$key] = $value; } } } } if($flag) $credits = $new_credits; return $credits; }
October 13, 2015 at 3:31 pm #2764DrSchmengeSpectatorThanks, I'll give it a try & get back to you.October 16, 2015 at 12:43 pm #3334DrSchmengeSpectatorThat doesn't help - it does not customize$link
. I don't need to customize the button label. I see$match[]=$link.'#'.$membership_id;
and I want to replace<span style="line-height: 1.5;">'#'.$membership_id;' in the url with
'/'</span>.$author->display_name<span style="line-height: 1.5;">;`. Make sense now?</span>October 16, 2015 at 12:44 pm #3335DrSchmengeSpectatorThat doesn't help - it does not customize$link
. I don't need to customize the button label. I see$match[]=$link.'#'.$membership_id;
and I want to replace'#'.$membership_id;
in the url with'/'.$author->display_name;
. Make sense now?October 16, 2015 at 1:12 pm #3342DrSchmengeSpectatorI finally figured it out - though I can't give you much credit for it. If you had been able to tell me that I should look at thebp_course_get_course_credits
function in the first place you would have saved me - and you - a lot of time. I am thankful that you madebp_course_get_course_credits
a pluggable function, so I customized it, made a plugin, activated it and BOOM. Done.October 17, 2015 at 10:46 am #3444Anshuman SahuKeymasterOk marking it as resolved and closing the topic . -
AuthorPosts
Viewing 13 posts - 1 through 13 (of 13 total)
- The topic ‘Where is the_course_button defined?’ is closed to new replies.