WooCommerce and Membership: Can I fetch the membership from the product?

I am working on a membership system. We have added our own in-app-purchase (IAP) plugin to communicate with Apple, Amazon, Google Play and Roku. So far, everything is working as we expect. The issue I am currently having is when I validate the receipt, I want to fetch the membership plan from the product, not a subscription, although I could get it to use that if I must. I have tested with a subscription too but still no luck. Since this will be an automated verification system the subscription seems to be more of a hassle as a simple product seems more ideal for our use case.

I have tried using:

$  _membershipPlan = \wc_memberships_get_memberships_from_subscription($  _productObj); 

Where $ _productObj has been a simple product and a simple subscription but it never returns the membership.

What I am trying to do is once the reciept is validated, I fetch the WC_Product (product or subscription) then I want to see what membership is attached to it and apply this to the user.

I have searched for this in their Docs and on Google and I haven’t been able to find anything. My last resort would be to write my own WP_Query object to handle this, as it seems I might have to do.

Something to note, the method wc_memberships_get_memberships_from_subscription is looking for _subscription_id but the membership doesn’t even have this as meta for it. It does have _product_ids stored in a serialized array which will be annoying to query. Not sure why this would be the case but this is where I am stuck.

Hoping someone here would have a little insight on this or point me in the right direction.

Thank you for your time.

backbone fetch() not working

I’m trying to use the REST API with Backbone in a plugin. I’m working through the documentation and examples at: https://developer.wordpress.org/rest-api/using-the-rest-api/backbone-javascript-client/. The first example to create a post works as expected:

// Create a new post var post = new wp.api.models.Post( { title: 'This is a test post' } ); post.save(); a new post is created.

However the next example to fetch a post : var post = new wp.api.models.Post( {id:1} ); post.fetch( ); console.log(JSON.stringify(post));

Does nothing. I have tried different post ids including the one created with the previous code. I get no errors or warnings. Just nothing happens. Everything else I have read says this should work. Any suggestions?

Fetch likes count

I’m using Buddypress with rtmedia plugin. What I’m trying to achieve is to display total media likes count of each members’ gallery on their respective header. I tried this code but it always displays 0… Maybe someone can help

function custom_rtmedia_likes() {     global $  rtmedia;       $  likecount = intval( $  rtmedia->likes ); ?>   <p>     <span id="media-likes"><?php echo $  likecount; ?> Likes</span>   </p> <?php   }   add_action('bp_before_member_header_meta', 'custom_rtmedia_likes'); 

i want fetch json data in mysql

I am using MySQL version 5.6.41-84.1-log, I want to fetch single column of JSON data example: I want to fetch date only anyone give me the solution

id | amount_detail ---------------- 1  | {"1":{"amount":"1000","date":"2020-01-22","amount_discount":"0","amount_fine":"0","description":"paid Collected By: Super Admin","payment_mode":"Cash","inv_no":1}} 

Google Search console cannot fetch my sitemap. How to force Google to index a site?

I am working on a project that just rebranded.

Using Google Search Console I am getting some weird errors. Despite my sitemap_index.xml and robot.txt working properly, google cannot seem to fetch it for some reason.

my sitemap is here: https://example.com/sitemap_index.xml

and my robot.txt: https://example.com/robot.txt

When I try to get my site referenced on google this is what I get: enter image description here enter image description here

If I click on Open sitemaps it opens just fine.

This is what google is saying on my url inspection: enter image description here

I tried reindexing multiple times but nothing changed.

The site has been live for over a month now and is still not referenced despite having backlinks pointing to it from linked in and more.

Where can this be coming from? I asked Google support but no luck and asked my DNS provider to double check everything but it seems fine. I’ve also hired a DevOps to check my server configuration but apparently everything is fine.

Fetch the document name from Document Library using Document ID

I have a Document Library with multiple documents. One can select multiple documents even all the documents at a time.
I need to fetch the documents name which are selected in Javascript using JQuery & SPServices
First, I am able to get IDs which are selected using the following code

var context = SP.ClientContext.get_current(); var selectedItems = SP.ListOperation.Selection.getSelectedItems(context); 

So, I am getting the IDs which are selected, now I need to fetch the name of those documents by the IDs.
Guys can anyone please tell me what is the best way to do so.

“apt-get update”: failed to fetch (Ubuntu 18.04 TLS via Windows 10)

  1. There are many different solutions on the Internet, but they didn’t not help me, or I do not know how to correctly execute them. After reading many of them, I think maybe I should configure internet connection settings.

I disabled all firewalls on my PC AND on my router (I use wifi), also I disabled domain protection, windows defender, and changed my wifi connection to public. Also, I found that I can ping IPs via ubuntu.

I am very new to Ubuntu and I use it via Windows 10, please help me! I think that maybe I have to do something with my proxy and network settings. Many people had the same problem, they set a proxy for apt, and after that their problem was solved. I write code from home and I don’t have any proxies. I hope that you will give me a hint


    sudo apt-get update Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease   Temporary failure resolving 'archive.ubuntu.com' Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease   Temporary failure resolving 'security.ubuntu.com' Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease   Temporary failure resolving 'archive.ubuntu.com' Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease   Temporary failure resolving 'archive.ubuntu.com' Reading package lists... Done W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead. 

How to fetch different record when nothing matches in where conditions in the same query?

I am using ORACLE 12C database.

There are two components – Agreement and Case.

Agreement related information stores on Agreement_line and Object Table. Common column between these tables are Trans_id and agr_line_no.

Similarly, Case related information stores in Cla_case and Cla_event table. Common column between these tables is Cla_event_no.

I want to fetch details of case whose incident_date is falling between Cover_start_date and Cover_end_date of Agreement_line table. Incident_date is column of Cla_event table

I am getting desired output from the below query :

select cc.cla_case_no, al.poly_no,al.agr_line_no, al.agr_line_seq_no, al.product_line_id, al.trans_id, al.cover_start_date, ce.incident_date, al.cover_end_date, o.n15, cc.name_id_no, o.object_no, o.seq_no, CASE WHEN o.n15 = cc.name_id_no      THEN ' '      ELSE 'Joint Ins'    END    AS NAME_ID_CHECK from cla_case cc, cla_event ce, agreement_line al, object o where cc.cla_case_no = 9353152 and ce.cla_event_no = cc.cla_event_no and AL.COVER_START_DATE <= CE.INCIDENT_DATE and al.cover_end_date >= ce.incident_date and al.poly_no = 410385376 and al.product_line_id  = 'BHEDS'  and al.agr_line_no = o.agr_line_no and al.trans_id = o.trans_id 

But now I also need to fetch latest record of provided poly_no when the incident_date is not falling between cover_start_date and cover_end_date

I tried below query :

SELECT cc.cla_case_no,        al.poly_no,        al.agr_line_no,        al.agr_line_seq_no,        al.product_line_id,        al.trans_id,        al.cover_start_date,        ce.incident_date,        al.cover_end_date,        o.n15,        cc.name_id_no,        o.object_no,        o.seq_no,        CASE WHEN o.n15 = cc.name_id_no THEN ' ' ELSE 'Secondary insured' END           AS NAME_ID_CHECK,        ' ' "INCIDENT_DATE_CHECK"   FROM cla_case cc,        cla_event ce,        agreement_line al,        object o  WHERE     cc.cla_case_no = 9353152        AND ce.cla_event_no = cc.cla_event_no        AND AL.COVER_START_DATE <= CE.INCIDENT_DATE        AND al.cover_end_date >= ce.incident_date        AND al.poly_no = 410385376        AND al.product_line_id = 'BHEDS'        AND al.agr_line_no = o.agr_line_no        AND al.trans_id = o.trans_id UNION SELECT cc.cla_case_no,        al2.poly_no,        al2.agr_line_no,        al2.agr_line_seq_no,        al2.product_line_id,        al2.trans_id,        al2.cover_start_date,        ce.incident_date,        al2.cover_end_date,        o2.n15,        cc.name_id_no,        o2.object_no,        o2.seq_no,        CASE WHEN o.n15 = cc.name_id_no THEN ' ' ELSE 'Secondary insured' END           AS NAME_ID_CHECK,        'Incident date not falling between cover start date and cover end date '           "INCIDENT_DATE_CHECK"   FROM agreement line al2, object o2 where al2.poly_no not exists ( SELECT al.poly_no FROM cla_case cc, cla_event ce, agreement_line al where cc.cla_case_no = 9353152 and ce.cla_event_no = cc.cla_event_no and AL.COVER_START_DATE <= CE.INCIDENT_DATE and al.cover_end_date >= ce.incident_date and al.poly_no = 410385376 and al.product_line_id  = 'BHEDS' ) and al2.poly_no = 410385376 and al2.product_line_id = 'BHEDS' and al2.newest = 'Y' and  al2.agr_line_no = o2.agr_line_no and al2.trans_id = o2.trans_id 

I am getting error saying “Command not properly ended”. Could anyone please point out what I am doing wrong and is there any other alternative way instead of using UNION ?

failed to fetch postgres

Good day, I am having issues installing postgresql for ubuntu 18.04 to start off i installed a previous version of ubuntu and upgraded to 18.04 before doing any installations and 62% of the headers went thought before this.

Err:1 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 postgresql-11 amd64 11.5-3.pgdg18.04+1 Connection failed [IP: 8080] E: Failed to fetch http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-11/postgresql-11_11.5-3.pgdg18.04+1_amd64.deb Connection failed [IP: 8080] E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

ive done all of the suggestions above but it still doesnt work. ive followed most of the tutorials and added the repo to apt. yes i am behind a proxy

any assistance will be greatly appreciated