partner edit button not visible by someone else
This commit is contained in:
3
plugins/cipf_plugin/css/partner_page.css
Normal file
3
plugins/cipf_plugin/css/partner_page.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
div.partenaire_propre_page_cipf {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -11,114 +11,47 @@ if (!defined('ABSPATH')) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* series of actions to do before printing a partner author page
|
* upload scripts and styles on partner page
|
||||||
*
|
*
|
||||||
function check_partner_page_CIPF() {
|
*/
|
||||||
|
function partner_page_scripts_CIPF() {
|
||||||
PLGNTLS_class::debug_infos();
|
PLGNTLS_class::debug_infos();
|
||||||
|
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||||
|
|
||||||
// the way to find the id of the author of an author_page
|
/*
|
||||||
$author_id = get_queried_object_id();
|
* dont do anything if :
|
||||||
|
* - user not logged in
|
||||||
|
* - user no partner
|
||||||
|
* - partner not author of the page
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if (!is_user_logged_in()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!current_user_can($role_partner)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
global $post;
|
||||||
|
$current_post_author = (int)($post->post_author);
|
||||||
|
$current_user_id = (int)get_current_user_id();
|
||||||
|
if ($current_user_id !== $current_post_author) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* on partner own page, load css
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$cipf_partner = new PLGNTLS_class();
|
||||||
|
$cipf_partner->add_to_front(array('css/partner_page.css'));
|
||||||
}
|
}
|
||||||
add_action('template_redirect', 'check_partner_page_CIPF', 11);
|
add_action('wp_enqueue_scripts', 'partner_page_scripts_CIPF', 11);
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
in test_partner_CIPF
|
|
||||||
|
|
||||||
form_id
|
|
||||||
"crea_partenaire"
|
|
||||||
|
|
||||||
post_array
|
|
||||||
{
|
|
||||||
"post_status":"publish",
|
|
||||||
"field_title":[
|
|
||||||
"Nom commercial",
|
|
||||||
"Votre site Internet",
|
|
||||||
"Dans quelle rubrique devez-vous para\u00eetre ? ",
|
|
||||||
"L\\'accroche en t\u00eate de page",
|
|
||||||
"Pr\u00e9sentez-vous",
|
|
||||||
"Votre logo ",
|
|
||||||
"Image principale",
|
|
||||||
"Voulez-vous afficher cette offre ?",
|
|
||||||
"Titre",
|
|
||||||
"Texte de l\\'offre",
|
|
||||||
"Image (facultatif)",
|
|
||||||
"Voulez-vous ajouter une offre ?",
|
|
||||||
"Voulez-vous afficher cette offre ?",
|
|
||||||
"Titre",
|
|
||||||
"Texte de l\\'offre",
|
|
||||||
"Image (facultatif)",
|
|
||||||
"Voulez-vous ajouter une offre ?",
|
|
||||||
"Voulez-vous afficher l\\'offre ?",
|
|
||||||
"Titre",
|
|
||||||
"Texte de l\\'offre",
|
|
||||||
"Image (facultatif)",
|
|
||||||
"slug"
|
|
||||||
],
|
|
||||||
"post_title":"test page partner",
|
|
||||||
"meta_input":[
|
|
||||||
"de_fb_url_partenaire",
|
|
||||||
"de_fb_logo_partenaire",
|
|
||||||
"de_fb_afficher_offre_1",
|
|
||||||
"de_fb_offre_1_titre",
|
|
||||||
"de_fb_offre_1_txt",
|
|
||||||
"de_fb_offre_1_image",
|
|
||||||
"de_fb_ajouter_offre_2",
|
|
||||||
"de_fb_afficher_offre_2",
|
|
||||||
"de_fb_offre_2_titre",
|
|
||||||
"de_fb_offre_2_txt",
|
|
||||||
"de_fb_offre_2_image",
|
|
||||||
"de_fb_ajouter_offre_3",
|
|
||||||
"de_fb_afficher_offre_3",
|
|
||||||
"de_fb_offre_3_titre",
|
|
||||||
"de_fb_offre_3_txt",
|
|
||||||
"de_fb_offre_3_image"
|
|
||||||
],
|
|
||||||
"url_partenaire":"",
|
|
||||||
"tax_input":["de_fb_category"],
|
|
||||||
"category":"autres",
|
|
||||||
"post_excerpt":"accroche test page partner",
|
|
||||||
"post_content":"presentation test page partner",
|
|
||||||
"_ajax_linking_nonce":"2088c0ea4f",
|
|
||||||
"logo_partenaire":"40763",
|
|
||||||
"post_thumbnail":"40764",
|
|
||||||
"afficher_offre_1":"Afficher",
|
|
||||||
"offre_1_titre":"titre offre 1",
|
|
||||||
"offre_1_txt":"text offre 1",
|
|
||||||
"offre_1_image":"",
|
|
||||||
"ajouter_offre_2":"Oui",
|
|
||||||
"afficher_offre_2":"Masquer",
|
|
||||||
"offre_2_titre":"titre offre 2",
|
|
||||||
"offre_2_txt":"text offre 2",
|
|
||||||
"offre_2_image":"",
|
|
||||||
"ajouter_offre_3":"Oui",
|
|
||||||
"afficher_offre_3":"Afficher",
|
|
||||||
"offre_3_titre":"titre offre 3",
|
|
||||||
"offre_3_txt":"text offre 3",
|
|
||||||
"offre_3_image":"",
|
|
||||||
"post_name":"test-page-partner",
|
|
||||||
"ID":"40765",
|
|
||||||
"form_type_confirm":""
|
|
||||||
}
|
|
||||||
|
|
||||||
form_type
|
|
||||||
"post"
|
|
||||||
|
|
||||||
|
|
||||||
function test_partner_CIPF($form_id, $post_array) {
|
|
||||||
error_log("---");
|
|
||||||
error_log("in test_partner_CIPF");
|
|
||||||
error_log("form_id");
|
|
||||||
error_log(json_encode($form_id));
|
|
||||||
error_log("post_array");
|
|
||||||
error_log(json_encode($post_array));
|
|
||||||
}
|
|
||||||
add_action( 'df_before_process', 'test_partner_CIPF', 10, 2);
|
|
||||||
add_action( 'df_after_process', 'test_partner_CIPF', 10, 2);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user