8 – Adding a ‘OR’ condition to query

I need to add a OR condition to my query so that I can get all nodes related to a particular term. Here is what I have done :

$query = Drupal::database()->select('taxonomy_index', 'ti');
$query->fields('ti', ('nid'));

// OR CONDITION
$or_group = $query->orConditionGroup()->condition('ti.tid', $params(1), 'IN');

$query->condition('ti.tid', $params(0), 'IN');
$query->condition('ti.status', 1);

// Added OR CONDITION TO QUERY.
$query->condition($or_group);

$query->execute()->fetchAllAssoc('nid');

This is the how the query get build :

QUERY

SELECT ti.nid AS nid

FROM {taxonomy_index} ti

WHERE (ti.tid IN (:db_condition_placeholder_0))

AND (ti.status = :db_condition_placeholder_1)

AND (ti.tid IN (:db_condition_placeholder_2));

PARAMS

Array (

(:db_condition_placeholder_0) => 170

(:db_condition_placeholder_1) => 1

(:db_condition_placeholder_2) => 227

);

As you can see the last “AND” condition should be “OR”.

Thanks.

Adding prefix to WordPress database tables breaks admin capabilities?

I have attempted a few different ways (manually, using Brozzme’s DB Prefix Tools & Addons plugin) to add a prefix to an older WP database (right now table names look like posts instead of wp_posts or stx_posts, etc.).

Strangely, no matter what way I do it, something breaks after adding the prefix. Everything is updated in wp-config.php fine to reflect the prefixes existence but when I attempt to navigate the admin side of things I get an error page instead:

“Sorry, you are not allowed to access this page.”

This has me completely confused as adding a prefix to the tables shouldn’t cause anything to change with user’s permissions! Has anyone seen this problem before?

P.S. Not sure if this is relevant but the current host is Cloudways. I’m not sure how this would be involved but I’ve seen some weird caching issues with Cloudways. For example, I’ve deleted a file using SSH from the server, everything works, and then a little later the file is back.

command line – Termux (Terminal) tsu is adding “(unreachable)” to my current working path

When I run tsu (which is Termux’s version of su), my current working directory gets prefixed with “(unreachable)”, as you can see from the transcript of my session.

(u0_a116 …/~)$ tsu
(root …/home)# pwd
(unreachable)/data/data/com.termux/files/home
(root …/home)#

I did some digging and found what seems to me is the culprit.
tsu is a script that sets up an environment for the root user and then runs su to give you root privilege with the new environment. This is what the command that tsu is running looks like after opening all the variables.
/sbin/su -c PATH=/sbin/.magisk/busybox env -i PATH=/data/data/com.termux/files/usr/bin:/data /data/com.termux/files/usr/bin/applets:/system/bin:/system/xbin:/sbin:/sbin/bin ANDROID_DATA=/data TMPDIR=/data/data/com.termux/files/home/.suroot/.tmp PREFIX=/ data/data/com.termux/files/usr TERM=xterm-256color LD_PRELOAD=/data/data/com.ter mux/files/usr/lib/libtermux-exec.so ANDROID_ROOT=/system HOME=/data/data/com.ter mux/files/home/.suroot /data/data/com.termux/files/usr/bin/bash

This causes a problem when I try to run a script that is using relative paths. (I’m running a script to setup a full linux distro with proot in Termux).

If I take out the ‘env -i` from the command then I get the current working directory without the prefixed “(unreachable)”. This does not setup the new environment, it leaves the old environment intact as if I would have selected –preserve option.

Pasting from Google Docs into WordPress adding unnecessary formatting

Found that the issue is TinyMCE. Here is a solution that prevents the spans from being added on paste: https://bionicteaching.com/clean-google-doc-cut-paste-into-wordpress-editor/

Add this to functions.php:

//fix cut paste drama from https://jonathannicol.com/blog/2015/02/19/clean-pasted-text-in-wordpress/
add_filter('tiny_mce_before_init','configure_tinymce');

/**
 * Customize TinyMCE's configuration
 *
 * @param   array
 * @return  array
 */
function configure_tinymce($in) {
  $in('paste_preprocess') = "function(plugin, args){
    // Strip all HTML tags except those we have whitelisted
    var whitelist = 'p,b,strong,i,em,h2,h3,h4,h5,h6,ul,li,ol,a,href';
    var stripped = jQuery('<div>' + args.content + '</div>');
    var els = stripped.find('*').not(whitelist);
    for (var i = els.length - 1; i >= 0; i--) {
      var e = els(i);
      jQuery(e).replaceWith(e.innerHTML);
    }
    // Strip all class and id attributes
    stripped.find('*').removeAttr('id').removeAttr('class').removeAttr('style');
    // Return the clean HTML
    args.content = stripped.html();
  }";
  return $in;
}```

magento2 – Adding plugin on tinymce

So i follow this tutorial -> https://magento.marcelhauri.ch/blog/how-to-add-a-tinymce-plugin-to-the-magento2-wysiwyg-editor

And everything works so far if i remove this line of code

ed.contentCSS = [ed.settings.magentoPluginsOptions._object.Addfourcolumnbox.css];

But if i add it i get an error that say this

Failed to initialize plugin: Addfourcolumnbox TypeError: Cannot read property 'Addfourcolumnbox' of undefined
at t.<computed>.t.<computed>.init

So i have tried everything to fix it, but nothing works, so i hope somebody else have dealt with the same problem before me and found a answer to it.

Adding custom hover text using json to a SharePoint list column

You can try this and customize to suit your need

{
  "elmType": "div",
  "style": {
    "font-size": "12px"
  },
  "txtContent": "@currentField",
  "customCardProps": {
    "formatter": {
      "elmType": "div",
      "txtContent": "[$Description]",
      "style": {
        "font-size": "12px",
        "color": "green",
        "padding": "5px"
      }
    },
    "openOnEvent": "hover",
    "directionalHint": "bottomCenter",
    "isBeakVisible": true,
    "beakStyle": {
      "backgroundColor": "white"
    }
  }
}

enter image description here

web hosting – Infinityfree Error Adding Domain

I have this domain setting via Cloudflare:

enter image description here

I have bought the domain form nic.ir and set its dns to brad.ns.cloudflare.com & kate.ns.cloudflare.com as you can see here:

enter image description here

This is strange because this settigs working by www.awardspace.com freehostig for setting the registred domain to the host domain, but with infinityfree.net i have some problem to do it.

and by trying to add it to my infinityfree account i found this error:

Error Adding Domain..
This could be due to already adding the domain to this or another account or, you have not changed the nameservers as required or not enough time has passed since changing the nameservers..

Remember, you need to change the nameservers on a domain via registrar control panel BEFORE adding it to your account, it may take 24~72 hours to completely update the nameservers.:

Please verify your nameservers and/or change them to:

(The nameservers are changed via your domain registrar control panel, NOT your hosting control panel.)

ns1.epizy.com
ns2.epizy.com

After changing the name-servers you may have to wait 24~72 hours prior to being able to add the domain to your account..
Once the name servers are set it may take upto 76 hours before the domain can be added here.

Name servers MUST be set before adding the domain here, if your registrar REQUIRES that you add a domain before setting the name servers then you will need to use a different domain name / registrar (or contact there support requesting they manually set the name servers). We are NOT able to add domains to the vPanel without the name servers being set firstly. If this is a requirement, please UPGRADE, on our premium hosting we do allow domain names to be added without the name servers being set. Please do NOT create a support ticket unless you have waited at least 48 hours after successfully changing name servers / adding domain. 

Also i could use parking domain setting via infinityfree as you can see here:

enter image description here

by this setting and adding the wordpress42.epizy.com as www2 as CNAME via cloudflare

enter image description here

but again i get this error:

enter image description here

Error Adding Domain..

This could be due to already adding the domain to this or another account or, you have not changed the nameservers as required or not enough time has passed since changing the nameservers.

Remember, you need to change the nameservers on a domain via registrar control panel BEFORE adding it to your account, it may take 24~72 hours to completely update the nameservers.:

Please verify your nameservers and/or change them to :

(The nameservers are changed via your domain registrar control panel, NOT your hosting control panel.)

ns1.byet.org
ns2.byet.org
ns3.byet.org
ns4.byet.org
ns5.byet.org

After changing the nameservers you may have to wait 24~72 hours prior to being able to add the domain to your account. .

Once the name servers are set it may take upto 76 hours before the domain can be added here.

Name servers MUST be set before adding the domain here, if your registrar REQUIRES that you add a domain before setting the name servers then you will need to use a different domain name / registrar (or contact there support requesting they manually set the name servers). We are NOT able to add domains to the vPanel without the name servers being set firstly. If this is a requirement, please UPGRADE, on our premium hosting we do allow domain names to be add

How can I solve this?

json – RealTime Database with Flutter overwrites data instead of adding it to the existing nodes

I am using flutter with Firebase Realtime Database. As shown in the code, each user can create his lists and add tasks to it. However, every time I try to add a new task to the same list it overwrites the existing data instead of appending to it. Can someone please help me out.

This is the ToDo model

class Todo {
  String group;
  String subject;
  bool completed;
  String userId;

  Todo(this.userId, this.group, this.subject, this.completed);

  Todo.fromSnapshot(DataSnapshot snapshot)
      : group = snapshot.value("group"),
        userId = snapshot.value("userId"),
        subject = snapshot.value("subject"),
        completed = snapshot.value("completed");

  toJson() {
    return {
      userId: {
        "lists": (
          {
            "groupname": group,
            "tasks": (
              {"name": subject, "done": completed},
            )
          },
        )
      }
    };
  }
}

This is the function to add to the database

  addNewTodo(String groupn, String taskn) {
    if (groupn.length > 0 && taskn.length > 0) {
      Todo todo =
          new Todo(widget.userId, groupn.toString(), taskn.toString(), false);
      _database.reference().child("Todo").set(todo.toJson());
    }
  }

groupn & taskn are the variables inputted by the user.

Adding key highlights to product image gallery in e commerce app

We’re thinking of adding key highlights of the product on the top of an overlay of the product image, most probably on the second image of the crousal, just wanted to understand whether it will be good idea or not. As according to most of the users, product images are the first thing they see when they land on the product page for the first time, giving user the ease to find key highlights on the images itself could help in positive conversions.

Magento 2.3 – What is the recommended practice for adding custom text in product page

I want to add custom text to the product page,

enter image description here

Here how can i achieve this task, which is the recommended way to do that: Module (or) Events Observer (or) Preference. What kind of workout safe for future version upgrade?