forked from ptibogxiv/doliconnect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doliconnect.php
1453 lines (1215 loc) · 57.3 KB
/
doliconnect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Plugin Name: Doliconnect
* Plugin URI: https://www.ptibogxiv.net
* Description: Connect your Dolibarr (free ERP/CRM) to Wordpress.
* Version: 3.6.5
* Author: ptibogxiv
* Author URI: https://www.ptibogxiv.net/en
* Network: true
* License: GPLv3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
* Text Domain: doliconnect
* Domain Path: /languages
* Donate link: https://www.paypal.me/ptibogxiv
*
* @author ptibogxiv.net <[email protected]>
* @copyright Copyright (c) 2017-2019, ptibogxiv.net
**/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function doliconnect_textdomain() {
load_plugin_textdomain( 'doliconnect', false, basename( dirname( __FILE__ ) ) . '/languages/' );
}
add_action( 'plugins_loaded', 'doliconnect_textdomain' );
require_once plugin_dir_path(__FILE__).'/functions/enqueues.php';
require_once plugin_dir_path(__FILE__).'/functions/data-request.php';
require_once plugin_dir_path(__FILE__).'/functions/tools.php';
require_once plugin_dir_path(__FILE__).'/functions/dashboard.php';
require_once plugin_dir_path(__FILE__).'/functions/product.php';
require_once plugin_dir_path(__FILE__).'/admin/admin.php';
require_once plugin_dir_path(__FILE__).'/blocks/index.php';
//include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
// ********************************************************
function doliconnecturl ($page) {
global $wpdb;
if ( function_exists('pll_get_post') ) {
return esc_url(get_permalink(pll_get_post(get_option($page))));
} else {
return esc_url(get_permalink(get_option($page)));
}
}
function doliconnectid ($page) {
global $wpdb;
if (function_exists('pll_get_post')) {
return pll_get_post(get_option($page));
} else {
return get_option($page);
}
}
// ********************************************************
function app_output_buffer() {
ob_start();
}
add_action('init', 'app_output_buffer');
// ********************************************************
function dolibarr_entity( $entity = null ) {
if ( !get_site_option('dolibarr_entity') && get_site_option('doliconnect_mode') == 'one' ) {
return 1;
} elseif ( get_site_option('dolibarr_entity') && get_option('dolibarr_entity') ) {
return get_option('dolibarr_entity');
} else {
return get_current_blog_id();
}
//return get_current_network_id();
}
// ********************************************************
function doliconst( $constante ) {
global $wpdb;
$const = callDoliApi("GET", "/doliconnector/constante/".$constante, null, dolidelay('constante'));
return $const->value;
}
// ********************************************************
function doliconnect_run() {
$array=array();
if ( !empty(doliconnectid('doliaccount')) ) { $array[]=doliconnectid('doliaccount'); }
if ( !empty(doliconnectid('dolicart')) ) { $array[]=doliconnectid('dolicart'); }
if ( !empty($array) && is_page( $array ) ) {
if ( !defined ('DONOTCACHEPAGE') ) {
define( 'DONOTCACHEPAGE', 1);
}
}
}
add_action( 'wp_head', 'doliconnect_run', 10, 0 );
// ********************************************************
function json_basic_auth_handler( $user ) {
global $wp_json_basic_auth_error;
$wp_json_basic_auth_error = null;
if ( ! empty( $user ) ) {
return $user;
}
if ( !isset( $_SERVER['PHP_AUTH_USER'] ) ) {
return $user;
}
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
remove_filter( 'determine_current_user', 'json_basic_auth_handler', 20 );
$user = wp_authenticate( $username, $password );
add_filter( 'determine_current_user', 'json_basic_auth_handler', 20 );
if ( is_wp_error( $user ) ) {
$wp_json_basic_auth_error = $user;
return null;
}
$wp_json_basic_auth_error = true;
return $user->ID;
}
add_filter( 'determine_current_user', 'json_basic_auth_handler', 20 );
function json_basic_auth_error( $error ) {
// Passthrough other errors
if ( ! empty( $error ) ) {
return $error;
}
global $wp_json_basic_auth_error;
return $wp_json_basic_auth_error;
}
add_filter( 'rest_authentication_errors', 'json_basic_auth_error' );
// ********************************************************
function callDoliApi($method = null, $link = null, $body = null, $delay = HOUR_IN_SECONDS, $entity = null) {
global $wpdb;
$headers = array(
'DOLAPIENTITY' => dolibarr_entity($entity),
'DOLAPIKEY' => get_site_option('dolibarr_private_key')
);
$url=get_site_option('dolibarr_public_url').'/api/index.php'.$link;
if ( !empty(get_site_option('dolibarr_public_url')) && !empty(get_site_option('dolibarr_private_key')) ) {
if ( !empty( $link ) && ( false === get_transient( $link ) || $method!='GET' || $delay <= 0 ) ) {
$args = array(
'timeout' => '10',
'redirection' => '5',
'method' => $method,
'headers' => $headers
);
if ( $method == 'POST' ) {
$args['body'] = $body;
delete_transient( $link );
$request = wp_remote_post( esc_url_raw($url), $args );
} elseif ( $method == 'PUT' ) {
$args['body'] = $body;
delete_transient( $link );
$request = wp_remote_request( esc_url_raw($url), $args );
} elseif ( $method == 'DELETE' ) {
$request = wp_remote_request( esc_url_raw($url), $args );
} else {
$request = wp_remote_get( esc_url_raw($url), $args );
}
$http_code = wp_remote_retrieve_response_code( $request );
if ( $method == 'DELETE' ) {
delete_transient( $link );
} elseif ( $delay <= 0 || ! in_array( $http_code,array('200','404') ) ) {
delete_transient( $link );
if (! in_array($http_code,array('200','404')) ) {
if ( !defined("DOLIBUG") ) {
define('DOLIBUG', $http_code);
}
} elseif ( $delay != 0 ) {
$delay = abs( $delay );
set_transient( $link, wp_remote_retrieve_body( $request ), $delay);
}
} else {
set_transient( $link, wp_remote_retrieve_body( $request ), $delay );
}
return json_decode( wp_remote_retrieve_body( $request ) );
} else {
return json_decode( get_transient( $link ) );
}
} else {
if ( !defined("DOLIBUG") ) {
define('DOLIBUG', 1);
}
}
}
add_action( 'admin_init', 'callDoliApi', 5, 5);
// ********************************************************
function dolibarr() {
global $current_user;
if ( is_user_logged_in() ) {
$user=get_current_user_id();
$dolibarr = callDoliApi("GET", "/doliconnector/".$user, null, dolidelay('doliconnector', false));
if ( defined("DOLIBUG") || !is_object($dolibarr) ) {
define('DOLIBARR', null);
define('PRICE_LEVEL', 0);
define('REMISE_PERCENT', 0);
define('DOLIBARR_MEMBER', null);
define('DOLIBARR_TRAINEE', null);
define('DOLIBARR_USER', null);
define('DOLICONNECT_CART', 0);
define('DOLICONNECT_CART_ITEM', 0);
} else {
if ( $dolibarr->fk_soc == 0 ) {
if ( $current_user->billing_type == 'mor' ) {
if (!empty($current_user->billing_company)) { $name = $current_user->billing_company; }
else { $name = $current_user->user_login; }
} else {
if (!empty($current_user->user_firstname) && !empty($current_user->user_lastname)) { $name = $current_user->user_firstname." ".$current_user->user_lastname; }
else { $name = $current_user->user_login; }
}
$rdr = [
'name' => $name,
'email' => $current_user->user_email
];
$dolibarr = callDoliApi("POST", "/doliconnector/".$user, $rdr, dolidelay('doliconnector'));
define('DOLIBARR', $dolibarr->fk_soc);
} else {
define('DOLIBARR', $dolibarr->fk_soc);}
define('PRICE_LEVEL', $dolibarr->price_level);
define('REMISE_PERCENT', $dolibarr->remise_percent);
define('DOLIBARR_MEMBER', $dolibarr->fk_member);
define('DOLIBARR_TRAINEE', $dolibarr->fk_trainee);
define('DOLIBARR_USER', $dolibarr->fk_user);
define('DOLICONNECT_CART', $dolibarr->fk_order);
define('DOLICONNECT_CART_ITEM', $dolibarr->fk_order_nb_item);
}
} else {
define('DOLIBARR', null);
define('PRICE_LEVEL', 0);
define('REMISE_PERCENT', 0);
define('DOLIBARR_MEMBER', null);
define('DOLIBARR_TRAINEE', null);
define('DOLIBARR_USER', null);
define('DOLICONNECT_CART', 0);
define('DOLICONNECT_CART_ITEM', 0);
}
}
add_action( 'init', 'dolibarr', 10);
// ********************************************************
function doliconnector($current_user = null, $value = null, $refresh = false, $thirdparty = null) {
if (empty($current_user)) {
$current_user=get_current_user_id();
} else {
$current_user=$current_user->ID;
}
$user = get_user_by('ID', $current_user);
if ( $user ) {
//$user=get_current_user_id();
$dolibarr = callDoliApi("GET", "/doliconnector/".$user->ID, null, dolidelay('doliconnector', $refresh));
if ( defined("DOLIBUG") || (is_object($dolibarr) && $dolibarr->fk_soc > 0 ) ) {
if (!empty($value)) {
return $dolibarr->$value;
} else {
return $dolibarr;
}
} else {
if ( $current_user->billing_type == 'mor' ) {
if (!empty($current_user->billing_company)) { $name = $current_user->billing_company; }
else { $name = $current_user->user_login; }
} else {
if (!empty($current_user->user_firstname) && !empty($current_user->user_lastname)) { $name = $current_user->user_firstname." ".$current_user->user_lastname; }
else { $name = $current_user->user_login; }
}
$rdr = [
'name' => $name,
'email' => $current_user->user_email
];
$dolibarr = callDoliApi("POST", "/doliconnector/".$user, $thirdparty, dolidelay('doliconnector', true));
if (!empty($value)) {
return $dolibarr->$value;
} else {
return $dolibarr;
}
}
}
}
// ********************************************************
add_filter( 'get_avatar' , 'my_custom_avatar' , 1 , 5 );
function my_custom_avatar( $avatar, $id_or_email, $size, $default, $alt ) {
global $wpdb;
$user = false;
if (get_site_option('doliconnect_mode')=='one' && is_multisite() ) {
switch_to_blog(1);
}
if ( is_numeric( $id_or_email ) ) {
$id = (int) $id_or_email;
$user = get_user_by( 'id' , $id );
} elseif ( is_object( $id_or_email ) ) {
if ( ! empty( $id_or_email->user_id ) ) {
$id = (int) $id_or_email->user_id;
$user = get_user_by( 'id' , $id );
}
} else {
$user = get_user_by( 'email', $id_or_email );
}
if ( $user && is_object( $user ) ) {
//if ( $user->data->ID == '1' ) {
$avatar = 'YOUR_NEW_IMAGE_URL';
//$avatar = "<img alt='{$alt}' src='{$avatar}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
if ($size=='96') {
$taille=" class='card-img-top' ";
} else {
$taille=" class='rounded-circle border border-white' height='{$size}' width='{$size}' ";
}
$entity = get_current_blog_id();
$table_prefix = $wpdb->get_blog_prefix( $entity );
$nam=$table_prefix."member_photo";
if (isset($user->$nam) && NULL != $user->$nam) {
$upload_dir = wp_upload_dir();
$filename=$upload_dir['baseurl']."/doliconnect/".$user->data->ID."/".$user->$nam;
$avatar = "<img src='$filename' ".$taille." alt='avatar-".$user->data->ID."'>";
} else {
$avatar = "<img src='" . plugins_url( 'images/default.jpg', __FILE__ ) . "' ".$taille." alt='avatar-default'>";
}
} else {
$taille=" class='card-img' ";
$avatar = "<img src='" . plugins_url( 'images/default.jpg', __FILE__ ) . "' ".$taille." alt='avatar-default'>";
}
if ( get_site_option('doliconnect_mode')=='one' && is_multisite() ) {
restore_current_blog();
}
return $avatar;
}
// ********************************************************
//function doliaccount_display($content) {
//global $wpdb, $current_user;
//if ( in_the_loop() && is_main_query() && is_page(doliconnectid('doliaccount')) ) {
function doliaccount_shortcode() {
global $wpdb, $current_user;
doliconnect_enqueues();
$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
$check_zone_info = true;
// Remove old Etc mappings. Fallback to gmt_offset.
if ( false !== strpos($tzstring,'Etc/GMT') )
$tzstring = '';
if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
$check_zone_info = false;
if ( 0 == $current_offset )
$tzstring = 'UTC+0';
elseif ($current_offset < 0)
$tzstring = 'UTC' . $current_offset;
else
$tzstring = 'UTC+' . $current_offset;
}
//define( 'MY_TIMEZONE', (get_option( 'timezone_string' ) ? get_option( 'timezone_string' ) : date_default_timezone_get() ) );
//date_default_timezone_set( MY_TIMEZONE );
date_default_timezone_set($tzstring);
$ID = $current_user->ID;
$time = current_time( 'timestamp', 1);
print "<div class='row'><div class='col-xs-12 col-sm-12 col-md-3'><div class='row'><div class='col-3 col-xs-4 col-sm-4 col-md-12 col-xl-12'><div class='card shadow-sm' style='width: 100%'>";
print get_avatar($ID);
if ( is_user_logged_in() && !defined("DOLIBUG") ) {
print "<a href='".esc_url( add_query_arg( 'module', 'avatars', doliconnecturl('doliaccount')) )."' class='card-img-overlay'><div class='d-block d-sm-block d-xs-block d-md-none text-center'><i class='fas fa-camera'></i></div><div class='d-none d-md-block'><i class='fas fa-camera fa-2x'></i> ".__( 'Edit', 'doliconnect' )."</div></a>";
}
print "<ul class='list-group list-group-flush'><a href='".esc_url( doliconnecturl('doliaccount') )."' class='list-group-item list-group-item-action'><center><div class='d-block d-sm-block d-xs-block d-md-none'><i class='fas fa-home'></i></div><div class='d-none d-md-block'><i class='fas fa-home'></i> ".__( 'Home', 'doliconnect' )."</div></center></a>";
print "</ul>";
print "</div><br></div><div class='col-9 col-xs-8 col-sm-8 col-md-12 col-xl-12'>";
if ( is_user_logged_in() ) {
$thirdparty = callDoliApi("GET", "/thirdparties/".doliconnector($current_user, 'fk_soc'), null, dolidelay('thirdparty', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));
if ( defined("DOLIBUG") ) {
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'><div class='card shadow-sm'><div class='card-body'>";
print dolibug();
print "</div></div></div></div>";
} elseif ( $thirdparty->status != '1' ) {
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'><div class='card shadow-sm'><div class='card-body'>";
print '<br><br><br><br><br><center><div class="align-middle"><i class="fas fa-bug fa-3x fa-fw"></i><h4>'.__( 'This account is closed. Please contact us for reopen it.', 'doliconnect' ).'</h4></div></center><br><br><br><br><br>';
print "</div></div></div></div>";
$thirdparty = callDoliApi("GET", "/thirdparties/".doliconnector($current_user, 'fk_soc'), null, dolidelay('thirdparty', true));
} else {
if ( isset($_GET['module']) ) {
//****
if ( has_action('user_doliconnect_'.esc_attr($_GET['module'])) ) {
if ( has_action('user_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('user_doliconnect_menu', esc_attr($_GET['module']));
print "</div><br>";
}
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
do_action( 'user_doliconnect_'.esc_attr($_GET['module']), esc_url( add_query_arg( 'module', esc_attr($_GET['module']), doliconnecturl('doliaccount')) ) );
} elseif ( has_action('customer_doliconnect_'.esc_attr($_GET['module'])) && $thirdparty->client == '1' ) {
if( has_action('customer_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('customer_doliconnect_menu', esc_attr($_GET['module']));
print "</div><br>";
}
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
do_action( 'customer_doliconnect_'.esc_attr($_GET['module']), esc_url( add_query_arg( 'module', esc_attr($_GET['module']), doliconnecturl('doliaccount')) ) );
} elseif ( has_action('options_doliconnect_'.esc_attr($_GET['module'])) ) {
if ( has_action('options_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('options_doliconnect_menu', esc_attr($_GET['module']));
print "</div><br>";
}
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
do_action( 'options_doliconnect_'.esc_attr($_GET['module']), esc_url( add_query_arg( 'module', esc_attr($_GET['module']), doliconnecturl('doliaccount')) ) );
} elseif ( has_action('supplier_doliconnect_'.esc_attr($_GET['module'])) && $thirdparty->fournisseur == '1' && get_option('doliconnectbeta')=='1' ) {
if ( has_action('supplier_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('supplier_doliconnect_menu', esc_attr($_GET['module']));
print "</div><br>";
}
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
do_action( 'supplier_doliconnect_'.esc_attr($_GET['module']), esc_url( add_query_arg( 'module', esc_attr($_GET['module']), doliconnecturl('doliaccount')) ) );
} elseif ( has_action('my_doliconnect_'.esc_attr($_GET['module'])) ) {
if ( has_action('my_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('my_doliconnect_menu', esc_attr($_GET['module']));
print "</div><br>";
}
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
do_action( 'my_doliconnect_'.esc_attr($_GET['module']),esc_url( add_query_arg( 'module', esc_attr($_GET['module']), doliconnecturl('doliaccount')) ) );
} elseif ( has_action('settings_doliconnect_'.esc_attr($_GET['module'])) ) {
if ( has_action('settings_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('settings_doliconnect_menu', esc_attr($_GET['module']));
print "</div><br>";
}
print "</div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
do_action( 'settings_doliconnect_'.esc_attr($_GET['module']), esc_url( add_query_arg( 'module', esc_attr($_GET['module']), doliconnecturl('doliaccount')) ) );
} else {
wp_redirect( esc_url(doliconnecturl('doliaccount')) );
exit;
}
//****
print "</div>";
} else {
print "<p class='font-weight-light' align='justify'><h5>".sprintf(__('Hello %s', 'doliconnect'), $current_user->first_name)."</h5>".__( 'Manage your account, your informations, orders and much more via this secure client area.', 'doliconnect' )."</p></div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
if ( has_action('user_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('user_doliconnect_menu');
print "</div><br>";
}
if ( has_action('customer_doliconnect_menu') && $thirdparty->client == '1' ) {
print "<div class='list-group shadow-sm'>";
do_action('customer_doliconnect_menu');
print "</div><br>";
}
if ( has_action('options_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('options_doliconnect_menu');
print "</div><br>";
}
if ( has_action('supplier_doliconnect_menu') && $thirdparty->fournisseur == '1' && get_option('doliconnectbeta')=='1' ) {
print "<div class='list-group shadow-sm'>";
do_action('supplier_doliconnect_menu');
print "</div><br>";
}
if ( has_action('my_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('my_doliconnect_menu');
print "</div><br>";
}
if ( has_action('settings_doliconnect_menu') ) {
print "<div class='list-group shadow-sm'>";
do_action('settings_doliconnect_menu');
print "</div><br>";
}
print "</div>";
}
// fin de sous page
print "</div>";
}
} elseif ( !is_user_logged_in() && isset($_GET["signup"]) ) {
print "<p class='font-weight-light' align='justify'>".__( 'Manage your account, your informations, orders and much more via this secure client area.', 'doliconnect' )."</p></div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
if ( is_user_logged_in() ) {
wp_redirect(site_url());
exit;
}
if ( is_multisite() && !get_option( 'users_can_register' ) && (get_site_option( 'registration' ) != 'user' or get_site_option( 'registration' ) != 'all') ) {
wp_redirect(esc_url(doliconnecturl('doliaccount')));
exit;
} elseif ( !get_option( 'users_can_register' ) ) {
wp_redirect(esc_url(doliconnecturl('doliaccount')));
exit;
}
if ( isset($_POST['submitted']) ) {
$thirdparty=$_POST['thirdparty'];
if ( email_exists($thirdparty['email']) ) {
$emailError = "".__( 'This email address is already linked to an account. You can reactivate your account through this <a href=\'".wp_lostpassword_url( get_permalink() )."\' title=\'lost password\'>form</a>.', 'doliconnect' )."";
$hasError = true;
} else {
$email = sanitize_email($thirdparty['email']);
}
if ( $thirdparty['firstname'] == $_POST['user_nicename'] && $thirdparty['firstname'] == $thirdparty['lastname']) {
$emailError = "".__( 'Create this account is not permitted', 'doliconnect' )."";
$hasError = true;
}
if(!isset($hasError)) {
$emailTo = get_option('tz_email');
if (!isset($emailTo) || ($emailTo == '') ) {
$emailTo = get_option('admin_email');
}
$sitename = get_option('blogname');
$subject = "[".$sitename."] ".__( 'Registration confirmation', 'doliconnect' )."";
if ( !empty($_POST['pwd1']) && $_POST['pwd1'] == $_POST['pwd2'] ) {
$password=sanitize_text_field($_POST['pwd1']);
} else {
$password = wp_generate_password( 12, false );
}
$ID = wp_create_user(uniqid(), $password, $email );
$role = 'subscriber';
if ( is_multisite() ) { add_user_to_blog($entity,$ID,$role); }
wp_update_user( array( 'ID' => $ID, 'user_email' => sanitize_email($thirdparty['email'])));
wp_update_user( array( 'ID' => $ID, 'nickname' => sanitize_user($_POST['user_nicename'])));
wp_update_user( array( 'ID' => $ID, 'display_name' => ucfirst(strtolower($thirdparty['firstname']))." ".strtoupper($thirdparty['lastname'])));
wp_update_user( array( 'ID' => $ID, 'first_name' => ucfirst(sanitize_user(strtolower($thirdparty['firstname'])))));
wp_update_user( array( 'ID' => $ID, 'last_name' => strtoupper(sanitize_user($thirdparty['lastname']))));
update_user_meta( $ID, 'civility_id', sanitize_text_field($thirdparty['civility_id']));
update_user_meta( $ID, 'billing_type', sanitize_text_field($thirdparty['morphy']));
if ( isset($thirdparty['name']) ) { update_user_meta( $ID, 'billing_company', sanitize_text_field($thirdparty['name'])); }
update_user_meta( $ID, 'billing_birth', $thirdparty['birth']);
update_user_meta( $ID, 'optin1', $_POST['optin1'] );
$body = sprintf(__('Thank you for your registration on %s.', 'doliconnect'), $sitename);
$user = get_user_by( 'ID', $ID);
if ( function_exists('dolikiosk') && ! empty(dolikiosk()) && $user ) {
$dolibarr = doliconnector($user, 'fk_soc', true, $thirdparty);
do_action('wp_dolibarr_sync', $thirdparty);
wp_set_current_user( $ID, $user->user_login );
wp_set_auth_cookie( $ID, false);
do_action( 'wp_login', $user->user_login );
//wp_redirect(esc_url(home_url()));
//exit;
} else {
//$user=get_user_by( 'ID', $ID );
//$user = get_user_by( 'email', $email);
$key = get_password_reset_key($user);
$arr_params = array( 'rpw' => true, 'key' => $key, 'login' => $user->user_login);
$url = esc_url( add_query_arg( $arr_params, doliconnecturl('doliaccount')) );
$body .= "<br /><br />".__('To activate your account on and choose your password, please click on the following link', 'doliconnect').":<br /><br /><a href='".$url."'>".$url."</a>";
}
$body .= "<br /><br />".sprintf(__("Your %s's team", 'doliconnect'), $sitename)."<br />".get_option('siteurl');
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail($email, $subject, $body, $headers);
$emailSent = true;
}
}
if ( isset($emailSent) && $emailSent == true ) {
print "<div class='alert alert-success'><h4 class='alert-heading'>".__( 'Congratulations!', 'doliconnect' )."</h4><p>".__( 'Your account was created and an account activation link was sent by email. Don\'t forget to look at your unwanted emails if you can\'t find our message.', 'doliconnect' )."</p></div>";
} else {
if ( isset($hasError) || isset($captchaError) ) {
print "<div class='alert alert-danger'><a class='close' data-dismiss='alert'>x</a><h4 class='alert-heading'>".__( 'Oops', 'doliconnect' )."</h4><p class='error'>$emailError<p></div>";
}
}
print "<form id='doliconnect-signinform' action='".doliconnecturl('doliaccount')."?signup' role='form' method='post' class='was-validated'>";
if ( isset($msg) ) { print $msg; }
print doliloaderscript('doliconnect-signinform');
print "<div class='card shadow-sm'><div class='card-body'><h5 class='card-title'>".__( 'Create an account', 'doliconnect' )."</h5></div>";
if ( function_exists('dolikiosk') && ! empty(dolikiosk()) ) {
print doliconnectuserform(null, null, 'thirdparty');
} else {
print doliconnectuserform(null, null, 'thirdparty');
}
print "<div class='card-body'><input type='hidden' name='submitted' id='submitted' value='true'><button class='btn btn-primary btn-block' type='submit'";
if ( get_option('users_can_register')=='1' && ( get_site_option( 'registration' ) == 'user' || get_site_option( 'registration' ) == 'all' ) || ( !is_multisite() && get_option( 'users_can_register' )) ) {
print "";
} else { print " aria-disabled='true' disabled"; }
print "><b>".__( 'Create an account', 'doliconnect' )."</b></button></form>";
print "</div></div>";
print "<p class='text-right'><small>";
print dolihelp('ISSUE');
print "</small></p>";
print "</div></div>";
print "</div></div>";
} elseif ( !is_user_logged_in() && isset($_GET["rpw"]) ) {
print "<p class='font-weight-light' align='justify'>".__( 'Manage your account, your informations, orders and much more via this secure client area.', 'doliconnect' )."</p></div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
if (!$_GET["login"] || !$_GET["key"]) {
wp_redirect(wp_login_url( get_permalink() ));
exit;
} else {
$user = check_password_reset_key( esc_attr($_GET["key"]), esc_attr($_GET["login"]) );
if ( ! $user || is_wp_error( $user ) ) {
if ( $user && $user->get_error_code() === 'expired_key' ){
wp_redirect(wp_login_url( get_permalink() )."?action=lostpassword&error=expiredkey");
exit;
}else{
wp_redirect(wp_login_url( get_permalink() )."?action=lostpassword&error=invalidkey");
exit;
}
exit;
} else {
$dolibarr = callDoliApi("GET", "/doliconnector/".$user->ID, null, 0);
if ($_POST["case"] == 'updatepwd'){
$pwd = sanitize_text_field($_POST["pwd1"]);
if ( ($_POST["pwd1"] == $_POST["pwd2"]) && (preg_match('/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{8,20}/', $pwd))) { //"#.*^(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).*$#"
wp_set_password($pwd, $user->ID);
if ( $dolibarr->fk_user > '0' ) {
$data = [
'pass' => $pwd
];
$doliuser = callDoliApi("PUT", "/users/".$dolibarr->fk_user, $data, 0);
}
//$msg = "<div class='alert alert-success'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p>Votre mot de passe a été changé avec succès !</p></div>";
$wpdb->update( $wpdb->users, array( 'user_activation_key' => '' ), array( 'user_login' => $user->user_login ) );
wp_redirect(wp_login_url( get_permalink() )."?action=lostpassword&success");
exit;
}
elseif ( $pwd != $_POST["pwd2"] ) {
$msg = "<div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><span class='fa fa-times-circle'></span> Les 2 nouveaux mots de passe saisis sont différents!</div>";
}
elseif (!preg_match("#.*^(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).*$#", $pwd)){
$msg = "<div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><span class='fa fa-times-circle'></span> Votre nouveau mot de passe doit comporter entre 8 et 20 caractères dont au moins 1 chiffre, 1 lettre, 1 majuscule et 1 symbole.</div>";
}
}
print $msg."<div class='card shadow-sm'><ul class='list-group list-group-flush'>";
if ( $dolibarr->fk_user > '0') {
print "<li class='list-group-item list-group-item-info'><i class='fas fa-info-circle'></i> <b>".__( 'Your password will be synchronized with your Dolibarr account', 'doliconnect' )."</b></li>";
}
print "<li class='list-group-item'><h5 class='card-title'>".__( 'Change your password', 'doliconnect' )."</h5><form class='was-validated' id='fpwForm' action='' method='post'><input type='hidden' name='submitted' id='submitted' value='true' />
<div class='form-group'><label for='pwd1'><small>".__( 'New password', 'doliconnect' )."</small></label>
<div class='input-group mb-2 mr-sm-2'><div class='input-group-prepend'>
<div class='input-group-text'><i class='fas fa-key fa-fw'></i></div></div>
<input class='form-control' id='pwd1' type='password' name='pwd1' value ='' placeholder='".__( 'Enter your new password', 'doliconnect' )."' ";
if ( defined("DOLICONNECT_DEMO") && ''.constant("DOLICONNECT_DEMO").'' == $user->ID ) {
print ' readonly';
} else {
print ' required';
}
print "></div>
<small id='pwd1' class='form-text text-justify text-muted'>
".__( 'Your password must be between 8 and 20 characters, including at least 1 digit, 1 letter, 1 uppercase.', 'doliconnect' )."
</small>
<div class='form-group'><label for='pwd2'></label>
<div class='input-group mb-2 mr-sm-2'><div class='input-group-prepend'>
<div class='input-group-text'><i class='fas fa-key fa-fw'></i></div></div>
<input class='form-control' id='pwd2' type='password' name='pwd2' value ='' placeholder='".__( 'Confirm your new password', 'doliconnect' )."' ";
if ( defined("DOLICONNECT_DEMO") && ''.constant("DOLICONNECT_DEMO").'' == $user->ID ) {
print ' readonly';
} else {
print ' required';
}
print "></div>
</div></div></li><li class='list-group-item'><input type='hidden' name='case' value ='updatepwd'><button class='btn btn-danger btn-block' type='submit' ";
if ( defined("DOLICONNECT_DEMO") && ''.constant("DOLICONNECT_DEMO").'' == $user->ID ) {
print ' disabled';
}
print "><b>".__( 'Update', 'doliconnect' )."</b></button></form></li></ul>";
print "</div>";
}
}
} elseif ( isset($_GET["provider"]) && $_GET["provider"] != null ) {
include( plugin_dir_path( __DIR__ ) . 'doliconnect-pro/lib/hybridauth/src/autoload.php');
include( plugin_dir_path( __DIR__ ) . 'doliconnect-pro/lib/hybridauth/src/config.php');
try {
//Feed configuration array to Hybridauth
$hybridauth = new Hybridauth\Hybridauth($config);
//Attempt to authenticate users with a provider by name
$adapter = $hybridauth->authenticate($_GET["provider"]);
//Returns a boolean of whether the user is connected with Twitter
$isConnected = $adapter->isConnected();
//Retrieve the user's profile
$userProfile = $adapter->getUserProfile();
if ( !email_exists($userProfile->email) ) {
$emailError = __( 'No account seems to be linked to this email address', 'doliconnect' );
$hasError = true;
} else {
$user=get_user_by( 'email', $userProfile->email);
wp_set_current_user($user->ID);
if (wp_validate_auth_cookie()==FALSE)
{
wp_set_auth_cookie($user->ID, true, true);
}
do_action( 'wp_login', '<USERNAME>' );
$adapter->disconnect();
wp_redirect(esc_url(home_url()));
exit;
}
//Inspect profile's public attributes
//var_dump($userProfile);
//var_dump($adapter->getAccessToken());
//Disconnect the adapter
$adapter->disconnect();
}
catch(\Exception $e) {
// In case we have errors 6 or 7, then we have to use Hybrid_Provider_Adapter::logout() to
// let hybridauth forget all about the user so we can try to authenticate again.
// Display the recived error,
// to know more please refer to Exceptions handling section on the userguide
switch( $e->getCode() ){
case 0 : print "Unspecified error."; break;
case 1 : print "Hybriauth configuration error."; break;
case 2 : print "Provider not properly configured."; break;
case 3 : print "Unknown or disabled provider."; break;
case 4 : print "Missing provider application credentials."; break;
case 5 : print "Authentication failed. "
. "The user has canceled the authentication or the provider refused the connection.";
case 6 : print "User profile request failed. Most likely the user is not connected "
. "to the provider and he should to authenticate again.";
$adapter->logout();
break;
case 7 : print "User not connected to the provider.";
$adapter->logout();
break;
}
print "<br /><br /><b>Original error message:</b> " . $e->getMessage();
//print "<hr /><h3>Trace</h3> <pre>" . $e->getTraceAsString() . "</pre>";
}
} elseif ( !is_user_logged_in() && isset($_GET["fpw"]) ) {
print "<p class='font-weight-light' align='justify'>".__( 'Manage your account, your informations and much more via this secure client area.', 'doliconnect' )."</p></div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
if( isset($_POST['user_email']) ) {
if( sanitize_email($_POST['user_email']) === '' ) {
$emailError = __( 'A valid email is need to reset your password', 'doliconnect' );
$hasError = true;
} elseif ( !email_exists(sanitize_email($_POST['user_email'])) ) {
$emailError = __( 'Reset password is not permitted', 'doliconnect' );
$hasError = true;
}
else {
$email = sanitize_email($_POST['user_email']);
$emailTo = get_option('tz_email');
if (!isset($emailTo) || ($emailTo == '') ){
$emailTo = get_option('admin_email');
}
$user = get_user_by( 'email', $email);
$key = get_password_reset_key($user);
$arr_params = array( 'rpw' => true, 'key' => $key, 'login' => $user->user_login);
$url = esc_url( add_query_arg( $arr_params, doliconnecturl('doliaccount')) );
if ( defined("DOLICONNECT_DEMO") && ''.constant("DOLICONNECT_DEMO").'' == $user->ID ) {
$emailError = __( 'Reset password is not permitted', 'doliconnect' );
$emailSent = false;
} elseif ( !empty($key) ) {
$sitename = get_option('blogname');
$siteurl = get_option('siteurl');
$subject = "[$sitename] ".__( 'Reset Password', 'doliconnect' );
$body = __( 'A request to change your password has been made. You can change it via the single-use link below:', 'doliconnect' )."<br /><br /><a href='".$url."'>".$url."</a><br /><br />".__( 'If you have not made this request, please ignore this email.', 'doliconnect' )."<br /><br />".sprintf(__('Your %s\'s team', 'doliconnect'), $sitename)."<br />$siteurl";
$headers = array('Content-Type: text/html; charset=UTF-8');
$mail = wp_mail($email, $subject, $body, $headers);
if( $mail ) { $emailSent = true; } else { $emailSent = false; }
}
}
}
if ( isset($emailSent) && $emailSent == true ) {
print "<div class='alert alert-success'><h4 class='alert-heading'>".__( 'Congratulations!', 'doliconnect' )."</h4><p>".__( 'A password reset link was sent to you by email. Please check your spam folder if you don\'t find it.', 'doliconnect' )."</p></div>";
} elseif ( isset($hasError) || isset($emailError) ) {
print "<div class='alert alert-danger'><h4 class='alert-heading'>".__( 'Oops', 'doliconnect' )."</h4><p>$emailError</p></div>";
} elseif ( isset($emailSent) && $emailSent != true ) {
print "<div class='alert alert-warning'><h4 class='alert-heading'>".__( 'Oops', 'doliconnect' )."</h4><p>".__( 'A problem occurred. Please retry later!', 'doliconnect' )."</p></div>";
}
print "<form id='doliconnect-fpwform' action='".doliconnecturl('doliaccount')."?fpw' method='post' class='was-validated'><input type='hidden' name='submitted' id='submitted' value='true' />";
if ( isset($msg) ) { print $msg; }
print doliloaderscript('doliconnect-fpwform');
print "<div class='card shadow-sm'><div class='card-body'><h5 class='card-title'>".__( 'Forgot password?', 'doliconnect' )."</h5>";
print "<div class='form-group'><label for='inputemail'><small>".__( 'Please enter the email address by which you registered your account.', 'doliconnect' )."</small></label>
<div class='input-group mb-2 mr-sm-2'><div class='input-group-prepend'>
<div class='input-group-text'><i class='fas fa-at fa-fw'></i></div></div>
<input class='form-control' id='user_email' type='email' placeholder='".__( 'Email', 'doliconnect' )."' name='user_email' value ='' required>";
print "</div></div></div>";
print "<ul class='list-group list-group-flush'><li class='list-group-item'>";
print "<button class='btn btn-danger btn-block' type='submit'><b>".__( 'Submit', 'doliconnect' )."</b></button>";
print "</li></ul>";
print "</div></form>";
print "<p class='text-right'><small>";
print dolihelp('ISSUE');
print "</small></p>";
print "</div></div>";
} else {
print "<p class='font-weight-light' align='justify'>".__( 'Manage your account, your informations and much more via this secure client area.', 'doliconnect' )."</p></div></div></div>";
print "<div class='col-xs-12 col-sm-12 col-md-9'>";
if ( isset($emailSent) && $emailSent == true ) {
print "<div class='alert alert-success'><h4 class='alert-heading'>".__( 'Congratulations!', 'doliconnect' )."</h4><p>".__( 'A password reset link was sent to you by email. Please check your spam folder if you don\'t find it.', 'doliconnect' )."</p></div>";
}
if( isset($_GET["login"]) && $_GET["login"] == 'failed' ) {
print "<div class='alert alert-danger'><h4 class='alert-heading'>".__( 'Oops', 'doliconnect' )."</h4><p>".__( 'There is no account for these login data or the email and/or the password are not correct.', 'doliconnect' )."</p></div>";
}
print "<div class='card shadow-sm'><ul class='list-group list-group-flush'><li class='list-group-item'>";
if ( function_exists('doliconnect_modal') && get_option('doliloginmodal') == '1' ) {
print "<center><i class='fas fa-user-lock fa-fw fa-10x'></i><br><br>";
//print "<h2>".__( 'Restricted area', 'doliconnect' )."</h2></center>";
print '<a href="#" id="login-'.current_time('timestamp').'" data-toggle="modal" data-target="#DoliconnectLogin" data-dismiss="modal" title="'.__('Sign in', 'doliconnect').'" class="btn btn-block btn-primary my-2 my-sm-0" role="button">'.__('You have already an account', 'doliconnect').'</a>';
if (((!is_multisite() && get_option( 'users_can_register' )) or (get_option('users_can_register')=='1' && (get_site_option( 'registration' ) == 'user' or get_site_option( 'registration' ) == 'all'))))
{
print '<div><div style="display:inline-block;width:46%;float:left"><hr width="90%" /></div><div style="display:inline-block;width: 8%;text-align: center;vertical-align:90%"><small class="text-muted">'.__( 'or', 'doliconnect' ).'</small></div><div style="display:inline-block;width:46%;float:right" ><hr width="90%"/></div></div>';
print '<a href="'.wp_registration_url( get_permalink() ).'" id="login-'.current_time('timestamp').'" class="btn btn-block btn-primary my-2 my-sm-0" role="button">'.__("You don't have an account", 'doliconnect').'</a>';
}
} else {
print "<div id='loginmodal-form'><h5 class='card-title'>".__( 'Welcome', 'doliconnect' )."</h5>";
print "<b>".get_option('doliaccountinfo')."</b>";
if ( function_exists('socialconnect') ) {
socialconnect(get_permalink());
}
if ( function_exists('secupress_get_module_option') && secupress_get_module_option('move-login_slug-login', $slug, 'users-login' ) ) {
$login_url=site_url()."/".secupress_get_module_option('move-login_slug-login', $slug, 'users-login' );
} else {
$login_url=site_url()."/wp-login.php"; }
if ( isset($_GET["redirect_to"])) { $redirect_to=$_GET["redirect_to"]; } else {
$redirect_to=$_SERVER['HTTP_REFERER'];}
print "<form class='was-validated' id='doliconnect-loginform' action='$login_url' method='post'>";
print doliloaderscript('doliconnect-loginform');
print "<div class='form-group'>
<div class='input-group mb-2 mr-sm-2'><div class='input-group-prepend'>
<div class='input-group-text'><i class='fas fa-at fa-fw'></i></div></div>
<input class='form-control' id='user_login' type='email' placeholder='".__( 'Email', 'doliconnect' )."' name='log' value='' required autofocus>";
print "</div></div><div class='form-group'>
<div class='input-group mb-2 mr-sm-2'><div class='input-group-prepend'>
<div class='input-group-text'><i class='fas fa-key fa-fw'></i></div></div>
<input class='form-control' id='user_pass' type='password' placeholder='".__( 'Password', 'doliconnect' )."' name='pwd' value ='' required>";
print "</div></div>";
print "<div><div class='float-left'><small>";
if ( ((!is_multisite() && get_option( 'users_can_register' )) || (get_option('users_can_register') == '1' && (get_site_option( 'registration' ) == 'user' || get_site_option( 'registration' ) == 'all'))) ) {
print "<a href='".wp_registration_url( get_permalink() )."' role='button' title='".__( 'Create an account', 'doliconnect' )."'>".__( 'Create an account', 'doliconnect' )."</a>";
}
//<input type='checkbox' class='custom-control-input' value='forever' id='remembermemodal' name='rememberme'>";
//print "<label class='custom-control-label' for='remembermemodal'> ".__( 'Remember me', 'doliconnect' )."</label>";
print "</div><div class='float-right'><a href='".wp_lostpassword_url( get_permalink() )."' role='button' title='".__( 'Forgot password?', 'doliconnect' )."'>".__( 'Forgot password?', 'doliconnect' )."</a></small></div></div>";
print "</div></li><li class='list-group-item'><input type='hidden' value='$redirect_to' name='redirect_to'><button id='submit' class='btn btn-block btn-primary' type='submit' name='submit' value='Submit'";
print "><b>".__( 'Sign in', 'doliconnect' )."</b></button></form>";
}
print "</li></lu></div>";
print "<p class='text-right'><small>";
print dolihelp('ISSUE');
print "</small></p>";
print "</div></div>";
}
//return $content;
}
add_shortcode('doliaccount', 'doliaccount_shortcode');
//} else {
//return $content;
//}
//}
//add_filter( 'the_content', 'doliaccount_display');
// ********************************************************
function dolicontact_display($content) {
global $current_user;
if ( in_the_loop() && is_main_query() && is_page(doliconnectid('dolicontact')) && !empty(doliconnectid('dolicontact')) ) {
doliconnect_enqueues();
if( ! empty($_POST['email-control']) ) //! $is_valid || !
{
$emailError = __( 'Your request is unsuccessful', 'doliconnect' );