• yrhs320070

    (@yrhs320070)


    HI

    After using the UM role, add articles via functions.php
    An error occurred
    New post form using wordpress editor identity renders fine
    But articles added using UM role will only output code
    Is there a way to handle this
    thanks`

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @yrhs320070

    What error are you getting? If you think you are getting an error because the role does not have the capability you can navigate to wp>admin > ultimate member > user roles > edit role. You can scroll to the bottom of the screen to WP Capabilities section and check the required checkboxes to provide additional capabilities.

    Thread Starter yrhs320070

    (@yrhs320070)

    Hello
    I have selected all options but still can’t improve the problem

    Plugin Support Aswin Giri

    (@aswingiri)

    @yrhs320070 Can you please share a screenshot of what output you see when an article is added as a user with Um role.

    Since you can’t upload images here, you can use services like “lightshot” or just upload screenshots somewhere and share links here.

    Thread Starter yrhs320070

    (@yrhs320070)

    Hello~

    by administrator
    https://prnt.sc/1hhfFBlF7W_7

    by um_custom_role_1
    https://prnt.sc/NS0AfPPaflLw

    I think the problem is “insert a post with HTML Tags”.
    But i don’t understand why administrator is correct.

    Thread Starter yrhs320070

    (@yrhs320070)

    HI
    We add the following code in functions.php
    to automatically produce articles
    The above problem occurs

    $leadContent = "<!DOCTYPE html><html><?php $orderid = date('ymdHis').substr(uniqid(),-3); ?> 
         <h1>付款訂單</h1><label>商店代碼:</label>".$shopid."<label>商店名稱:</label>".$shopname."<label><b>金額:</b></label>".$price;
         $leadContent .= " 
          <form action='https://wistronpay.com.tw/Test/1.php' method='post'>
          訂單編號
          <input name='orderid' id='orderid' value='' type='text' readonly>
          商店代碼
          <input name='shopid' id='shopid' value='".$shopid."' type='text' readonly>
          商店名稱
          <input name='shopname' id='shopname' value='".$shopname."' type='text' readonly>
          產品名稱
          <input name='product_name' id='product_name' value='".$product_name."' type='text' readonly>
          選擇數量 * 
          <select name='tot_pin_requested' onchange='calculateAmount(this.value)' required='required' >
          <option value='' disabled selected></option>
          <option value='1'>1</option>
          <option value='2'>2</option>
          <option value='3'>3</option>
          <option value='4'>4</option>
          <option value='5'>5</option>
          <option value='6'>6</option>
          <option value='7'>7</option>
          <option value='8'>8</option>
          <option value='9'>9</option>
          <option value='10'>10</option>
        </select>
            總金額
            <input name='tot_amount' id='tot_amount' type='text' readonly>
            訂單日期
            <input name='TransactionDate' id='TransactionDate' type='text' value='".$submit_time."' readonly>
            <script>
                function calculateAmount(val) {
                    var tot_price = val * $price;
                    //display the result
                    var divobj = document.getElementById('tot_amount');
                    divobj.value = tot_price;
                }
            </script>
        選擇付款方式
        <input type='radio' name='pay' value='atm' checked> ATM
        <input type='radio' name='pay' value='code'> 超商代碼
        <input type='radio' name='pay' value='barcode'> 超商條碼
        <input type='radio' name='pay' value='thirdpay'> 第三方支付<br>
        姓名  <input type='text' name='name' placeholder='輸入姓名'><br>
        手機  <input type='text' name='phone' placeholder='輸入手機'><br>
        信箱 *<input type='text' name='email' placeholder='輸入信箱' required='required2'><br>
        <input type='hidden' name='user_id' value='".$user_id."'>
        <input type='submit'>
        </form>
        <style>
          .elementor.elementor-2452{display: none;}  
        </style>
        <script>
        document.getElementById('orderid').value = Date.now().toString(36) + Math.random().toString(36).substr(2,4);
        </script>
        </html>
        ";
         
         # build time&date
         $timeStamp = $minuteCounter = 0;  
         $iCounter = 1; 
         $minuteIncrement = 1; 
         $adjustClockMinutes = 0; 
         $minuteCounter = $iCounter * $minuteIncrement; 
         $minuteCounter = $minuteCounter + $adjustClockMinutes; 
         //$timeStamp = date('Y-m-d H:i:s', strtotime('+8 hours')); 
    
          # build post
         $new_post = array(
         'post_title' => $leadTitle,
         'post_content' => $leadContent,
         'post_status' => $postStatus,
         'post_date' => $submit_time,
         'author' => $userID,
         //'post_author' => $userID,
         'post_type' => $postType,
         'post_category' => array($categoryID)
         );  
         # publish it !
         $post_id = wp_insert_post($new_post);
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘UM role question’ is closed to new replies.