Buddypress members not listed - php

Trying to import members to my website which is using buddypress from an sql dump. I tried inserting the details in wp_xprofile_data and wp_users tables but it is not showing up in buddypress members area. How can I solve this problem?

I believe they need an entry in wp_usermeta -> meta_key = last_activity & meta_value = 2012-06-04 21:51:03
before they will show up any where.
So if they haven't logged in at least once, they won't show up.
As part of your import, create a last_activity entry.
Depending on how you have BP set-up, you may also need to 'activate' members.

Related

Update/insert meta_key and meta_value in wp_postmeta

I have a website with coupons and a large database. In wp_postmeta most of my posts have a store_id, because I use the plugin Yoast SEO and it sets the meta_key and the meta_value. Not all of my coupons have a store_id in the wp_postmeta, like the older coupons or some of them who was copied from the old ones, or who came automatically through API.
If I update every coupon and re-click the store part, the post gets the store_id written in the table wp_postmeta. But I have more than 50 000 coupons... I need the store_id set for every coupon I have, for other tasks I need to do.
Is there an easier way how to do this, without manually updating every coupon?
First, please make a backup.
If I understand correctly, yoiu need to change every row in the wp_postmeta table to set the store_id to the same value. If I've misunderstood in some way, that is, if you need to set a different value for some rows or if you don't want to over-write existing data, you should stop reading here. I don't know anything about Yoast SEO and only know as much as I've perceived from your post here.
But changing a single column for all rows is easy. You need an SQL statement something like this:
UPDATE `wp_postmeta` SET `store_id`=1
That will change the store_id of every row in wp_postmeta to 1.
Since you've tagged phpMyAdmin, presumably you're using that as your interface. Just click the SQL tab once you're in your WordPress database to enter the text of the query directly there.

How to get the rows of mySQL based on a visitors path?

In my database I save the browsed pages of my registered visitors and the referrers.
So each new browsed page has its own row. Also, each row has a column "username" where I save the username of each visitor.
What I want to achieve is to know which visitors had a journey that while browsing the website viewed the /pricing page, but also BEFORE that page, they had an entrance ref by Google.
Honestly I don't have a clue how to make it, but I am trying like below which for now is wrong.
Any heads up please?
SELECT * FROM pages WHERE (ref='Google' or url='/pricing') group by username
You could use a subquery to do this.
SELECT DISTINCT username
FROM pages AS ref_pages
WHERE ref = 'Google' AND username IN(
SELECT DISTINCT username FROM pages
WHERE url = '/pricing' AND time > ref_pages.time
)

Wordpress list all users and users with subscription level 1 first

So I want to create a list of users, and show the paying users first in the list - How do I do this? I've tried creating an SQL query, however im struggling a bit on how to make JOINS...
Lets say I have 10 users and 4 of them is paying customers. When in my SQL statement I want to get all users, but the ones that are paying should be listed first?
$row = $wpdb->get_results( "SELECT * FROM wptest_users JOIN wptest_usermeta on user.rcp_subscription_level");
So what im trying to do there is getting all users from wptest_users, and then trying to make a join with wptest_usermeta, and getting the meta field I want to order by - So if "rcp_subscription_level" equals 1, then the user is a paying customer...
Hope it makes sense on that im trying to achieve, and hope someone can help?
Ahh, almost got it now:
Got this so far:
SELECT wptest_users.ID, wptest_users.display_name, wptest_usermeta.user_id, wptest_usermeta.meta_value, wptest_usermeta.meta_key FROM wptest_users, wptest_usermeta WHERE wptest_users.ID = user_id AND meta_key = 'rcp_subscription_level' ORDER by user_id
Now I only need to sort it by the value of the subscription level

Wordpress Subscriptions in laravel (corcel)

I have 2 projects, one in Wordpress, and the other one in Laravel 4.2.
Recently i had to merge both projects into one Laravel 4.2 App using jgrossi/corcel. This was my only option.
Everything works fantastic! I can even post directly into Wordpress without logging into Wordpress to get posts, comments, etc.
But there is something I can't figure out. Wordpress is using Jetpack for subscribers. The laravel app needs a field to add more subscribers. I have very little experience in Wordpress.
Is it possible to add subscribers from outside Wordpress directly into the database? If not, is there a way to use a Jetpack plugin outside of Wordpress?
Yes you can add new users in database with subscribers role.
Wordpress stores the users data in wp_users table and its meta info in wp_usermeta. So follow the following steps
Add a new entry in wp_users table. As a sample here is entry from my wp_users table. You can submit values for these attributes using your normal laravel form with post request.
Add its related data in wp_usermeta table. Here you need to set two key value attributes against user_id of newly inserted record.
meta_key = wp_capabilites and meta_value = a:1:{s:10:"subscriber";b:1;}. As you can note the meta_value for wp_capabilities is in serialzed form.
meta_key = show_admin_bar_front and meta_value = true.
So you added a new user with subscriber role.

OpenCart : Extract Orders Details in Database

I know I can extract Sales Order data in OpenCart database, in table shop_order and shop_order_product.
Is it possible to differentiate which user creates the sales order?
I don't think there's an option to identify which admin user created the order. You may need to code it yourself. The below steps may help you.
Add 2 new fields created_user_id and updated_user_id in order table - with default value as 0.
Update the admin/model/sale/order.php to insert values to those fields as $this->user->getId(); (addOrder and editOrder functions ).
Add a new field user_id in order_history table - with default value as 0.
Update the admin/model/sale/order.php to insert value to that field as $this->user->getId(); (function: addOrderHistory).
You can do these by directly modifying the files or using vqmod. If it's done via vqmod then it'll be easier for you to make changes during opencart version upgrade.
Opencart: Vqmod tutorial
Have a nice day!!
By default, there's no way to know which admin an order is created by, or even that the order isn't created by the user (other than the IP would be that of the admin). You could in theory add the user_id to the shop_order table, and pass that to the manual order editor when it creates the orders

Categories