├── .gitignore ├── LICENSE ├── README.md ├── attention-message └── attention-message.php ├── categories-shortcode └── categories-shortcode.php ├── css-snippets ├── css-snippets.php └── single-job.css ├── custom-application-status └── custom-application-status.php ├── custom-payment-type └── custom-payment-type.php ├── customize-single-job └── customize-single-job.php ├── disable-double-applications └── disable-double-applications.php ├── expiration-date-filter └── expiration-date-filter.php ├── feeds-api └── feeds-api.php ├── full-candidate-registration └── full-candidate-registration.php ├── password-reminder-link └── password-reminder-link.php ├── post-import-action └── post-import-action.php ├── register-using-email └── register-using-email.php ├── sort-application-cf └── sort-application-cf.php ├── upload-from-dropbox ├── upload-from-dropbox.js └── upload-from-dropbox.php ├── user-panel-api ├── custom-template.php └── user-panel-api.php └── wpjobboard-snippets.php /.gitignore: -------------------------------------------------------------------------------- 1 | wpjobboard-tester.php 2 | /nbproject 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WPJobBoard - WordPress Job Board Plugin - Snippets 2 | ======================== 3 | 4 | This is official library of useful and practical code snippets for [WPJobBoard - WordPress Job Board Plugin](http://wpjobboard.net/), the codes here modify default WPJobBoard behavior, add some extra feature or explain WPJB APIs. 5 | 6 | Most of the codes here will never make it into default WPAJobBoard version mainly because they provide some functionality that only handful of users will find useful. 7 | 8 | ## Using Snippets 9 | 10 | 1. Click on the filename of the snippet you'd like to use. Each file is set up to be a WordPress plugin. 11 | 2. Click the "Raw" button (next to "Blame" and "History") at the top right. 12 | 3. Save the page from your browser to your wp-content/plugins folder and upload to your server. Alternatively you can compress the file as a .zip file and upload as a plugin from within WordPress. 13 | 4. Activate the plugin from the WordPress plugins page. 14 | 15 | [Need more help installing plugins?](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins) 16 | 17 | ## Notes 18 | 19 | The code snippet are provided here for free without any guarantee. 20 | -------------------------------------------------------------------------------- /attention-message/attention-message.php: -------------------------------------------------------------------------------- 1 | from("Wpjb_Model_Job t"); 25 | $query->where("post_id = ?", get_the_ID()); 26 | $query->limit(1); 27 | $result = $query->execute(); 28 | 29 | if(isset($result[0])) { 30 | $job = $result[0]; 31 | } 32 | } 33 | 34 | if(is_wpjb() && wpjb_is_routed_to("index.single")) { 35 | $job = Wpjb_Project::getInstance()->placeHolder->job; 36 | } 37 | 38 | if($job === null) { 39 | return; 40 | } 41 | 42 | $old = wpjb_conf("front_mark_as_old"); 43 | 44 | if($old>0 && time()-strtotime($job->job_created_at)>$old*3600*24) { 45 | $diff = floor((time()-strtotime($job->job_created_at))/(3600*24)); 46 | $msg = _n( 47 | "Attention! This job posting is one day old and might be already filled.", 48 | "Attention! This job posting is %d days old and might be already filled.", 49 | $diff, 50 | "wpjobboard" 51 | ); 52 | 53 | $flash = new Wpjb_Utility_Session(); 54 | $flash->addInfo(sprintf($msg, $diff)); 55 | $flash->save(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /categories-shortcode/categories-shortcode.php: -------------------------------------------------------------------------------- 1 | true, 26 | 'hide_empty' => true 27 | ), $atts, 'wpjb_categories_list' ); 28 | 29 | $categories = wpjb_get_categories(); 30 | 31 | ob_start() 32 | ?> 33 | 51 | 4, 67 | "key" => "waiting", 68 | "color" => "brown", 69 | "bulb" => null, 70 | "label" => "Waiting", 71 | "public" => 0, 72 | "notify_applicant_email" => null, 73 | "labels" => array( 74 | "multi_success" => __("Number of applications set to 'Waiting': {success}", "wpjobboard"), 75 | ), 76 | "callback" => array( 77 | "multi" => "application_status_set_to_waiting" 78 | ) 79 | ); 80 | 81 | return $list; 82 | } 83 | 84 | /** 85 | * Changes application status to 'waiting' 86 | * 87 | * @param integer $id Wpjb_Model_Application::$id 88 | * @return boolean True if status was changed, fasle otherwise 89 | */ 90 | function application_status_set_to_waiting( $id ) { 91 | 92 | $object = new Wpjb_Model_Application($id); 93 | $object->status = 4; 94 | $object->save(); 95 | 96 | // Note: doing $object->save() will trigger sending 'notify_applicant_email' notification 97 | // configured in application_status_register() function. 98 | 99 | // do something more here ... 100 | 101 | return true; 102 | } -------------------------------------------------------------------------------- /custom-payment-type/custom-payment-type.php: -------------------------------------------------------------------------------- 1 | create("price_for", "hidden"); 40 | $e->setValue(210); 41 | $this->addElement($e); 42 | 43 | parent::init(); 44 | } 45 | 46 | } 47 | } 48 | 49 | /** 50 | * Register new payment type 51 | * 52 | * @param array $list List of payment types 53 | * @return array Modified $list 54 | */ 55 | function custom_payment_type_list( $list ) { 56 | $list[] = array( 57 | "id" => 210, 58 | "name" => "my-candidate-membership", 59 | "form" => "Custom_Payment_Type_Config_Form", 60 | "title" => "Candidate Membership" 61 | ); 62 | return $list; 63 | } 64 | 65 | /** 66 | * Generate edit link for wp-admin / Job Board / Payments panel. 67 | * 68 | * @param $item Wpjb_Model_Payment 69 | * @return void 70 | */ 71 | function custom_payment_type_for( $item ) { 72 | $request = Daq_Request::getInstance(); 73 | $action = $request->get("action"); 74 | 75 | $pricing = new Wpjb_Model_Pricing($item->pricing_id); 76 | $wrap = "span"; 77 | 78 | if( $pricing->price_for != 210 ) { 79 | return; 80 | } 81 | 82 | if( $action != "edit" ) { 83 | // show icon only on payments list page 84 | $text = sprintf('Candidate Membership (ID %d)', $item->id); 85 | $icon = sprintf('', $text); 86 | $wrap = "strong"; 87 | echo $icon; 88 | } 89 | 90 | $object = new Wpjb_Model_Resume($item->object_id); 91 | 92 | $user = $object->getUser(true); 93 | 94 | $object_url = esc_attr(wpjb_admin_url("resumes", "edit", $object->id)); 95 | $object_title = esc_html(trim($user->display_name)); 96 | 97 | $title = '<%1$s>%3$s'; 98 | 99 | printf( $title, $wrap, $object_url, $object_title ); 100 | } 101 | 102 | /** 103 | * Set object id and type when creatng a payment 104 | * 105 | * @param array $data Array("id"=>..., "type"=>...); 106 | * @param Wpjb_Model_Pricing $pricing Pricing object 107 | * @return array 108 | */ 109 | function custom_payment_type_object( $data, $pricing ) { 110 | 111 | if($pricing->price_for != 210) { 112 | return $data; 113 | } 114 | 115 | return array( 116 | "id" => Daq_Request::getInstance()->post("object_id"), 117 | "type" => 9 // <= set your object type here (9 - 250) 118 | ); 119 | } 120 | 121 | /** 122 | * Accepts payment made by user 123 | * 124 | * This function is executed by wpjb_payment_accept filter in Wpjb_Model_Payment::accepted() 125 | * 126 | * @see wpjb_payment_accept filter 127 | * @see Wpjb_Model_Payment::accepted(); 128 | * 129 | * @param boolean $accepted 130 | * @param Wpjb_Model_Payment $payment Payment object 131 | * @return boolean True if payment was accepted properly, false otherwise 132 | */ 133 | function custom_payment_type_accept( $accepted, $payment ) { 134 | if( $accepted === true) { 135 | // most likely one of default payment types 136 | return true; 137 | } 138 | 139 | $pricing = new Wpjb_Model_Pricing($payment->pricing_id); 140 | $list = new Wpjb_List_Pricing(); 141 | $listing = $list->getBy("id", $pricing->price_for); 142 | 143 | if( is_null($listing) || $listing['id'] != 210 ) { 144 | return $accepted; 145 | } 146 | 147 | $payment->log("Success!!!"); 148 | 149 | return true; 150 | } 151 | 152 | /** 153 | * Payment form which allows to make payment for candidate membership 154 | * 155 | * Always use this shortcode with pricing_id param for example 156 | * [custom_payment_type_form pricing_id="100"] 157 | * where 100 is actual ID of pricing created in wp-admin / Settings (WPJB) / Pricing 158 | * panel. 159 | * 160 | * @param array $atts List of shortcode params 161 | * @return string Rendered payment form 162 | */ 163 | function custom_payment_type_form( $atts ) { 164 | $params = shortcode_atts(array( 165 | "pricing_id" => null, 166 | ), $atts); 167 | 168 | $flash = new Wpjb_Utility_Session(); 169 | $pricing = new Wpjb_Model_Pricing($params["pricing_id"]); 170 | 171 | if( !$pricing->exists() ) { 172 | return; 173 | } 174 | 175 | if( $pricing->price_for != 210 ) { 176 | return; 177 | } 178 | 179 | $list = new Wpjb_List_Pricing(); 180 | $listing = $list->getBy("id", $pricing->price_for); 181 | 182 | $view = Wpjb_Project::getInstance()->getApplication("frontend")->getView(); 183 | $view->atts = $atts; 184 | $view->pricing = $pricing; 185 | $view->gateways = Wpjb_Project::getInstance()->payment->getEnabled(); 186 | $view->pricing_item = $listing["title"] . " "" . $pricing->title . """; 187 | $view->defaults = new Daq_Helper_Html("span", array( 188 | "id" => "wpjb-checkout-defaults", 189 | "class" => "wpjb-none", 190 | 191 | "data-pricing_id" => $pricing->id, 192 | "data-object_id" => Wpjb_Model_Resume::current()->id, 193 | "data-fullname" => wp_get_current_user()->display_name, 194 | "data-email" => wp_get_current_user()->user_email, 195 | 196 | ), " "); 197 | 198 | Wpjb_Project::getInstance()->placeHolder = $view; 199 | 200 | wp_enqueue_style("wpjb-css"); 201 | wp_enqueue_script('wpjb-js'); 202 | 203 | ob_start(); 204 | $view->render("../default/payment.php"); 205 | $render = ob_get_clean(); 206 | 207 | 208 | return $render; 209 | } 210 | 211 | /** 212 | * Allows to display custom payment success message 213 | * 214 | * @param array $messages List of success messages 215 | * @param Wpjb_Model_Payment $payment Current payment object 216 | * @return string Rendered payment form 217 | */ 218 | function custom_payment_type_messages($messages, $payment) { 219 | 220 | $pricing = new Wpjb_Model_Pricing($payment->pricing_id); 221 | $list = new Wpjb_List_Pricing(); 222 | $listing = $list->getBy("id", $pricing->price_for); 223 | 224 | if( is_null($listing) || $listing['id'] != 210 ) { 225 | return $messages; 226 | } 227 | 228 | $messages = array(); 229 | $messages[] = "Thank you for submitting your order."; 230 | // more $messages[] here ... 231 | 232 | return $messages; 233 | } 234 | -------------------------------------------------------------------------------- /customize-single-job/customize-single-job.php: -------------------------------------------------------------------------------- 1 | getCompany(true); 29 | 30 | if(!$company) { 31 | return; 32 | } 33 | 34 | ?> 35 |
  • 36 | meta->is_remote) && $company->meta->is_remote->value()): ?> 37 | 38 | 39 | 40 | 41 | 42 | 43 |
  • 44 | 62 |
    63 |
    64 |
    65 | id) ?> 66 |
    67 |
    68 | 86 |
    87 |
    88 |
    89 | job_expires_at)) ?> 90 |
    91 |
    92 | 110 |
    111 |
    112 |
    113 | company_email) ?> 114 |
    115 |
    116 | getCompany(true); 135 | $user = $company->getUser(true); 136 | ?> 137 |
    138 | %s", $user->user_login); ?> 139 |
    140 | 158 | 159 | 194 | 211 | from("Wpjb_Model_Application t"); 29 | $query->where("user_id = ?", $id); 30 | $query->where("job_id = ?", $job->id); 31 | $query->limit(1); 32 | 33 | $result = $query->execute(); 34 | 35 | if( !empty($result) ) { 36 | $cond = false; 37 | if( get_query_var("applied") != $job->id && $ctrl ) { 38 | $ctrl->addError("You already applied for this job."); 39 | } 40 | } 41 | 42 | return $cond; 43 | } 44 | 45 | if( Daq_Request::getInstance()->post( "email" ) ) { 46 | $query = new Daq_Db_Query(); 47 | $query->from("Wpjb_Model_Application t"); 48 | $query->where("email = ?", Daq_Request::getInstance()->post( "email" ) ); 49 | $query->where("job_id = ?", $job->id); 50 | $query->limit(1); 51 | 52 | $result = $query->execute(); 53 | 54 | if( !empty($result) ) { 55 | $cond = false; 56 | if( get_query_var("applied") != $job->id && $ctrl ) { 57 | $ctrl->addError("You (or someone using your email address) already applied for this job."); 58 | } 59 | } 60 | 61 | return $cond; 62 | } 63 | 64 | return $cond; 65 | } -------------------------------------------------------------------------------- /expiration-date-filter/expiration-date-filter.php: -------------------------------------------------------------------------------- 1 | hasElement( "custom_expiration_date" ) ) { 24 | $job_expires_at = $form->getElement( "custom_expiration_date" )->getValue(); 25 | } 26 | 27 | return $job_expires_at; 28 | } 29 | 30 | /** 31 | * Handles meta field 32 | * 33 | * This function registers new meta field named "custom_expiration_date" and 34 | * adds it to the [wpjb_jobs_add] form. 35 | * 36 | * @param Wpjb_Form_Abstract_Job $form Form to customize 37 | * @return Wpjb_Form_Abstract_Job 38 | */ 39 | function expiration_date_filter_init( Wpjb_Form_Abstract_Job $form ) { 40 | if( is_admin() ) { 41 | return $form; 42 | } 43 | 44 | wpjb_meta_register("job", "custom_expiration_date"); 45 | 46 | $e = $form->create("custom_expiration_date", "text_date"); 47 | $e->setLabel( "Expiration Date" ); 48 | $e->setDateFormat(wpjb_date_format()); 49 | $e->setRequired( true ); 50 | $form->addElement($e, "job"); 51 | 52 | return $form; 53 | } -------------------------------------------------------------------------------- /feeds-api/feeds-api.php: -------------------------------------------------------------------------------- 1 | tag. 22 | * 23 | * This function is being called by wpjb_xml_api_* action, you can find it in 24 | * wpjobboard/application/libraries/Module/Api/Xml.php 25 | * 26 | * @param Wpjb_Model_Job $job Job currently rendered to XML 27 | */ 28 | function feeds_api_aggregators(Wpjb_Model_Job $job) { 29 | // Daq_Helper_Xml helps to generate valid XML tags, this class definition you 30 | // can find in wpjobboard/framework/Helper/Xml.php 31 | $xml = new Daq_Helper_Xml(); 32 | 33 | // Using default fields 34 | $xml->tag("expires_at", $job->job_expires_at); 35 | // Using meta fields 36 | $xml->tag("job_description_format", $job->meta->job_description_format->value()); 37 | 38 | } 39 | 40 | /** 41 | * Applying filter to RSS feeds 42 | */ 43 | add_filter("wpjb_xml_api_rss", "feeds_api_rss", 10, 3); 44 | 45 | /** 46 | * This function appends expires_at and job_description_format tags into RSS 47 | * tag. 48 | * 49 | * Function is applied once for each in the feed and the additional data 50 | * is appended to the end of "item". 51 | * 52 | * @param DomElement $item http://php.net/manual/en/class.domelement.php 53 | * @param DomDocument $rss http://php.net/manual/en/class.domdocument.php 54 | * @param Wpjb_Model_Job $job Job currently rendered to XML 55 | * @return DomElement Modified DomElement object 56 | */ 57 | function feeds_api_rss($item, $rss, $job) { 58 | // Using default fields 59 | $item->appendChild($rss->createElement("expires_at", esc_html($job->job_expires_at))); 60 | // Using meta fields 61 | $item->appendChild($rss->createElement("job_description_format", esc_html($job->meta->job_description_format->value()))); 62 | 63 | // Make sure to return $item 64 | return $item; 65 | } -------------------------------------------------------------------------------- /full-candidate-registration/full-candidate-registration.php: -------------------------------------------------------------------------------- 1 | getElement("user_email")->getValue(); 45 | 46 | if(!$this->hasElement("user_login")) { 47 | $user_login = $user_email; 48 | } else { 49 | $user_login = $this->getElement("user_login")->getValue(); 50 | } 51 | 52 | $id = wp_insert_user(array( 53 | "user_login" => $user_login, 54 | "user_email" => $user_email, 55 | "user_pass" => $this->getElement("user_password")->getValue(), 56 | "first_name" => $this->getFieldValue("first_name"), 57 | "last_name" => $this->getFieldValue("ldap_start_tlsname"), 58 | "role" => "subscriber" 59 | )); 60 | 61 | $fullname = $this->value("first_name")." ".$this->value("last_name"); 62 | 63 | if(wpjb_conf("cv_approval") == 1) { 64 | $active = 0; // manual approval 65 | } else { 66 | $active = 1; 67 | } 68 | 69 | $resume = new Wpjb_Model_Resume(); 70 | $resume->candidate_slug = Wpjb_Utility_Slug::generate(Wpjb_Utility_Slug::MODEL_RESUME, $fullname); 71 | $resume->phone = ""; 72 | $resume->user_id = $id; 73 | $resume->headline = ""; 74 | $resume->description = ""; 75 | $resume->created_at = date("Y-m-d"); 76 | $resume->modified_at = date("Y-m-d"); 77 | $resume->candidate_country = wpjb_locale(); 78 | $resume->candidate_zip_code = ""; 79 | $resume->candidate_state = ""; 80 | $resume->candidate_location = ""; 81 | $resume->is_public = wpjb_conf("cv_is_public", 1); 82 | $resume->is_active = $active; 83 | $resume->save(); 84 | $resume->cpt(); 85 | 86 | $this->setObject($resume); 87 | 88 | apply_filters("wpjr_form_save_register", $this); 89 | 90 | parent::save($append); 91 | 92 | $resume->created_at = current_time("mysql"); 93 | $resume->candidate_slug = Wpjb_Utility_Slug::generate(Wpjb_Utility_Slug::MODEL_RESUME, $fullname); 94 | $resume->save(); 95 | 96 | return $resume->id; 97 | } 98 | 99 | /** 100 | * Saves resume details (experience and education) in database 101 | * 102 | * @access public 103 | * @return void 104 | */ 105 | public function saveDetails() 106 | { 107 | foreach($this->_detail as $key => $detail) { 108 | if($detail["delete"] == true) { 109 | $this->_detail[$key]["form"]->getObject()->delete(); 110 | unset($this->_detail[$key]); 111 | } else { 112 | $this->_detail[$key]["form"]->getElement("resume_id")->setValue($this->getObject()->id); 113 | $this->_detail[$key]["form"]->save(); 114 | $id = $this->_detail[$key]["form"]->getObject()->id; 115 | $this->_detail[$key]["form"]->getElement("id")->setValue($id); 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | /** 123 | * Saves candidate in DB 124 | * 125 | * This function is executed in "init" action. 126 | * 127 | * Validates and saves resume in database. This action is executed only if 128 | * there is $_POST["_wpjb_action"] == reg_candidate_alt. 129 | * 130 | * @since 1.0 131 | * @return void 132 | */ 133 | function full_candidate_register_action() { 134 | 135 | $form = new Wpjb_Form_Resume_Alt(); 136 | $request = Daq_Request::getInstance(); 137 | $flash = new Wpjb_Utility_Session(); 138 | 139 | if($request->post("_wpjb_action") != "reg_candidate_alt") { 140 | return; 141 | } 142 | 143 | $isValid = $form->isValid($request->getAll()); 144 | 145 | if(!$isValid) { 146 | return; 147 | } 148 | 149 | $form->save(); 150 | 151 | $url = wpjr_link_to("login"); 152 | $password = $form->value("user_password"); 153 | $email = $form->value("user_email"); 154 | $username = $form->value("user_login"); 155 | if(empty($username)) { 156 | $username = $email; 157 | } 158 | 159 | $mail = Wpjb_Utility_Message::load("notify_canditate_register"); 160 | $mail->setTo($email); 161 | $mail->assign("username", $username); 162 | $mail->assign("password", $password); 163 | $mail->assign("login_url", $url); 164 | $mail->send(); 165 | 166 | do_action("wpjb_user_registered", "candidate"); 167 | 168 | $form = new Wpjb_Form_Resumes_Login(); 169 | if($form->hasElement("recaptcha_response_field")) { 170 | $form->removeElement("recaptcha_response_field"); 171 | } 172 | 173 | $form->isValid(array( 174 | "user_login" => $username, 175 | "user_password" => $password, 176 | "remember" => 0 177 | )); 178 | 179 | $flash->addInfo(__("You have been registered.", "wpjobboard")); 180 | $flash->save(); 181 | 182 | wp_redirect(wpjr_link_to("myresume_home")); 183 | exit; 184 | } 185 | 186 | /** 187 | * Adds registration fields to Wpjb_Form_Resume form. 188 | * 189 | * The form needs additional registration fields as by default it is not equipped 190 | * to handle user registration. 191 | * 192 | * Functiona is applied using wpjr_form_init_resume filter. 193 | * 194 | * @see wpjr_form_init_resume filter 195 | * 196 | * @since 1.0 197 | * @param Daq_Form_ObjectAbstract $form 198 | * @return Daq_Form_ObjectAbstract 199 | */ 200 | function full_candidate_register_form_init( $form ) { 201 | if($form->getId() > 0) { 202 | return $form; 203 | } 204 | 205 | $form->addGroup("auth", __("Account", "wpjobboard"), 0); 206 | 207 | $e = $form->create("_wpjb_action", "hidden"); 208 | $e->setValue("reg_candidate_alt"); 209 | $form->addElement($e, "_internal"); 210 | 211 | $e = $form->create("user_login"); 212 | $e->setOrder(1); 213 | $e->setLabel(__("Username", "wpjobboard")); 214 | $e->setRequired(true); 215 | $e->addFilter(new Daq_Filter_Trim()); 216 | $e->addFilter(new Daq_Filter_WP_SanitizeUser()); 217 | $e->addValidator(new Daq_Validate_WP_Username()); 218 | $form->addElement($e, "auth"); 219 | 220 | $e = $form->create("user_password", "password"); 221 | $e->setOrder(1.01); 222 | $e->setLabel(__("Password", "wpjobboard")); 223 | $e->addFilter(new Daq_Filter_Trim()); 224 | $e->addValidator(new Daq_Validate_StringLength(4, 32)); 225 | $e->addValidator(new Daq_Validate_PasswordEqual("user_password2")); 226 | $e->setRequired(true); 227 | $form->addElement($e, "auth"); 228 | 229 | $e = $form->create("user_password2", "password"); 230 | $e->setOrder(1.02); 231 | $e->setLabel(__("Password (repeat)", "wpjobboard")); 232 | $e->setRequired(true); 233 | $form->addElement($e, "auth"); 234 | 235 | return $form; 236 | } 237 | 238 | /** 239 | * Generates content for [wpjb_candidate_register] shortcode. 240 | * 241 | * This function replaces default [wpjb_candidate_register] shortcode with form 242 | * which renders full My Resume form. 243 | * 244 | * @param array $atts Shortcode params 245 | * @return string Shortcode HTML 246 | */ 247 | function full_candidate_register_ext( $atts = array() ) { 248 | 249 | $params = shortcode_atts(array( 250 | "job_id" => null 251 | ), $atts); 252 | 253 | $request = Daq_Request::getInstance(); 254 | $view = Wpjb_Project::getInstance()->getApplication("resumes")->getView(); 255 | 256 | if(get_current_user_id() > 0) { 257 | $view->_flash->addError(__("You are already registered.", "wpjobboard")); 258 | ob_start(); 259 | wpjb_flash(); 260 | return ob_get_clean(); 261 | } 262 | 263 | wp_enqueue_script("jquery"); 264 | wp_enqueue_script("wpjb-js"); 265 | wp_enqueue_script("wpjb-myresume"); 266 | wp_enqueue_script("wpjb-plupload"); 267 | wp_enqueue_style("wpjb-css"); 268 | 269 | $form = new Wpjb_Form_Resume_Alt(); 270 | 271 | if(isset($_POST) && !empty($_POST)) { 272 | if($form->isValid($request->getAll())) { 273 | // do nothing 274 | } else { 275 | $view->_flash->addError(__("There are errors in your form.", "wpjobboard")); 276 | } 277 | 278 | } 279 | 280 | $form->buildPartials(); 281 | 282 | $view->form = $form; 283 | $view->submit = __("Send Application", "wpjobboard"); 284 | $view->breadcrumbs = array(); 285 | $view->resume = new Wpjb_Model_Resume(); 286 | $view->shortcode = true; 287 | 288 | if(Wpjb_Project::getInstance()->placeHolder === null) { 289 | Wpjb_Project::getInstance()->placeHolder = new stdClass(); 290 | } 291 | 292 | Wpjb_Project::getInstance()->placeHolder->_flash = $view->_flash; 293 | 294 | add_filter("wpjb_breadcrumbs", "__return_empty_string"); 295 | 296 | ob_start(); 297 | ?> 298 | 303 | render("my-resume.php"); 305 | return str_replace('"Update"', '"Register"', ob_get_clean()); 306 | } -------------------------------------------------------------------------------- /password-reminder-link/password-reminder-link.php: -------------------------------------------------------------------------------- 1 | buttons; 26 | 27 | // Add another button (technically this can be any HTML tag) 28 | $buttons[] = array( 29 | "tag" => "a", 30 | "href" => wp_lostpassword_url(), 31 | "html" => "Remind Password" 32 | ); 33 | // Note you cannot modify $view->buttons array directly, 34 | // you can only assign value to it. 35 | $view->buttons = $buttons; 36 | return $view; 37 | } 38 | -------------------------------------------------------------------------------- /post-import-action/post-import-action.php: -------------------------------------------------------------------------------- 1 | getId() > 0) { 30 | return $form; 31 | } 32 | 33 | if($form->hasElement("user_login")) { 34 | $form->removeElement("user_login"); 35 | } 36 | 37 | if($form->getGroup("auth") !== null) { 38 | $form->getGroup("auth")->setOrder(10000); 39 | } 40 | 41 | if($form->hasElement("user_email")) { 42 | $form->getElement("user_email")->addValidator(new Daq_Validate_WP_Username); 43 | } 44 | 45 | return $form; 46 | } -------------------------------------------------------------------------------- /sort-application-cf/sort-application-cf.php: -------------------------------------------------------------------------------- 1 | field_name = $field_name; 19 | $this->column_name = $column_name; 20 | $this->label = $label; 21 | 22 | add_action( "wpjb_custom_columns_head", array( $this, "columns_head" ) ); 23 | add_action( "wpjb_custom_columns_body", array( $this, "columns_body" ), 10, 2 ); 24 | 25 | add_filter( "wpjb_sort_applications_allowed_fields", array( $this, "allowed_fields" ) ); 26 | add_filter( "wpjb_applications_query", array( $this, "query" ) ); 27 | } 28 | 29 | public function allowed_fields( $fields ) { 30 | $fields[] = $this->column_name; 31 | return $fields; 32 | } 33 | 34 | public function query( $select ) { 35 | 36 | if(Daq_Request::getInstance()->get("sort") != $this->column_name) { 37 | return $select; 38 | } 39 | 40 | if(Daq_Request::getInstance()->get("order") == "asc") { 41 | $order = "ASC"; 42 | } else { 43 | $order = "DESC"; 44 | } 45 | 46 | $query = new Daq_Db_Query(); 47 | $query->select("t.id"); 48 | $query->from("Wpjb_Model_Meta t"); 49 | $query->where("t.name = ?", $this->field_name); 50 | $query->where("t.meta_object = ?", "apply"); 51 | $query->limit(1); 52 | 53 | $meta_id = absint($query->fetchColumn()); 54 | 55 | $select->order("__{$this->field_name}.value $order"); 56 | $select->joinLeft("t1.meta __{$this->field_name}", "(__{$this->field_name}.meta_id = $meta_id)"); 57 | 58 | return $select; 59 | } 60 | 61 | public function columns_head( $type ) { 62 | if( $type !== "application" ) { 63 | return; 64 | } 65 | $sort = Daq_Request::getInstance()->get("sort"); 66 | $order = Daq_Request::getInstance()->get("order"); 67 | 68 | $order = ( $order === "desc" ) ? "desc" : "asc"; 69 | 70 | ?> 71 | 72 | $this->column_name, "order"=>wpjb_column_order($sort==$this->column_name, $order)))) ?>"> 73 | label ) ?> 74 | 75 | 76 | 77 | 85 | "> 86 | meta->{$this->field_name}->value() ?> 87 | 88 | 79 | 80 | tag. 88 | * 89 | * This function is being called by upload_from_dropbox_button() function. 90 | * 91 | * @since 1.0 92 | * @return void 93 | */ 94 | function upload_from_dropbox_footer() { 95 | $key = wpjb_conf('upload_from_dropbox_app_key', '0'); 96 | printf('', $key); 97 | } 98 | 99 | /** 100 | * AJAX File Upload 101 | * 102 | * This function copies file from Dropbox and tries to upload it using default 103 | * WPJB uploader. 104 | * 105 | * @see Wpjb_Module_AjaxNopriv_Main::uploadAction() 106 | * 107 | * @since 1.0 108 | * @return void 109 | */ 110 | function upload_from_dropbox_ajax() { 111 | 112 | global $blog_id; 113 | 114 | if($blog_id > 1) { 115 | $bid = "-".$blog_id; 116 | } else { 117 | $bid = ""; 118 | } 119 | 120 | $dir = wp_upload_dir(); 121 | $d = array(); 122 | $d["baseurl"] = $dir["baseurl"]."/wpjobboard{$bid}-upload-from-dropbox"; 123 | $d["basedir"] = $dir["basedir"]."/wpjobboard{$bid}-upload-from-dropbox"; 124 | 125 | if(!wp_mkdir_p($d["basedir"])) { 126 | $response->msg = sprintf(__("Upload directory %s could not be created.", "wpjobboard"), $dir); 127 | die(json_encode($response)); 128 | } 129 | 130 | $file = Daq_Request::getInstance()->post("data"); 131 | $response = wp_remote_get($file["link"]); 132 | $new_file = $d["basedir"] . "/" . $file["name"]; 133 | 134 | if( is_wp_error( $response ) ) { 135 | $response->msg = $response->get_error_message(); 136 | die(json_encode($response)); 137 | } 138 | 139 | file_put_contents( $new_file, $response["body"] ); 140 | 141 | $stat = @stat( dirname( $new_file ) ); 142 | $perms = $stat['mode'] & 0007777; 143 | $perms = $perms & 0000666; 144 | @ chmod( $new_file, $perms ); 145 | clearstatcache(); 146 | 147 | if( ! isset($_FILES) || ! is_array($_FILES) ) { 148 | $_FILES = array(); 149 | } 150 | 151 | $type = wp_check_filetype($new_file, wp_get_mime_types()); 152 | 153 | $_FILES["file"] = array( 154 | "name" => $file["name"], 155 | "type" => $type["type"], 156 | "tmp_name" => $new_file, 157 | "error" => UPLOAD_ERR_OK, 158 | "size" => $file["bytes"] 159 | ); 160 | 161 | add_filter( "daq_move_uploaded_file", "upload_from_dropbox_move", 10, 3 ); 162 | 163 | Wpjb_Module_AjaxNopriv_Main::uploadAction(); 164 | exit; 165 | } 166 | 167 | /** 168 | * Replace upload method 169 | * 170 | * Use rename() function instead of move_uploaded_file() when uploading 171 | * files from Dropbox. 172 | * 173 | * @see daq_move_uploaded_file filter 174 | * 175 | * @since 1.0 176 | * @return void 177 | */ 178 | function upload_from_dropbox_move( $result, $tmp_file, $new_file ) { 179 | if( ! $result && stripos( $tmp_file, '-upload-from-dropbox/' ) ) { 180 | return rename( $tmp_file, $new_file ); 181 | } 182 | 183 | return $result; 184 | } 185 | 186 | /** 187 | * Add Dropbox App Key config field to form 188 | * 189 | * This functin adds "Dropbox App Key" field to form wp-admin / Settings (WPJB) 190 | * / Common Settings form. 191 | * 192 | * @since 1.0 193 | * @return void 194 | */ 195 | function upload_from_dropbox_config( $form ) { 196 | 197 | $e = $form->create("upload_from_dropbox_app_key"); 198 | $e->setValue(wpjb_conf("upload_from_dropbox_app_key")); 199 | $e->setLabel(__("Dropbox App Key", "upload-from-dropbox")); 200 | $form->addElement($e); 201 | 202 | return $form; 203 | } 204 | -------------------------------------------------------------------------------- /user-panel-api/custom-template.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /user-panel-api/user-panel-api.php: -------------------------------------------------------------------------------- 1 | Hello ' . wp_get_current_user()->display_name . '!

    '; 37 | } 38 | if( $part == "bottom" ) { 39 | echo '

    Today is ' . date( "Y-m-d" ) . '.

    '; 40 | } 41 | } 42 | 43 | /** 44 | * This function allows to add, edit and remove links from Employer / Candidate Panel home. 45 | * 46 | * In the example below we exaplin how to remove a membership link and add 47 | * your own new link. 48 | * 49 | * @param array $dashboard List of User Panel links 50 | * @return array Modified list of User Panel links 51 | */ 52 | function user_panel_api_links( $dashboard ) { 53 | 54 | // remove membership link 55 | // full structure of $dashbaord you can find in: 56 | // Employer wpjobboard/application/libraries/Module/Frontend/Employer.php homeAction() 57 | // Candidate wpjobboard/application/libraries/Module/Resumes/Index.php homeAction() 58 | if( isset( $dashboard["manage"]["links"]["membership"] ) ) { 59 | unset( $dashboard["manage"]["links"]["membership"] ); 60 | } 61 | 62 | // add new link 63 | $dashboard["manage"]["links"]["my_link"] = array( 64 | "url" => get_permalink() . "?panel=my_link", 65 | "title" => "My Link", 66 | "icon" => "wpjb-icon-link" 67 | ); 68 | // list of availabel icons you can find at http://fontello.com/ in FontAwesome icons. 69 | // hover on icon to find its name (for example "link"), then prefix it with "wpjb-icon-" 70 | // to get a valid icon name whic WPJB will be able to recognize (for example "wpjb-icon-link") 71 | 72 | return $dashboard; 73 | } 74 | 75 | /* 76 | * Change Employer / Candidate Panel shortode content before its rendered. 77 | * 78 | * @param $content mixed Either content to display or false 79 | * @return mixed Either content to display or fals 80 | */ 81 | function user_panel_api_content( $content ) { 82 | $request = Daq_Request::getInstance(); 83 | 84 | // URL does not have ?panel=my_link param, this means some other panel is being executed 85 | // return default content then. 86 | if( $request->get("panel") != "my_link" ) { 87 | return $content; 88 | } 89 | 90 | // Make sure to authenticate user! 91 | 92 | // Load default WPJB styles 93 | wp_enqueue_style("wpjb-css"); 94 | 95 | // Create breadcrumbs, basically two links: 96 | // - User Panel home 97 | // - Current page 98 | $breadcrumbs = array( 99 | array( 100 | "title" => __("Home", "wpjobboard"), 101 | "url" => get_permalink(), 102 | "glyph"=>"wpjb-icon-home" 103 | ), 104 | array( 105 | "title"=> "My Link", 106 | "url" => get_permalink() . "?panel=my_link", 107 | "glyph"=> is_rtl() ? "wpjb-icon-left-open" : "wpjb-icon-right-open" 108 | ) 109 | ); 110 | 111 | // initiate view object and add new templates directory so we can load 112 | // a custom template file. 113 | $view = Wpjb_Project::getInstance()->getApplication("frontend")->getView(); 114 | $view->addDir(dirname(__FILE__), true); 115 | $view->breadcrumbs = $breadcrumbs; 116 | 117 | // initatte session to allow flash messages 118 | $flash = new Wpjb_Utility_Session(); 119 | $flash->addInfo("Custom My Link Panel Loaded!"); 120 | $flash->save(); 121 | 122 | // render template 123 | ob_start(); 124 | $view->render("custom-template.php"); 125 | $render = ob_get_clean(); 126 | 127 | return $render; 128 | } 129 | -------------------------------------------------------------------------------- /wpjobboard-snippets.php: -------------------------------------------------------------------------------- 1 |