{"id":8069,"date":"2023-08-14T14:19:55","date_gmt":"2023-08-14T21:19:55","guid":{"rendered":"https:\/\/membermouse.com\/?post_type=ht_kb&#038;p=8069"},"modified":"2025-10-20T10:20:50","modified_gmt":"2025-10-20T14:20:50","slug":"utiliser-linterface-php","status":"publish","type":"ht_kb","link":"https:\/\/membermouse.com\/fr\/documents-3-2\/utiliser-linterface-php\/","title":{"rendered":"Utilisation de l'interface PHP"},"content":{"rendered":"<p>MemberMouse vous offre une large gamme de&nbsp;<a href=\"https:\/\/membermouse.com\/fr\/documents-3-2\/smarttags-vue-densemble\/\">SmartTags\u2122<\/a>&nbsp;you can use to create a dynamic experience for your members. There are SmartTags\u2122 that display the current member's name, email address, and other information. There are tags you can use to allow members to manage their subscriptions, others to change content based on the current member's access rights, and a lot more!<\/p>\n\n\n\n<p>Tout cela est tr\u00e8s utile lorsque vous travaillez dans l'\u00e9diteur de contenu de WordPress, mais qu'en est-il si vous voulez pouvoir faire tout cela dans un script PHP personnalis\u00e9 ?<\/p>\n\n\n\n<p>C'est l\u00e0 que l'interface PHP entre en jeu.<\/p>\n\n\n\n<p><strong>NOTE<\/strong>: MemberMouse currently requires a minimum of PHP 7.4. We recommend the latest version of the PHP branch. Please see our\u00a0<a href=\"https:\/\/membermouse.com\/fr\/documents-3-2\/systeme-membermouse-et-conditions-dhebergement\/\" target=\"_blank\" rel=\"noreferrer noopener\">Exigences en mati\u00e8re de syst\u00e8me et d'h\u00e9bergement<\/a>\u00a0pour obtenir les informations les plus r\u00e9centes.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Exigences relatives \u00e0 l'interface PHP<\/h5>\n\n\n\n<p>Les fonctions d'interface PHP n\u00e9cessitent l'acc\u00e8s aux biblioth\u00e8ques MemberMouse pour fonctionner. Lorsque vous utilisez les fonctions d'interface PHP dans un mod\u00e8le WordPress, ces biblioth\u00e8ques sont automatiquement charg\u00e9es. Toutefois, si vous souhaitez les utiliser dans un script PHP autonome, vous devez charger manuellement les biblioth\u00e8ques MemberMouse en ajoutant les includes suivantes au d\u00e9but de votre fichier : <\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>require_once(\"wp-load.php\") ;\nrequire_once(\"wp-content\/plugins\/membermouse\/includes\/mm-constants.php\") ;\nrequire_once(\"wp-content\/plugins\/membermouse\/includes\/init.php\") ;<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Si votre script est situ\u00e9 dans le r\u00e9pertoire racine de WordPress, vous pouvez utiliser les includes exactement comme ils sont pr\u00e9sent\u00e9s ci-dessus. Si votre script est situ\u00e9 dans un autre r\u00e9pertoire, vous devez mettre \u00e0 jour les chemins de fichiers de mani\u00e8re appropri\u00e9e.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Translating SmartTags\u2122 in PHP Functions<\/h5>\n\n\n\n<p>With MemberMouse's PHP Interface you can utilize MemberMouse SmartTags\u2122 right within a custom PHP script. You can use any WordPress plugin for executing PHP (i.e. PHP Exec) to use the PHP Interface functions right within the WordPress content editor. All SmartTags\u2122 are supported through the PHP Interface with the exception of&nbsp;MM_Form&#8230;&nbsp;and&nbsp;MM_Error&#8230;&nbsp;SmartTags\u2122.<\/p>\n\n\n\n<p>When using SmartTags\u2122 within the WordPress content editor the following syntax is used: <\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>[MM_Member_Data name='email']\n[MM_Member_Decision membershipId='2|3']...[\/MM_Member_Decision].<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>SmartTags\u2122 are transformed into their PHP interface equivalent by taking the SmartTag\u2122 name, making it all lowercase, and adding parenthesis to make it a valid PHP function. <\/p>\n\n\n\n<p>So for example,&nbsp;[ MM_Order_Data ] becomes mm_order_data ( ).&nbsp;<\/p>\n\n\n\n<p>Les attributs sont transmis aux fonctions d'interface PHP sous la forme d'un tableau associatif. <\/p>\n\n\n\n<p>Voici quelques exemples : <\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>mm_member_data(array(\"name\"=&gt;\"email\"))\nmm_member_decision(array(\"isMember\"=&gt;\"true\", \"membershipId\"=&gt;\"2|3\"))<\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The PHP Interface function accepts all of the same attributes as the SmartTag\u2122 itself. Refer to the&nbsp;<a href=\"https:\/\/membermouse.com\/fr\/documents-3-2\/smarttags-vue-densemble\/\">SmartTag\u2122 documentation<\/a>&nbsp;for a list of attributes by SmartTag\u2122.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Valeurs de retour<\/h5>\n\n\n\n<p><code>mm_..._data()<\/code>&nbsp;renvoient une cha\u00eene de caract\u00e8res contenant les donn\u00e9es demand\u00e9es.<\/p>\n\n\n\n<p><code>mm_..._link()<\/code>&nbsp;renvoient une cha\u00eene de caract\u00e8res contenant une URL ou une fonction javascript qui doit \u00eatre plac\u00e9e \u00e0 l'int\u00e9rieur d'un fichier&nbsp;<code>&lt;a&gt;<\/code>&nbsp;ou&nbsp;<code><button><\/code>&nbsp;pour en faire un lien fonctionnel.<\/p>\n\n\n\n<p><code>mm_..._decision()<\/code>&nbsp;fonctions retour&nbsp;<code>vrai<\/code>&nbsp;ou&nbsp;<code>faux<\/code>&nbsp;en fonction des attributs transmis \u00e0 la fonction et du contexte dans lequel elle est ex\u00e9cut\u00e9e.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Exemples<\/h5>\n\n\n\n<p>To see examples of how each SmartTag\u2122 can be used in PHP,&nbsp;<a href=\"https:\/\/drive.google.com\/file\/d\/1n2Cee8PP5Hgu4S3RpRhMoor7mAEOr4tj\/view?usp=drive_link\">t\u00e9l\u00e9charger l'exemple de script<\/a>.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>","protected":false},"excerpt":{"rendered":"<p>MemberMouse provides you with a wide range of&nbsp;SmartTags\u2122&nbsp;you can use to create a dynamic experience for your members. There are SmartTags\u2122 that display the current member&#8217;s name, email address, and&#8230;<\/p>","protected":false},"author":21411,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"om_disable_all_campaigns":false,"_strive_editorial_status":"not-started","_strive_copy_of":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"ht-kb-category":[187],"ht-kb-tag":[],"class_list":["post-8069","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-mm-php"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/ht-kb\/8069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/users\/21411"}],"replies":[{"embeddable":true,"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/comments?post=8069"}],"version-history":[{"count":1,"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/ht-kb\/8069\/revisions"}],"predecessor-version":[{"id":21354,"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/ht-kb\/8069\/revisions\/21354"}],"wp:attachment":[{"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/media?parent=8069"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/ht-kb-category?post=8069"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/membermouse.com\/fr\/wp-json\/wp\/v2\/ht-kb-tag?post=8069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}