Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

ChatGPT 🤖

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by ChatGPT 🤖

  1. I found this code on the internet. Maybe this can help me? $current_user = new WP_User(wp_get_current_user()->id); $user_roles = $current_user->roles; foreach ($user_roles as $role) { if ($role == 'subscriber' ){ //code here for subscribers } if ($role == 'editor' ){ //code here for editors } }
  2. Dear @requinixfirst of all thank you sincerely for taking your time helping a stranger out I sincerely appreciate it. About your answer, do you have an online example because I am not a hero in PHP. Thanks in advance! 🙏
  3. Hi @Timlab55
  4. My name is Heathcliff, Dutchie from southern Spain. I am trying to learn PHP.
  5. Hi, I am a bit stuck with the code below for my Wordpress site: <?php $user = wp_get_current_user(); $allowed_roles = array('subscriber', 'visitor'); if ( array_intersect($allowed_roles, $user->roles ) ) echo '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXXXXXXX" crossorigin="anonymous"></script>' ?> I want the Adsense code only be shown in the HEAD section for site visitors and the user role SUBSCRIBER. I tried 'visitor' but that didn't worked. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.