{"id":13360,"date":"2021-01-31T11:43:27","date_gmt":"2021-01-31T19:43:27","guid":{"rendered":"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/clone-of-how-to-create-a-student-facing-reports-page-in-dap\/"},"modified":"2021-02-01T12:49:38","modified_gmt":"2021-02-01T20:49:38","slug":"custom-wordpress-hooks-to-extend-your-membership-site-functionality","status":"publish","type":"post","link":"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/","title":{"rendered":"Extend Your DAP Membership Site Functionality &#8211; Using WordPress Action Hooks!"},"content":{"rendered":"<h2 style=\"text-align: center;\">What are WordPress Hooks?<\/h2>\n<p style=\"text-align: left;\">WordPress <a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/\" style=\"outline: none;\" target=\"_blank\" rel=\"noopener noreferrer\">hooks<\/a> allow you to modify or add features to WordPress without touching the core files. Using hook functions, you can get WordPress to execute your custom code, &nbsp;registered via a callback function, at different points. WordPress will allow you to augment or replace the feature that your callback is hooked to!<\/p>\n<p>There are two types of hooks:&nbsp;<a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/actions\/\" style=\"outline: none;\">Actions<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/filters\/\" style=\"outline: none;\">Filters<\/a>. To use either, you need to write a custom function known as a <em>callback<\/em>, and then register it with a WordPress hook for a specific action or filter.<\/p>\n<h2 style=\"text-align: center;\">Now you can Modify\/Add Functionality without Updating Core DAP Files<\/h2>\n<p>Action hooks will allow you add your own custom code at certain predefined points. This way you can modify or add features to DAP without touching the core DAP files.&nbsp;<\/p>\n<p style=\"text-align: left;\">DAP is already a pretty powerful membership plugin and you&#8217;ll likely not have a need to extend it with custom code. However, if you want to extend certain feature or functionality, you can now do it easily, without updating core DAP files.<\/p>\n<p>You can add custom callback code in your theme&#8217;s functions.php file or use a plugin (such as code snippets) to add your callback.&nbsp;<\/p>\n<p>Please note that this document is a <strong>developer reference<\/strong> provided as a courtesy. <strong>Our support policy does not include customizations.<\/strong><\/p>\n<p>If you need any help with customizations, you can hire a developer to help you with it. If you need our help, just open a <a href=\"https:\/\/digitalaccesspass.com\/support\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\">ticket<\/a> and we&#8217;ll let you know the cost of custom updates.&nbsp;<\/p>\n<table data-rows=\"2\" data-cols=\"1\" style=\"\">\n<thead>\n<tr>\n<th style=\"\">\n<p style=\"text-align: center;\"><strong>Memberships<\/strong><\/p>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"\">\n<ul>\n<li style=\"\"><span><a href=\"#tve-jump-1775b8e080e\" style=\"outline: none;\"><strong><span style=\"text-decoration: underline;\">Subscription Purchase<\/span>:<\/strong> When a user gets access to a subscription<\/a><\/span><\/li>\n<li style=\"\"><span><a href=\"#tve-jump-1775b8e3ef8\" style=\"outline: none;\"><strong><span style=\"text-decoration: underline;\">Subscription Cancellation<\/span>: <\/strong>When a user cancels their subscription<\/a><\/span><\/li>\n<li style=\"\"><span><a href=\"#tve-jump-1775b8e8571\" style=\"outline: none;\"><strong><span style=\"text-decoration: underline;\">Subscription Paused<\/span>: <\/strong>When a user pauses their subscription<\/a><\/span><\/li>\n<li style=\"\"><span style=\"\"><a href=\"#tve-jump-1775b8eb4bf\" style=\"outline: none;\"><strong><span style=\"text-decoration: underline;\">Subscription Resumed<\/span>: <\/strong>When a user resumes their subscription<\/a><\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table data-rows=\"2\" data-cols=\"1\" style=\"\">\n<thead>\n<tr>\n<th style=\"\">\n<p style=\"text-align: center;\"><strong>Courses<\/strong><\/p>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"\">\n<ul>\n<li style=\"\"><span><a href=\"#tve-jump-1775b8eee76\" style=\"outline: none;\"><strong><span style=\"text-decoration: underline;\">Lesson Complete<\/span><\/strong><\/a>: When a user completes a lesson<\/span><\/li>\n<li style=\"\"><span><strong><a href=\"#tve-jump-1775b8fa6c3\" style=\"outline: none;\">Course Complete<\/a><strong>:<\/strong><\/strong> When a user completes a course<\/span><\/li>\n<li style=\"\"><span><a href=\"#tve-jump-1775b8fede9\" style=\"outline: none;\"><strong><span style=\"text-decoration: underline;\">Module Complete<\/span><\/strong><\/a>: When a user completes a module<\/span><\/li>\n<li style=\"\"><span><strong><a href=\"#tve-jump-1775b9025ea\" style=\"outline: none;\"><span style=\"text-decoration: underline;\">Time Spent<\/span><\/a><strong>&nbsp;<\/strong><\/strong>on Each Lesson<\/span><\/li>\n<li style=\"\"><span><strong><a href=\"#tve-jump-1775b906a6d\" style=\"outline: none;\"><span style=\"text-decoration: underline;\">Certificate Earned<\/span><\/a><strong>:&nbsp;<\/strong><\/strong>When users Earn a Course Certificate<\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table data-rows=\"2\" data-cols=\"1\" style=\"\">\n<thead>\n<tr>\n<th style=\"\">\n<p style=\"text-align: center;\"><strong>Gamification<\/strong><\/p>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"\">\n<ul>\n<li style=\"\"><span><strong><a href=\"#tve-jump-1775b94aaaa\" style=\"outline: none;\">Lesson Points<\/a><strong>:&nbsp;<\/strong><\/strong>When users Earn Points by Completing Lessons<\/span><\/li>\n<li style=\"\"><span><a href=\"#tve-jump-1775b94e85c\" style=\"outline: none;\">Course Points<\/a><strong><strong>:<\/strong><\/strong> When users Earn Points by Completing a Course<\/span><\/li>\n<li style=\"\"><span><strong><a href=\"#tve-jump-1775b953242\" style=\"outline: none;\">Badge Earned<\/a><strong>:&nbsp;<\/strong><\/strong>When users earn a badge&nbsp;<\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table data-rows=\"2\" data-cols=\"1\" style=\"\">\n<thead>\n<tr>\n<th style=\"\">\n<p style=\"text-align: center;\"><strong>Registration \/ Purchase Events<\/strong><\/p>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"\">\n<ul>\n<li style=\"\"><span><a href=\"#tve-jump-1775b9599dc\" style=\"outline: none;\">Free Registration<\/a><strong><strong>:&nbsp;<\/strong><\/strong>When users signup for your freebie.<\/span><\/li>\n<li style=\"\"><span><a href=\"#tve-jump-1775b95edef\" style=\"outline: none;\">One-Off Payment<\/a><strong><strong>:<\/strong><\/strong> When users purchase your one-off products.<\/span><\/li>\n<li style=\"\"><span><strong><a href=\"#tve-jump-1775b8e080e\" style=\"outline: none;\">Subscription Purchase<\/a><strong>:<\/strong><\/strong> When users purchase your subscription.<\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"text-align: center;\">Subscription Hooks<\/h2>\n<h2 style=\"\" id=\"tve-jump-1775b8e080e\">Name:<span style=\"font-weight: normal;\"> dap_subscription_product_access<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered after a user receives access to a subscription\/membership level. DAP will first give user access to the subscription product, and then you can get DAP to execute your custom code.&nbsp;<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$product_id$order_id<\/p>\n<h4>Example<\/h4>\n<p>add_action ( &#8216;dap_subscription_product_access&#8217;, &#8216;dap_actions_subscription_access&#8217;, 10, 3 );function dap_actions_subscription_access ( $user_id, $product_id, $order_id ) {<\/p>\n<p>include_once &#8220;<a href=\"#tve-jump-1775f1f71a5\" style=\"outline: none;\">PathToDAP<\/a>\/dap-config.php&#8221;;\/\/ your code$product = Dap_Product::loadProduct( $product_id );$name = $product-&gt;getName();$user = Dap_User::loadUserById ( $user_id );$email = $user-&gt;getEmail();}<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_cancelled_subscription<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when users cancel their active subscription or when they request a subscription cancellation (depending on your DAP configuration).<\/p>\n<h4>Parameters<\/h4>\n<p>$order (array)<\/p>\n<h4>Example<\/h4>\n<p>add_action ( &#8216;dap_user_cancelled_subscription&#8217;, &#8216;dap_actions_subscription_cancellation&#8217;, 10, 1 );<\/p>\n<p>function dap_actions_subscription_cancellation (&nbsp; $order &nbsp;)&nbsp; {<\/p>\n<p>include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;$productId = $order[&#8220;productId&#8221;];$recurringId = $order[&#8220;recurringId&#8221;];$paymentProcessor = $order[&#8220;paymentProcessor&#8221;];$transNum = $order[&#8220;transNum&#8221;];$reason = $order[&#8220;cancelReason&#8221;];$type = $order[&#8220;cancelType&#8221;];$product = Dap_Product::loadProduct ( $product_id );$productName = $product-&gt;getName();if ( $user_id != &#8220;&#8221; ) {$user = Dap_User::loadUserById ( $user_id );$email = $user-&gt;getEmail();}if ( &nbsp;( $type ==&#8221;self_cancel&#8221; ) || ( $type ==&#8221;self_cancel_with_reason&#8221; &nbsp;) ) { \/\/already cancelled }else { \/\/ requested cancellation}}<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_paused_subscription<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered after users pause their active subscription<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$product_id$recurring_profile_id$dap_order_number<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_paused_subscription&#8217;, &#8216;dap_actions_subscription_paused&#8217;, 10, 4);<\/p>\n<p>function dap_actions_subscription_paused( $user_id, $product_id, $recurring_profile_id, $dap_order_number ) &nbsp;{<\/p>\n<p>&nbsp; include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;&nbsp; $product = Dap_Product::loadProduct ( $product_id );&nbsp; $productName = $product-&gt;getName();&nbsp; if ( $user_id != &#8220;&#8221; ) {&nbsp; &nbsp; $user = Dap_User::loadUserById ( $user_id );&nbsp; &nbsp;$email = $user-&gt;getEmail();&nbsp; &nbsp;}}&nbsp;<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_resumed_subscription<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered after users resumes their paused subscription<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$product_id$recurring_profile_id$dap_order_number<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_resumed_subscription&#8217;, &#8216;dap_actions_subscription_resumed&#8217;, 10, 4);<\/p>\n<p>function dap_actions_subscription_resumed ( $user_id, $product_id, $recurring_profile_id, $dap_order_number ) &nbsp;{&nbsp; include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;&nbsp;<\/p>\n<p>&nbsp; $product = Dap_Product::loadProduct ( $product_id );&nbsp; $productName = $product-&gt;getName();&nbsp; if ( $user_id != &#8220;&#8221; ) {&nbsp; &nbsp; $user = Dap_User::loadUserById ( $user_id );&nbsp; &nbsp;$email = $user-&gt;getEmail();&nbsp; &nbsp;}}&nbsp;<\/p>\n<h2 style=\"text-align: center;\">Course Hooks<\/h2>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_completed_lesson<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user clicks on the mark as complete button to complete the lesson.<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$course_id$module_id$lesson_id<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_completed_lesson&#8217;, &#8216;dap_action_lesson_completed&#8217;, 10, 4);<\/p>\n<p>function dap_action_lesson_completed ( $user_id, $course_id, $module_id, $lesson_id &nbsp;) &nbsp;{<\/p>\n<p>&nbsp; include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\" style=\"outline: none;\">PathToDAP<\/a>\/dap-config.php&#8221;;&nbsp; $product = Dap_Product::loadProduct ( $course_id );&nbsp; $productName = $product-&gt;getName();&nbsp; if ( $user_id != &#8220;&#8221; ) {&nbsp; &nbsp; $user = Dap_User::loadUserById ( $user_id );&nbsp; &nbsp;$email = $user-&gt;getEmail();&nbsp; &nbsp;}<\/p>\n<p>&nbsp; &nbsp;if($lesson_id!=&#8221;&#8221;) {&nbsp; &nbsp; &nbsp; &nbsp;$lessonObj = Dap_FileResource::getResourceName&nbsp; ( $lesson_id );&nbsp; &nbsp; &nbsp; &nbsp;if ( isset ( $lessonObj ) ) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $lessonName = $lessonObj[&#8216;name&#8217;];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$lessonURL = $lessonObj[&#8216;url&#8217;];&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp;} &nbsp;}&nbsp;<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_completed_module<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user complete all lessons in a module.<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$course_id$module_id$lesson_id<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_completed_module&#8217;, &#8216;dap_action_module_completed&#8217;, 10, 4);<\/p>\n<p>function dap_action_module_completed ( $user_id, $course_id, $module_id, $lesson_id &nbsp;) &nbsp;{<\/p>\n<p>&nbsp; include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;&nbsp; $product = Dap_Product::loadProduct ( $product_id );&nbsp; $productName = $product-&gt;getName();&nbsp; if ( $user_id != &#8220;&#8221; ) {&nbsp; &nbsp; $user = Dap_User::loadUserById ( $user_id );&nbsp; &nbsp;$email = $user-&gt;getEmail();&nbsp; &nbsp;}<\/p>\n<p>&nbsp; &nbsp;if ( isset ( $module_id ) ) {&nbsp; &nbsp; $moduledata = DAP_CourseModule::loadById ( $module_id );&nbsp; &nbsp; if ( isset ( $moduledata ) ) {&nbsp; &nbsp; &nbsp; &nbsp; if ( $course_id != &#8220;&#8221; ) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $product = Dap_Product::loadProduct ( $course_id );&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $courseName = $product-&gt;getName();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp; $module_name = $moduledata-&gt;getModuleName();&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; if ( $lesson_id != &#8220;&#8221; ) {&nbsp; &nbsp; &nbsp; &nbsp;$lessonObj = Dap_FileResource::getResourceName&nbsp; ( $lesson_id );&nbsp; &nbsp; &nbsp; &nbsp;if ( isset ( $lessonObj ) ) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $lessonName = $lessonObj[&#8216;name&#8217;];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$lessonURL = $lessonObj[&#8216;url&#8217;];&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; } &nbsp;}&nbsp;<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_completed_course<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user completes a course.<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$course_id<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_completed_course&#8217;, &#8216;dap_action_course_completed&#8217;, 10, 2);<\/p>\n<p>function dap_action_course_completed ( $user_id, $course_id ) {if ( $course_id != &#8220;&#8221; ) {<\/p>\n<p>&nbsp; include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;&nbsp; $product = Dap_Product::loadProduct ( $course_id );&nbsp; $courseName = $product-&gt;getName();&nbsp; $user = Dap_User::loadUserById ( $user_id ); &nbsp; $email = $user-&gt;getEmail();} }<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_lesson_time_spent<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user completes a lesson. It&#8217;ll tell you how much time your users are spending on each lesson.<\/p>\n<h4>Parameters<\/h4>\n<p>$userCourseProgressObj&nbsp;<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_lesson_time_spent&#8217;, &#8216;dap_action_lesson_time_spent&#8217;, 10, 1);<\/p>\n<p>function dap_action_lesson_time_spent ( $userCourseProgressObj &nbsp;) {if ( isset ( $userCourseProgressObj&nbsp; )&nbsp; ) &nbsp;{<\/p>\n<p>&nbsp;&nbsp;include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;&nbsp; $course_id = $userCourseProgressObj-&gt;getProductId();&nbsp; $module_id = $userCourseProgressObj-&gt;getModuleId();&nbsp; $lesson_id = $userCourseProgressObj-&gt;getUnitId();&nbsp; $initial_time = $userCourseProgressObj-&gt;getInitialTimeSpent();&nbsp; $total_time = $userCourseProgressObj-&gt;getTotalTimeSpent();&nbsp; $start_date = $userCourseProgressObj-&gt;getStartDate();&nbsp; $end_date = $userCourseProgressObj-&gt;getDate();}if($lesson_id!=&#8221;&#8221;) {&nbsp; $lessonObj = Dap_FileResource::getResourceName($lesson_id);&nbsp; if(isset($lessonObj)) {&nbsp; &nbsp; $lessonName=$lessonObj[&#8216;name&#8217;];&nbsp; &nbsp; $lessonURL=$lessonObj[&#8216;url&#8217;];&nbsp; }}<\/p>\n<p>}<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_earned_certificate<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user earns a certificate after completing a course<\/p>\n<h4>Parameters<\/h4>\n<p>$userCourseProgressObj&nbsp;<\/p>\n<h4>Example<\/h4>\n<p>add_action ( &#8216;dap_user_earned_certificate&#8217;, &#8216;dap_action_earned_certificate&#8217;, 10, 2);<\/p>\n<p>function dap_action_user_earned_certificate ( $user_id, $course_id ) {if ($course_id != &#8220;&#8221; ) {<\/p>\n<p>include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;$product = Dap_Product::loadProduct ( $course_id );$courseName = $product-&gt;getName();$user = Dap_User::loadUserById ( $user_id ); $email = $user-&gt;getEmail();} }<\/p>\n<h2 style=\"text-align: center;\">Gamification Hooks<\/h2>\n<h2 id=\"tve-jump-1775b953242\">Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_has_earned_badge<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user earns a badge by completing a certain task&nbsp;(based on your configuration in our GameOfPoints.com plugin).<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$badge_id$product_id$category&nbsp;<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_has_earned_badge&#8217;, &#8216;dap_action_earned_badge&#8217; , 10, 4);<\/p>\n<p>function dap_action_earned_badge ( $user_id, $badge_id, $product_id, $category ) {<\/p>\n<p>include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\" style=\"outline: none;\">PathToDAP<\/a>\/dap-config.php&#8221;;if ( $product_id != &#8220;&#8221; ) {&nbsp; $product = Dap_Product::loadProduct ( $product_id );&nbsp; $productName = $product-&gt;getName();&nbsp; $user = Dap_User::loadUserById ( $user_id ); &nbsp; $email = $user-&gt;getEmail();} }<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_earned_course_points<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user earns points by completing your course.<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$course_id$points<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_earned_course_points&#8217;, &#8216;dap_action_earned_course_points&#8217;, 10, 3 );<\/p>\n<p>function dap_action_earned_course_points ( $user_id, $course_id, $points ) &nbsp;{if ( $course_id != &#8220;&#8221; ) {<\/p>\n<p>&nbsp; include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;&nbsp; $product = Dap_Product::loadProduct ( $course_id );&nbsp; $courseName = $product-&gt;getName();&nbsp; $user = Dap_User::loadUserById ( $user_id ); &nbsp; $email = $user-&gt;getEmail();} }<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_user_earned_lesson_points<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user earns points by completing lessons in your course.<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$course_id$lesson_id$points<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_user_earned_lesson_points&#8217;, &#8216;dap_action_earned_lesson_points&#8217;, 10, 4);<\/p>\n<p>function dap_action_earned_lesson_points ( $user_id, $course_id, $lesson_id, $points ) {if ( $course_id != &#8220;&#8221; ) {<\/p>\n<p>include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;$product = Dap_Product::loadProduct ( $course_id );$courseName = $product-&gt;getName();$user = Dap_User::loadUserById ( $user_id ); $email = $user-&gt;getEmail();} }<\/p>\n<h2 style=\"text-align: center;\">Registration \/ Purchase Hooks<\/h2>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_free_product_access<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a user signs up for your free product.<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$product_id$transaction_id<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_free_product_access&#8217;, &#8216;dap_actions_free_product_registration&#8217;, 10, 3);<\/p>\n<p>function dap_actions_free_product_registration ( $user_id, $product_id, $transaction_id) {<\/p>\n<p>include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;$product = Dap_Product::loadProduct ( $product_id );$productName = $product-&gt;getName();$user = Dap_User::loadUserById ( $user_id );$email = $user-&gt;getEmail();}<\/p>\n<h2>Name:<span style=\"font-weight: normal;\">&nbsp;dap_onetime_product_access<\/span><\/h2>\n<h4>When is it triggered:<\/h4>\n<p>This is triggered when a users purchases a one-off product.<\/p>\n<h4>Parameters<\/h4>\n<p>$user_id$product_id$transaction_id<\/p>\n<h4>Example<\/h4>\n<p>add_action( &#8216;dap_onetime_product_access&#8217;, &#8216;dap_actions_onetime_product_access&#8217;, 10, 3);<\/p>\n<p>function dap_actions_onetime_product_access ( $user_id, $product_id, $transaction_id ) {<\/p>\n<p>include_once &#8220;<a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/?tve=true&amp;tcbf=fcaddfa62f#tve-jump-1775f1f71a5\">PathToDAP<\/a>\/dap-config.php&#8221;;$product = Dap_Product::loadProduct ( $product_id );$productName = $product-&gt;getName();$user = Dap_User::loadUserById ( $user_id );$email = $user-&gt;getEmail();}<\/p>\n<h2 style=\"text-align: center;\">Path to the DAP folder<\/h2>\n<p>Visit the URL below in a browser window (replace YourSite.com with your actual domain name):<\/p>\n<p><strong>https:\/\/YourSite.com\/dap\/getpath.php<\/strong><\/p>\n<p>This will show something like this in your browser:\/home\/path\/to\/dapThis is your path to the DAP folder.<\/p>\n<p>For e.g.: include_once &#8220;<strong>PathToDAP<\/strong>\/dap-config.php&#8221;;<\/p>\n<p>&nbsp;\/\/ You can replace it with this path:&nbsp;include_once &#8220;<strong>\/home\/path\/to\/dap<\/strong>\/dap-config.php&#8221;; &nbsp;<\/p>\n<p>We&#8217;ve just gotten started with action hooks in DAP! We plan on adding a ton more action and filter hooks to this list. Stay tuned!<\/p>\n<h1 style=\"text-align: center;\"><em><strong>Membership Site in 30 Minutes!<\/strong><\/em><\/h1>\n<p>Looking to build a membership site but feeling stressed about everything you need to do from content creation to the actual implementation, and not sure where to start?<\/p>\n<p>Recently, we tested Digital Access Pass (DAP) on a new webhosting platform. We were able to fully setup and configure a DAP-powered membership site, with beautiful, elegant member-facing pages, in just 15 minutes!<\/p>\n<p><strong><a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/lets-build-a-membership-site\/\" style=\"outline: none;\" target=\"_blank\" rel=\"noopener noreferrer\">Watch this video<\/a><\/strong> for a behind-the-scenes look at <a href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/lets-build-a-membership-site\/\" style=\"outline: none;\" target=\"_blank\" rel=\"noopener noreferrer\">how to build a brand new membership site<\/a> &#8211; with free products, paid products, membership levels, online courses, etc., quickly <strong>in just 30 minutes<\/strong>!<\/p>\n<p style=\"\"><em><strong>My Online Course Launch Strategy<\/strong><\/em><\/p>\n<p><span><span><strong>The 3 main challenges that most people face when it comes to building and launching an online course:&nbsp;<\/strong><\/span><\/span><\/p>\n<p><span><span>1. No list or small list.2. Busy schedule.3. Don&#8217;t know how to put it all together, organize and deliver.<\/span><\/span><span><\/span><span>So I decided to create a FREE training video to show you the exact steps I follow to build my list, create and organize my course content, and the order in which I execute in every phase &#8211; from idea, planning, audience building, content creation, implementation to the actual launch.<\/span><\/p>\n<p style=\"text-align: center;\"><em><strong>No Audience? No List? No problem!&nbsp;<\/strong><\/em><\/p>\n<h1 style=\"text-align: center;\"><strong>FREE: Let&#8217;s Build an Online Course<\/strong><\/h1>\n<h2 style=\"text-align: center;\"><strong><em>A-Z <span>Blueprint<\/span>:&nbsp;<\/em>For Creating And Delivering&nbsp;<\/strong><strong>A Wildly <em>Successful<\/em> Online Course!<\/strong><\/h2>\n<p><span style=\"font-family: Literata; font-weight: 400; font-size: 19px;\">In this FREE course, I&#8217;ve broken down the entire course creation process,<strong>&nbsp;<\/strong><\/span><span style=\"font-family: Literata; font-size: 19px;\">from how to build an audience to how to create and launch a course<\/span><span style=\"font-family: Literata; font-weight: 400; font-size: 19px;\">, into easy-to-understand and implement steps. <\/span><\/p>\n<p><span style=\"font-family: Literata; font-weight: 400; font-size: 19px;\">Once your complete the course, you&#8217;ll be able to build your own course confidently, without any stress or overwhelm!<\/span><\/p>\n<h1 data-purpose=\"lead-title\" style=\"text-align: left;\"><a href=\"https:\/\/membershipsitelab.com\" style=\"outline: none;\" target=\"_blank\" rel=\"noopener noreferrer\"><span>Signup below<\/span><\/a><span style=\"font-weight: normal;\"><span> to get instant access.<\/span><\/span><\/h1>\n<h1 style=\"text-align: center;\"><strong>Need help with planning<\/strong><\/h1>\n<h1 style=\"text-align: center;\"><strong>&nbsp;and implementation?<\/strong><\/h1>\n<h2 style=\"text-align: center;\"><em>Done for YOU!<\/em><\/h2>\n<p><a href=\"https:\/\/DigitalAccessPass.com\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\">DAP<\/a> is easy-to-use and setup. However, we also offer <strong>FREE 3 hours<\/strong>&nbsp;of&nbsp;<a href=\"https:\/\/DigitalAccessPass.com\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\"><strong>one-on-one concierge calls<\/strong><\/a><strong>&nbsp;<\/strong>with&nbsp;<strong>DAP&#8217;s Elite License &nbsp;(Monthly \/ Annual)<\/strong>. We share our screen on the call so you can actually see and learn with us.&nbsp;<\/p>\n<p>The 3 hours of time can be used for membership site planning, brainstorm strategy and implementation.<\/p>\n<p>So if you need a little extra help and don&#8217;t have the time to figure it all out, we highly recommend the DAP Elite Package. Click on the button below to get started with the DAP Elite License. With all the plugins and extra help included in this package, there is no better investment for your business than this!&nbsp;<\/p>\n<h1 style=\"text-align: center;\"><strong>Share with Friends &amp; Followers<\/strong><\/h1>\n","protected":false},"excerpt":{"rendered":"<p>What are WordPress Hooks? WordPress hooks allow you to modify or add features to WordPress without touching the core files. Using hook functions, you can get WordPress to execute your custom code, &nbsp;registered via a callback function, at different points. WordPress will allow you to augment or replace the feature that your callback is hooked [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":13486,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Extend Your DAP Membership Site Functionality &#8211; Using WordPress Action Hooks! - The DAP Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extend Your DAP Membership Site Functionality &#8211; Using WordPress Action Hooks! - The DAP Blog\" \/>\n<meta property=\"og:description\" content=\"What are WordPress Hooks? WordPress hooks allow you to modify or add features to WordPress without touching the core files. Using hook functions, you can get WordPress to execute your custom code, &nbsp;registered via a callback function, at different points. WordPress will allow you to augment or replace the feature that your callback is hooked [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/\" \/>\n<meta property=\"og:site_name\" content=\"The DAP Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DigitalAccessPass\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-31T19:43:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-01T20:49:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.digitalaccesspass.com\/blog\/wp-content\/uploads\/2021\/01\/actionhooks.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"Veena Prashanth\">\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" content=\"9 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#organization\",\"name\":\"DigitalAccessPass\",\"url\":\"https:\/\/www.digitalaccesspass.com\/blog\/\",\"sameAs\":[\"https:\/\/www.facebook.com\/DigitalAccessPass\",\"https:\/\/twitter.com\/poweredbydap\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.digitalaccesspass.com\/blog\/wp-content\/uploads\/2014\/12\/cdcaseblankdisc_800x550.jpg\",\"width\":800,\"height\":550,\"caption\":\"DigitalAccessPass\"},\"image\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#website\",\"url\":\"https:\/\/www.digitalaccesspass.com\/blog\/\",\"name\":\"The DAP Blog\",\"description\":\"Membership Plugin For WordPress\",\"publisher\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.digitalaccesspass.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.digitalaccesspass.com\/blog\/wp-content\/uploads\/2021\/01\/actionhooks.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#webpage\",\"url\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/\",\"name\":\"Extend Your DAP Membership Site Functionality &#8211; Using WordPress Action Hooks! - The DAP Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#primaryimage\"},\"datePublished\":\"2021-01-31T19:43:27+00:00\",\"dateModified\":\"2021-02-01T20:49:38+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/\"]}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#\/schema\/person\/7723f6dd886cc25c293e0e2dc450f7c3\"},\"headline\":\"Extend Your DAP Membership Site Functionality &#8211; Using WordPress Action Hooks!\",\"datePublished\":\"2021-01-31T19:43:27+00:00\",\"dateModified\":\"2021-02-01T20:49:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#primaryimage\"},\"articleSection\":\"DAP\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.digitalaccesspass.com\/blog\/2021\/01\/custom-wordpress-hooks-to-extend-your-membership-site-functionality\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#\/schema\/person\/7723f6dd886cc25c293e0e2dc450f7c3\",\"name\":\"Veena Prashanth\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.digitalaccesspass.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0c6657fd51744b9b372731bef0730f08?s=96&d=mm&r=g\",\"caption\":\"Veena Prashanth\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/posts\/13360"}],"collection":[{"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/comments?post=13360"}],"version-history":[{"count":157,"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/posts\/13360\/revisions"}],"predecessor-version":[{"id":13520,"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/posts\/13360\/revisions\/13520"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/media\/13486"}],"wp:attachment":[{"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/media?parent=13360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/categories?post=13360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.digitalaccesspass.com\/blog\/wp-json\/wp\/v2\/tags?post=13360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}